David Carlisle
Usenet Archive
- Joined
- Jan 5, 2000
- Messages
- 609
- Reaction score
- 0
Does the XML Declaration map to a Xpath node type or not.
If yes - what type of node?
No, it affects the parser (eg telling it what encoding has been used), and so affects the construction of the node tree, but no record of the declaration is left in the node set.
That's (normally) what you want. If you have a file in latin1 that starts <?xml version="1.0" encoding="iso-8859-1"?> ...
and the same data encoded in utf-8 that starts
<?xml version="1.0" encoding="utf-8"?>
Then you want these two to be equivalent. The actual data in the nodes are just logical unicode characters, the encoding used to store them originally in a file shouldn't be relevant to the logical view of the XML tree (and isn't available to XPath/XSLT).
Of course in many cases it's not unrreasonable to want to output a file with the same encoding as was used for input, but that information has gone, along with information about whether " or ' was used for attributes, or where CDATA sections were, etc.
David
If yes - what type of node?
No, it affects the parser (eg telling it what encoding has been used), and so affects the construction of the node tree, but no record of the declaration is left in the node set.
That's (normally) what you want. If you have a file in latin1 that starts <?xml version="1.0" encoding="iso-8859-1"?> ...
and the same data encoded in utf-8 that starts
<?xml version="1.0" encoding="utf-8"?>
Then you want these two to be equivalent. The actual data in the nodes are just logical unicode characters, the encoding used to store them originally in a file shouldn't be relevant to the logical view of the XML tree (and isn't available to XPath/XSLT).
Of course in many cases it's not unrreasonable to want to output a file with the same encoding as was used for input, but that information has gone, along with information about whether " or ' was used for attributes, or where CDATA sections were, etc.
David