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

RE: Schema based XML compare

  • From: "David Lee" <dlee@calldei.com>
  • To: "'Mukul Gandhi'" <gandhi.mukul@gmail.com>
  • Date: Sat, 25 Dec 2010 12:59:53 -0500

RE:  Schema based XML compare
Thanks.
Yes I'm planning on using Xerces.
I already have the code from a different project that can produce the XSTypeDefinition node as I run through a StAX process and do a compare (not diff).
In my case (mostly asthetically) I don’t want to convert my existing compare using Stax (streamable) to non-streamable using DOM just for this, although your example should work fine.
I'm going to try it and keep streamability.

-David


----------------------------------------
David A. Lee
dlee@calldei.com
http://www.xmlsh.org

-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com] 
Sent: Saturday, December 25, 2010 12:04 PM
To: David Lee
Cc: xml-dev@lists.xml.org
Subject: Re:  Schema based XML compare


Hi David,
   Here's a Xerces specific idea.

We could build two (for the two XML documents that are been compared)
PSVI annotated DOM trees, and then try to compare these two PSVI DOM
trees by doing a parallel node traversal (and flag an error on a first
difference).

If we see an API here for example
http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/dom/PSVIElementNSImpl.html,
the method "getSchemaValue()" seems to give us a schema typed value.

I haven't tried these APIs, but I feel the requirements mentioned in
your use-case can be met with such a design.

On Fri, Dec 24, 2010 at 6:09 PM, David Lee <dlee@calldei.com> wrote:
> Interesting ideas.
> What I have in mind is probably closer to deep-equal ... but could run on a non-schema aware processor.
> I happen to have  a StAX based compare program which runs in streaming mode and handles blankspace or not as a global option.
>
> I was thinking of "simply" keeping track of the XSTypeDefnition for each node as it encounters it and replace the current string-compare
> with a data type compare.
>
> I did not consider something like
>
> ================================
> the element sequence
> <x>hello</x>
>
> would be schema equivalent to
>
> <x>hello</x>
> <x>hello</x>
> <x>hello</x>
> ============================
>
> Which actually I don’t think follows ...
> If I went that far all you would have to do is validate the 2 documents against a schema and not bother comparing them.
>
> For my use cases I would NOT consider the above to be equivilent.
> By 'schema equivilent'   I mean the document *instances* are equivilent but the data comparison of text values uses schema type information
> so say a xs:double  "6.0"  == "6"   but not if it were an xs:string


>
> ----------------------------------------
> David A. Lee
> dlee@calldei.com
> http://www.xmlsh.org



-- 
Regards,
Mukul Gandhi

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.