Re: [xml] 3 pb with the xmlTextReader APi from Python



Daniel Veillard wrote:

  libxml2 keeps all the informations from the XMLDecl. They are available
from an xmlDocPtr (which wou can retrieve from the Reader). So if an xmlReader
should expose them we can expose them, the problem is the API for it, which
I did not see !
  And that's exactly the content of my initial answer, you can get the
xmlDocPtr from the reader, and from there find those informations if really
needed, though I think in general people should not use them. For example
the original encoding is *not* what people will get from the reader API, just UTF-8 and if they dump back the encoding and serialize in UTF-8 they
get non-XML. Idem for the standalone, the entity processing of the parser
may render this information moot or even wrong.
The informations in the XMLDecl are targeted at the parser code, not for the consumer of the XML !
What I have seen some people doing with SAX is to create a serialized subset of the document that they encode in the original encoding, so was trying to see if they could get access to the original encoding in xmlreader in order to do the similar. Using SAX the encoding is accessed differently with the bindings, but with xmlreader I wanted to see if it could be done natively (where the XMLDecl was considered a node). What I have been trying to wrap my head around is how this can be done in the lib or whether it is really worthwhile even trying to do it since as you said, the information can always be accessed in an alternative way.

Rob



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]