[xquery-talk] deep-equal?
Michael Kay
mike at saxonica.com
Wed Oct 17 11:23:56 PDT 2007
The XML specification doesn't define such a thing as insignificant
whitespace, because there are many contexts in which whitespace is indeed
significant. deep-equal() follows this precedent. If you don't want
whitespace taken into account, get rid of it before calling deep-equal.
In practice the spec of deep-equal() is full of compromises, there are many
specific requirements that it won't meet. You can always write your own
function. Saxon has an option saxon:deep-equal() with a third parameter
containing option flags that can be used to customize its behaviour
(including a flag that causes diagnostic messages to be output saying WHY
the two trees were deemed unequal).
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: talk-bounces at x-query.com
> [mailto:talk-bounces at x-query.com] On Behalf Of Florian Wendland
> Sent: 17 October 2007 10:02
> To: XQuery Talk
> Subject: [xquery-talk] deep-equal?
>
> Hi all,
>
> i have a question concerning the euality of sequences.
> Therefore i have prepared two documents, which seemed to be
> identically.
>
> --------------------------------------------------
> First:
>
> <?xml version="1.0" encoding="utf-8"?>
> <webcritics>
> <book id="1">Dunkeltann</book>
>
> </webcritics>
>
> Second:
>
> <?xml version="1.0" encoding="utf-8"?>
> <webcritics>
> <book id="1">Dunkeltann</book>
> </webcritics>
> ---------------------------------------------------
>
> The first document contains a linebreak in the
> document-element. The deep-equal function returns false,
> although the documents are obviously the same (whitespaces
> should not be included in the compare mechanism, i think).
>
> Is this behaviour of the deep-equal function coorect?
>
> Thx
>
> mfw
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
More information about the talk
mailing list