Re: [xml] Error: failed to canonicalize XML file "-" (ret=-1)


Sorry for late reply, I was out of town and was not able to run a test on your file.

If you compile LibXML2 with DEBUG_C14N macro defined then you will get
the following output that gives a hint on what caused the problem:

[aleksey lsh libxml2]$ ./testC14N --without-comments /tmp/a.xml
xmlC14NProcessElementNode: xmlC14NCheckForRelativeNamespaces failed.
xmlC14NExecute: process childrens' list failed.
xmlC14NDocDumpMemory: xmlC14NDocSaveTo failed.
Error: failed to canonicalize XML file "./tmp/a.xml" (ret=-1)

The problem is "relative" URI in the namespace declaration. According to the spec ([1]),
LibXML2 does the right thing here:

* Note:* This specification supports the recent XML plenary decision <> to deprecate relative namespace URIs as follows: implementations of XML canonicalization MUST report an operation failure on documents containing relative namespace URIs. XML canonicalization MUST NOT be implemented with an XML parser that converts
       relative URIs to absolute URIs.

With best regards,


Mikhail S Grushinskiy wrote:


Why testC14N would choke on this file?


<foo xmlns:foo="bar">

./testC14N --with-comments foo.xml
Error: failed to canonicalize XML file "-" (ret=-1)

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