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



Mikhail,

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 <http://www.w3.org/TR/2001/REC-xml-c14n-20010315#PlenaryDecision> 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,
Aleksey

[1] http://www.w3.org/TR/2001/REC-xml-c14n-20010315



Mikhail S Grushinskiy wrote:

Hello,

Why testC14N would choke on this file?

foo.xml

<foo xmlns:foo="bar">
<foo/>
</foo>

./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]