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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to