On Fri, Mar 7, 2008 at 4:30 PM, Alistair Leslie-Hughes
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I have the following program below, when it runs it produces the follwing
>  ouput
>  <?xml version="1.0"?>
>  <?xml version="1.0" encoding="UTF-8"?>
>
>  Is this a bug?
>  How can I work around the issue, assuming I have to support differ libxml
>  version?
>
>  Please assume that the xml and content parameters are dynamic strings.
>
>  Best Regards
>   Alistair Leslie-Hughes
>
>
>  #include <string.h>
>  #include <libxml/tree.h>
>  #include <libxml/parser.h>
>  #include <libxml/xpath.h>
>  #include <libxml/xpathInternals.h>
>
>  int main(int argc, char* argv[])
>  {
>     xmlDoc *doc = NULL;
>     xmlNodePtr nodePI = NULL;
>
>     xmlInitParser();
>
>     doc = xmlNewDoc( xmlCharStrdup("1.0") );
>     nodePI = xmlNewPI( xmlCharStrdup("xml"), xmlCharStrdup("version=\"1.0\"
>  encoding=\"UTF-8\""));
>     xmlAddChild( (xmlNodePtr)doc, nodePI);
>
>     xmlSaveFile("zzzzzz.xml", doc);
>     xmlFreeDoc(doc);
>     xmlCleanupParser();
>
>     return 0;
>  }
>

An XML declaration might look like it, but the standard says it is not
a PI and that PIs cant be named "xml" (or any case variant of it).  So
I would say the only bug here is that xmlNewPI is not returning with
an error.

-- 
Cory Nelson
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to