[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
Re: Check two elements are not deep equal

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?

thanks
Received on Wednesday, 28 November 2007 12:57:15 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.