Re: [xml] Possible bug in canonicalization



Fix has been committed to xmlstarlet CVS.

----- Original Message ----- 
From: "Mikhail S Grushinskiy" <mgrushinskiy comcast net>
To: "Elliotte Harold" <elharo metalab unc edu>; <xml gnome org>
Cc: <xmlstar-devel lists sourceforge net>
Sent: Sunday, February 08, 2004 5:07 PM
Subject: Re: [xml] Possible bug in canonicalization


Elliotte,

It seems this bug was introduced in xmlstarlet.

mikhail greybox /cygdrive/c/msys/1.0/home/mikhail/XMLSTARLET/libxml2-2.6.5
$ echo "<xml/>" | xml c14n --with-comments -
<xml></xml>
[new line here]
mikhail greybox /cygdrive/c/msys/1.0/home/mikhail/XMLSTARLET/libxml2-2.6.5
$ echo "<xml/>" | ./testC14N.exe --with-comments -
<xml></xml>
mikhail greybox /cygdrive/c/msys/1.0/home/mikhail/XMLSTARLET/libxml2-2.6.5


I will fix it in CVS and I will let you know.

--MG

----- Original Message ----- 
From: "Elliotte Harold" <elharo metalab unc edu>
To: <xml gnome org>
Cc: <xmlstar-devel lists sourceforge net>
Sent: Sunday, February 08, 2004 3:51 PM
Subject: [xml] Possible bug in canonicalization


I've encountered a likely bug in libxml's canonicalization. I am using
libxml 2.6.5, the latest released version. I probably don't have the
latest release of libxslt, though. This is on Red Hat Linux 8. I am not
certain of this bug only because I am only accessing canonicalization
through xmlstarlet, rather than through my own code. It is possible the
problem is in xmlstarlet's interface to libxml2. However, the nature of
the bug does mean that if it's in the libxml code it should be easy to
spot. Ditto if it's in xmlstarlet.

In brief, the canonicalization is placing a line feed at the end of the
canonicalized document, at least when there are no comments or PIs in
the epilog (I haven't tested what happens when there are such nodes in
the epilog). According to the canonical XML spec, section 4.3, this is
wrong:

The C14N-20000119
<http://www.w3.org/TR/2001/REC-xml-c14n-20010315#C14N-20000119>
Canonical XML draft placed a #xA after each PI outside of the document
element as well as a #xA after the end tag of the document element. The
method in this specification performs the same function except for
omitting the final #xA after the last PI (or comment or end tag of the
document element). This technique ensures that PI (and comment) children
of the root are separated from markup by a line feed even if root node
or the document element are omitted from the output node-set.

--
Elliotte Rusty Harold



_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 2/3/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 2/3/2004




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