Skip to content

stop at the first matching union member in XmlUnionImpl.set_text - #173

Open
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:union-enum-first-member
Open

aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:union-enum-first-member

Conversation

@aizu-m

@aizu-m aizu-m commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

XmlUnionImpl.set_text moves on to the next member type when a member accepts the lexical value but that value is not enumerated, so with memberTypes='xs:int xs:boolean' and <xs:enumeration value='true'/> the instance value '1' is reinterpreted as the boolean true and passes XmlObject.validate() and ValidatingXMLStreamReader where Xerces reports cvc-enumeration-valid (found by a differential run against the JDK Xerces validator); the first member that accepts the lexical form now decides the value, as Datatypes 2.5.1.3 requires.

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two non-blocking notes:

  • This is a visible behaviour change outside validation too: setStringValue("1") on such a union now throws XmlValueOutOfRangeException where it used to silently become the boolean true. I think that is correct, but it deserves a line in the release notes.
  • The PR description is a single long sentence; splitting it up would make the commit message easier to read later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants