W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2007

Re: Check two elements are not deep equal

From: Andrew Welch <andrew.j.welch@gmail.com>
Date: Wed, 28 Nov 2007 12:57:05 +0000
Message-ID: <74a894af0711280457x682e449i2e6e3aa9fa8b5eba@mail.gmail.com>
To: "Michael Kay" <mike@saxonica.com>
Cc: xmlschema-dev@w3.org

On 28/11/2007, Michael Kay <mike@saxonica.com> wrote:
> In 1.1 - as implemented by Saxon 9.0 - you can do
> <xs:assert test="not(deep-equal(old, new))"/>
> But if it's as simple as this I think you can also do it in 1.0:
> * define that both old and new exist in the usual way
> * define at the update level
> <xs:unique>
>   <xs:selector xpath="*"/>
>   <xs:field xpath="data1"/>
>   <xs:field xpath="data2"/>
> </xs:unique>

Fantastic - that's brilliant thanks... there are 20 elements is the
real code so the list is a lot longer but it does the job.

One small issue which I can happily live with - two of the elements
are optional (say data3 and data4), and when they don't occur in the
XML I get this error (from Xerces):

org.xml.sax.SAXParseException: Not enough values specified for
<unique> identity constraint specified for element "update".

I've removed the elements from the field list in the unique
constraint, which is fine as they're rare, but if its straightforward
to handle this situation... any ideas?

Received on Wednesday, 28 November 2007 12:57:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:13 UTC