pjfanning opened a new pull request, #168:
URL: https://github.com/apache/poi-xmlbeans/pull/168

   Follow-up to #167, which fixed the complete attribute wildcard (XML Schema 
1.0 3.4.2) for plain complex types and extensions but left restrictions as they 
were.
   
   **Restriction bug.** At the end of `translateAttributeModel`, a restriction 
with no `anyAttribute` resets the inherited wildcard. That reset also ran at 
the end of each attribute group's recursive call, and for the type itself when 
the wildcard came only from groups. So
   ```xml
   <xs:restriction base="t:any"><xs:attributeGroup ref="t:ab"/></xs:restriction>
   ```
   ended up with no attribute wildcard at all, and `urn:a`/`urn:b` attributes 
were rejected. Each wildcard was also checked against the base type's wildcard 
on its own. A group wildcard wider than the base therefore failed 
`derivation-ok-restriction.4.2`, even when the combined wildcard was a subset.
   
   **Fix.** Restrictions now build the complete wildcard the same way 
extensions do. The type's own `anyAttribute` and its attribute group wildcards 
are intersected, and `derivation-ok-restriction.4.1`/`4.2` are checked once, 
against the complete wildcard. `processContents` comes from the type's own 
`anyAttribute`, or else from the first attribute group wildcard, which matches 
Xerces. The top-level call versus a group's recursive call is now an explicit 
private overload, instead of #167's `seenAttributes == null` check.
   
   **Opt-out.** `XmlOptions.setCompileLegacyAttributeWildcards()` (compile 
time, `@since 6.0.0`) restores the pre-6.0.0 handling. That covers both the 
union of a type's own wildcards that #167 replaced and the old restriction 
behaviour. The attribute model is stored in the compiled type system, so 
precompiled `.xsb` jars keep their wildcards either way.
   
   `AttributeWildcardRestrictionTest` covers:
   - a restriction whose wildcard comes only from a group;
   - a group intersected with a local wildcard;
   - where `processContents` comes from;
   - the subset check on the complete wildcard;
   - the 4.1 and 4.2 errors;
   - the legacy option.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to