Skip to content

ID attribute fix#1

Merged
christianbpedersen merged 2 commits intomasterfrom
tag-id-attributes
Oct 2, 2013
Merged

ID attribute fix#1
christianbpedersen merged 2 commits intomasterfrom
tag-id-attributes

Conversation

@raosev
Copy link
Copy Markdown
Contributor

@raosev raosev commented Aug 16, 2013

Currently, the XML schema defines an "ID" type just like "string" or "integer" that should be used when declaring an ID attribute within a node in xml... that's right, naming an attribute "ID" is not enough anymore.

The xml parser from previous java versions (earlier than 7u25) was very flexible about this constraint and did not require the ID type on "ID" attributes, but this is not the case with the newest java version.

With this fix, the isValid() method will traverse the xml document searching for attributes called "ID" and tag them as valid ID xml type, this will avoid an exception during the xmlSignature.validate(ctx) call.

NOTE. This will only happen if the Element.setIdAttribute method exists, which is the method that actually tags an ID attribute as a valid ID xml type. It exists since jdk 1.6 . The method won't be called on jdk 1.5 or previous versions but should not be a problem since the parser of those versions is more flexible.

I tested this fix successfully within jdk_6_u30 and jdk_7_u25

christianbpedersen pushed a commit that referenced this pull request Oct 2, 2013
@christianbpedersen christianbpedersen merged commit 7198720 into master Oct 2, 2013
@christianbpedersen christianbpedersen deleted the tag-id-attributes branch October 2, 2013 00:31
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