Re: [xml] Duplicate PI nodes issue
- From: "Cory Nelson" <phrosty gmail com>
- To: "Alistair Leslie-Hughes" <leslie_alistair hotmail com>
- Cc: xml gnome org
- Subject: Re: [xml] Duplicate PI nodes issue
- Date: Fri, 7 Mar 2008 16:47:31 -0800
On Fri, Mar 7, 2008 at 4:30 PM, Alistair Leslie-Hughes
<leslie_alistair hotmail com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]