Re: exports (was: source encoding)
Brought to you by:
bs_php,
nigelswinson
From: Peter R. <php...@pe...> - 2002-06-07 17:58:50
|
On Wednesday 05 Jun 2002 00:00, Nigel Swinson wrote: > > However, whilst investigating this, I came across another > > phpxpath feature that I wasn't aware of before. Why does the > > handling of the xml PI and other header info such as dtd differ > > between exportAsXml and exportToFile? As default, exportAsXml > > keeps it, whereas exportToFile drops it. Is not the main > > difference between these 2 functions that exportToFile, er, well, > > writes the xml to a file? > > Well you could pass in the third argument as NULL and that would > prevent it from overwriting the PI. I'm not sure why it's the way > it is. Perhaps Sam has a comment? If not then perhaps we should > only add the "default" PI if none is present. if I pass in NULL, it uses the default, which in this case I don't want. IMO 1. exportAsXml and exportToFile should do the same 2. if there is an input file (i.e. this is a change, not a create new), then use header from input file unless override param 3. if not (i.e. this is a new file), use a default <?xml ...> header unless override param Whilst testing this, I came across another, um, feature. If you have 2 exports one after the other, for example ... print $xml->exportAsXml(); print $xml->exportAsXml(); ... the first one will have the header, the second and subsequent will not. I take it this is a bug and not intentional? Seems to have something to do with the node index, though putting reindexNodeTree() between the 2 exports had no effect. |