Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Ted Leung on the air: Open Source, Java, Python, and ...
Sat, 07 Jun 2003
What does equivalence mean for XML?
Dare is back and writing like a madman. There's one aspect of comparing XML that I'm not sure he quite picked up, though
[14:15] |
[computers/programming/xml] |
# |
TB |
F |
G |
2 Comments |
If I get arbitrary XML as input to my method and want to compare whether the XML fragment is equivalent to another XML fragment there isn't an easy way to do this without converting both in-memory representations to their string representations (if they aren't strings already) and doing a string comparison. Hmmmm...String comparison is not nearly enough to determine equivalance. Aside from the namespace prefix mapping problem mentioned by Harry, there are problems related to order of attributes, whitespace between elements, and empty elements, to name a few. The Canonical XML recommendation has a good list of the issues. You have to decide what equivalence means when you are talking about XML derived data. If you want equivalence to mean "the objects that have been serialized as these two XML documents are equal in C#/Java", then you have more work to do at the "string comparison" level.
Ted,
There should be a canonicalize step in there between obtaining the string representation and performing the comparison. I just considered it to be implicit and didn't explicitly state it.
I need to write what i mean next time. :)
Posted by Dare Obasanjo at Sat Jun 7 14:24:36 2003
There should be a canonicalize step in there between obtaining the string representation and performing the comparison. I just considered it to be implicit and didn't explicitly state it.
I need to write what i mean next time. :)
Posted by Dare Obasanjo at Sat Jun 7 14:24:36 2003
I was pretty sure that you already knew that. But I just wanted to make sure ;-).
Posted by Ted Leung at Sat Jun 7 14:26:34 2003
Posted by Ted Leung at Sat Jun 7 14:26:34 2003
You can subscribe to an RSS feed of the comments for this blog:
Add a comment here:
You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
<a href>
, <em>
, <i>
, <b>
, <blockquote>
, <br/>
, <p>
, <code>
, <pre>
, <cite>
, <sub>
and <sup>
.You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk