准备Fork AIXM 4.5 XSD,Eclipse验证出现attributeGroup无效错误求助
Great question—this discrepancy between validators is super common when dealing with complex industry schemas like AIXM. Let’s break down the most likely reasons and how to fix them:
1. Outdated Xerces Implementation in Eclipse
Eclipse bundles its own version of Xerces (the Apache XML parser), which is often older than the versions used by online validators or xmllint. AIXM 4.5 uses XSD 1.0, but older Xerces builds have known bugs with certain schema constructs—especially around attribute group references and namespace handling.
How to check/fix:
- Confirm the Xerces version in Eclipse: Go to
Help > About Eclipse > Installation Details > Plug-ins, then search for "Xerces". Note the version number (e.g., Xerces-J 2.12.x is more modern than 2.11.x). - If it’s outdated, update Eclipse to the latest release—newer versions usually include updated Xerces builds. Alternatively, manually replace the Xerces JARs in your Eclipse installation’s
pluginsdirectory with the latest stable version from Apache (exercise caution here, as it might break other Eclipse features).
2. Namespace Resolution or Schema Catalog Misconfiguration
AIXM schemas rely heavily on imports and includes of other dependent XSD files. While online tools and xmllint might automatically resolve these references via the web or local filesystem, Eclipse’s validator requires explicit configuration in its schema catalog to resolve them correctly. If the referenced attribute group is defined in another schema that Eclipse can’t find, it will throw a false invalidity error.
How to fix:
- Download all dependent AIXM 4.5 schema files (not just
AIXM-Features.xsd) and store them in a local directory. - In Eclipse, go to
Window > Preferences > XML > XML Catalog. Add a new entry for each schema, mapping the target namespace (e.g.,http://www.aixm.aero/schema/4.5) to the local file path. This ensures Eclipse can resolve all attribute group references correctly.
3. Xerces-Specific Edge Case Handling
Even within XSD 1.0, some valid constructs are interpreted differently by Xerces compared to other validators. For example, if the attributeGroup is nested inside a complexType’s sequence or choice (though technically allowed by the spec), older Xerces versions might flag this as invalid.
How to debug:
- Look at the exact line in
AIXM-Features.xsdwhere the error occurs. Check if theattributeGroupis used in a non-standard context (e.g., inside a group that’s already containing elements). - Validate the schema using the latest standalone Xerces JAR via the command line. If it passes, you know the issue is with Eclipse’s bundled version.
Quick Test to Confirm
To rule out validator-specific issues:
- Save a copy of
AIXM-Features.xsdand all its dependencies locally. - Run
xmllint --noout --schema AIXM-Features.xsd AIXM-Features.xsd(this validates the schema against itself). - If that passes but Eclipse still errors, the problem is almost certainly with Eclipse’s Xerces version or catalog configuration.
内容的提问来源于stack exchange,提问作者svoop

