GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow arbitrary attributes on DOM elements in generated XSD by slachiewicz · Pull Request #574 · codehaus-plexus/modello

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Aug 8, 2026

Copy link
Copy Markdown
Member

Reworked version of #483, which fixes #482.

A DOM field maps to an element carrying free-form XML, so DOM merge hints may appear on it:

<configuration combine.self="override">
  <goalPrefix combine.self="override"/>
</configuration>

The generated xs:complexType declared no attributes, so this failed schema validation even though Maven accepts it. Nested elements were already covered by the existing xs:any processContents="skip"; only the element itself was missing an attribute wildcard.

Changes

  • XsdGenerator emits <xs:anyAttribute processContents="skip"/> for DOM fields.
  • writePropertiesElement is shared by DOM and java.util.Properties fields, so it now takes a flag. A Properties container element never carries attributes, so it keeps the stricter schema and typos there are still reported.
  • New DomXsdGeneratorTest, following FeaturesXsdGeneratorTest: it generates the schema, validates a document using combine.self on the DOM element, and asserts that the same attribute on a Properties element is still rejected. The test fails without the generator change.

Differences from #483

  • Rebased onto current master — that PR predates the test migration in chore: migrate junit 3 test to junit4 #523 and no longer compiles (lookup(ModelloCore.ROLE), no @Test/@PlexusTest).
  • The wildcard is restricted to DOM; add <xs:anyAttribute processContents="skip"/> to DOM type's complexType generated (in xsd generation) #483 also loosened Properties.
  • Assertions added; add <xs:anyAttribute processContents="skip"/> to DOM type's complexType generated (in xsd generation) #483 only checked that generation did not throw.
  • The 3328-line copy of Apache Maven's maven.mdo is replaced by a 42-line dom.mdo, and the test gets its own output directory instead of sharing target/generator-results/xsd with XsdGeneratorTest.

Credit to @XenoAmess for the diagnosis and the original patch.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slachiewicz @XenoAmess
Allow arbitrary attributes on DOM elements in generated XSD
5d28905
A DOM field maps to an element that carries free-form XML, so merge
hints such as combine.self and combine.children may appear on it.
The generated schema declared no attributes there, which made a POM
using them fail validation.

Emit <xs:anyAttribute processContents="skip"/> for DOM fields only.
Properties fields share the same writer but their container element
never carries attributes, so they keep the stricter schema.

Fixes #482

Co-authored-by: XenoAmess <[email protected]>
@slachiewicz slachiewicz added the enhancement New feature or request label Aug 8, 2026
@slachiewicz
slachiewicz merged commit 8554215 into master Aug 8, 2026
12 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
slachiewicz deleted the xsd-dom-anyattribute branch August 8, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

need ways to generate both xs:sequence and xs:attribute into a same xs:complexType, for maven

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@slachiewicz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.