Re: [xml] finding out if XML document had a prolog

On Mon, Aug 25, 2003 at 06:02:23PM +0000, mgrushinskiy comcast net wrote:
Using libxml2 I need to save an XML document with the prolog (<?xml ...>) 
if original document had a prolog and without prolog if original document
didn't have one. It seems that information about xml prolog is not stored
in xmlDoc structure. What is the best way to solve this issue with libxml2?

  Not solvable. The only information retained from the presence of
the XML Declaration is the encoding or standalone status if it was present.
the standalone status is actually only kept during parsing. The encoding
is saved in doc->encoding if present.
  Moreover libxml2 document saving always generate the XML Declaration,
the only way to get around this is to save the docuement children
independantly and not use the main routine.
  You're doing textual manipulation, and libxml2 works at the structured
level. Very different usecases.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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