[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-user
Subject:    RE: How to use XmlObject.valueEquals
From:       "Radu Preotiuc-Pietro" <radup () bea ! com>
Date:       2006-08-30 17:09:57
Message-ID: 99479F4D39C9244F8E17E688193A3DD8BD7CB2 () repbex02 ! amer ! bea ! com
[Download RAW message or body]

The JavaDoc for .valueEquals() is fairly detailed but forgets to mention
one thing: that .valueEquals() is only implemented for simple type
values.

Actually, Schema-aware comparison is something that a lot of people find
valuable and XmlBeans has all the foundation work done to support
something like that, unfortunately we weren't able to find an interested
person that could contribute the code to do it.

This is my way of saying basically that this would be a great project
for someone who is looking to get involved in XmlBeans and in Apache and
open-source in general.

Radu 

-----Original Message-----
From: Bailey, Brian P [mailto:brian.p.bailey@lmco.com] 
Sent: Thursday, August 17, 2006 3:35 PM
To: user@xmlbeans.apache.org
Subject: How to use XmlObject.valueEquals

Hi, I'm using xmlbeans 2.1.0 and have a question about comparing
XmlObjects for equivalency. I have the following schema:

<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://myself.com/data"
targetNamespace="http://myself.com/data">
  <complexType name="location2DType">
    <sequence>
      <element name="latitude" type="double"/>
      <element name="longitude" type="double"/>
    </sequence>
  </complexType>
  <element name="Location2D" type="tns:location2DType"/> </schema>


I would like to compare two documents based on this schema and see if
they are equivalent (ignoring element prefixes, attribute ordering,
etc.). I thought I might use XmlObject.valueEquals(), but that doesn't
seem to work. For example, when running the following code, I see
"valueEquals: true" even though the latitude value is different:

      Location2DDocument doc1 =
Location2DDocument.Factory.newInstance();
      doc1.addNewLocation2D();
      doc1.getLocation2D().setLatitude(34.2);
      doc1.getLocation2D().setLongitude(84.8);
      
      Location2DDocument doc2 =
Location2DDocument.Factory.newInstance();
      doc2.addNewLocation2D();
      doc2.getLocation2D().setLatitude(95.2);
      doc2.getLocation2D().setLongitude(84.8);
      
      System.out.println("valueEquals: " + doc1.valueEquals(doc2));

What should I use to compare two xml beans for equivalency?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic