<foo>
<bar/></foo>
and
<foo>
<bar/>
</foo>
using `TreeCompare.TreeCompare(foo, foo2, ignoreWhitespace=True)`, I
get the following report of differences:
--- expected ---
#document
foo
node: <Element at 0xb79248ac: name u'foo', 0 attributes, 2 children>
node.childNodes:
[<Text at 0xb78773ec: u'\n '>,
<Element at 0xb792492c: name u'bar', 0 attributes, 0 children>]
--- compared ---
#document
foo
node: <Element at 0xb79249ac: name u'foo', 0 attributes, 3 children>
node.childNodes:
[<Text at 0xb787720c: u'\n '>,
<Element at 0xb79249ec: name u'bar', 0 attributes, 0 children>,
<Text at 0xb78771e4: u'\n'>]
Am I misinterpreting what the `ignoreWhitespace` parameter should do,
or is this a bug?
Take care,
John L. Clark
Nice. Actual usage outside of the test suites!
You've encountered an under-implemented feature. ;) As implemented, it handled
differences in the *amount* of whitespace (read length > 0) between two
documents, not absence of it however. Attached is a patch that implements
the later behavior, as well.
Note, the fix is also available in the CCF branch hosted at hg.4suite.org.
Thanks,
Jeremy Kloth
+ children1 = [ c for c in children1
+ if c.nodeType == Node.TEXT_NODE
+ and not IsXmlSpace(c.data) ]
I have attached a Mercurial bundle with the fix from my repository.
Take care,
John L. Clark