code_berzerker wrote:
>> Not in your code.
>>
>> Stefan
>
> Not sure what you mean, but I tested and so far every document with
> the same order of elements had number of comparisons equal to number
> of nodes.
Sorry, missed the "let2.remove(foundEl)" line.
Stefan
--
http://mail.python.org/mailm
> Not in your code.
>
> Stefan
Not sure what you mean, but I tested and so far every document with
the same order of elements had number of comparisons equal to number
of nodes.
--
http://mail.python.org/mailman/listinfo/python-list
code_berzerker wrote:
>> If document order doesn't matter, try sorting the elements of each level in
>> the two documents by some arbitrary deterministic key, such as (tag name,
>> text, attr count, whatever), and then compare them in order, instead of
>> trying
>> to find matches in multiple pass
> If document order doesn't matter, try sorting the elements of each level in
> the two documents by some arbitrary deterministic key, such as (tag name,
> text, attr count, whatever), and then compare them in order, instead of trying
> to find matches in multiple passes. itertools.groupby() might
code_berzerker wrote:
> Thanks for help. Thats inspiring, tho not exactly what I need, coz
> ignoring document order is requirement (ignoring changes in order of
> different siblings of the same type, etc). I plan to try something
> like that:
>
> def xmlCmp(xmlStr1, xmlStr2):
> et1 = etree.XML(
> off the top of my head (untested):
>
> >>> def equal(a, b):
> ... if a.tag != b.tag or a.attrib != b.attrib:
> ... return False
> ... if a.text != b.text or a.tail != b.tail:
> ... return False
> ... if len(a) != len(b):
> ... return False
> ... if any(not
code_berzerker wrote:
Your requirements for a single Element are simple enough to write it in three
to five lines of Python code (depending on your definition of equality).
Checking this equality recursively is another two to three lines. Not complex
enough to be considered a wheel in the first
On Jul 23, 6:29 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> Your requirements for a single Element are simple enough to write it in three
> to five lines of Python code (depending on your definition of equality).
> Checking this equality recursively is another two to three lines. Not complex
>
code_berzerker wrote:
> I'd like to know if there is any built in mechanism in lxml that lets
> you check equality of two nodes from separate documents.
No, because, as you state yourself, equality is not something that everyone
defines the same way.
> I'd like it
> to ignore attribute order and
code_berzerker <[EMAIL PROTECTED]>:
> I'd like to know if there is any built in mechanism in lxml that lets
> you check equality of two nodes from separate documents. I'd like it
> to ignore attribute order and so on. It would be even better if there
> was built in method for checking equality of
I'd like to know if there is any built in mechanism in lxml that lets
you check equality of two nodes from separate documents. I'd like it
to ignore attribute order and so on. It would be even better if there
was built in method for checking equality of whole documents (ignoring
document order). Pl
11 matches
Mail list logo