You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "PJ Fanning (Jira)" <ji...@apache.org> on 2026/09/23 19:15:00 UTC

[jira] [Resolved] (XMLBEANS-658) valueEquals always returns true

     [ https://issues.apache.org/jira/browse/XMLBEANS-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

PJ Fanning resolved XMLBEANS-658.
---------------------------------
    Resolution: Fixed

> 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
>             Fix For: 5.5.0
>
>
> 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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org