[
https://issues.apache.org/jira/browse/XMLBEANS-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18010665#comment-18010665
]
Mingun commented on XMLBEANS-658:
---------------------------------
I used another workaround: got a DOM node and manually check that structures
matches. Thus different string representations (namespace prefixes or excess
namespace declarations) will not influence the result.
> valueEquals always returns true
> -------------------------------
>
> Key: XMLBEANS-658
> URL: https://issues.apache.org/jira/browse/XMLBEANS-658
> Project: XMLBeans
> Issue Type: Bug
> Affects Versions: Version 5.0.0, Version 5.3.0
> Reporter: Mingun
> Priority: Major
>
> I found, that {{valueEquals}} will return {{true}} for two obviously
> different XML values.
> Take the following schema:
> {code:XML}
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:this="ValueEqualsIssue" elementFormDefault="qualified"
> attributeFormDefault="unqualified" targetNamespace="ValueEqualsIssue">
> <xs:complexType name="Type">
> <xs:sequence>
> <xs:element name="Element" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="Type" type="this:Type"/>
> </xs:schema>
> {code}
> The following code...
> {code:Java}
> final TypeDocument doc1 = TypeDocument.Factory.newInstance();
> doc1.addNewType().setElement("child");
> final TypeDocument doc2 = TypeDocument.Factory.newInstance();
> doc2.addNewType();
> final TypeDocument doc3 = TypeDocument.Factory.newInstance();
> doc3.addNewType().setElement("another");
> System.out.println(doc1);
> System.out.println(doc2);
> System.out.println(doc3);
> System.out.println();
> System.out.println("doc1 valueEquals doc2 = "+doc1.valueEquals(doc2)); // true
> System.out.println("doc2 valueEquals doc1 = "+doc2.valueEquals(doc1)); // true
> System.out.println();
> System.out.println("doc1 valueEquals doc3 = "+doc1.valueEquals(doc3)); // true
> System.out.println("doc3 valueEquals doc1 = "+doc3.valueEquals(doc1)); // true
> {code}
> ...output
> {noformat}
> <Type xmlns="ValueEqualsIssue">
> <Element>child</Element>
> </Type>
> <Type xmlns="ValueEqualsIssue"/>
> <Type xmlns="ValueEqualsIssue">
> <Element>another</Element>
> </Type>
> doc1 valueEquals doc2 = true
> doc2 valueEquals doc1 = true
> doc1 valueEquals doc3 = true
> doc3 valueEquals doc1 = true
> {noformat}
> Obviously, those two XMLs are not equal.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]