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



On Wed, Jan 18, 2006 at 05:31:51AM -0500, Rob Richards wrote:
Sorry for the late post, but finally getting back to coding again.

Daniel Veillard wrote:
On Thu, Jan 12, 2006 at 03:46:03PM +0100, Meunier, Jean-Luc wrote:
 
Pb 1 -  how to process the XML declaration , e.g. <?xml version="1.0"?>
   
 You can't. It's not made available by the API initially coming from
Microsoft. Similary you can't get into the internal subset or in any
part of the DTD content. 
 You can try to get the xmlDoc from there, but I think you shouldn't
in general.
 
Actually they are available in .NET. The XML declaration has attributes 
and the DTD has attributes and a value. I had looked at the XML 
declaration before and did not see any way to implement it correctly. 

  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 !


Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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