Hi,
I am using xerces-j 2.9.1 to parse some TEI (text encoding initiative)
xml.
I am using XML catalogs. The XSD are specified in the catalogs. (they
are setup correctly, I've tested it)
The parser can't parse the document because the following error:
Document is not valid.
Error (1408,36) : src-resolve: Cannot resolve the name 'xml:space' to
a(n) 'attribute declaration' component.
Error (1408,36) : s4s-elt-must-match.1: The content of
'att.xmlspace.attribute.xmlspace' must match (annotation?, ((attribute |
attributeGroup)*, anyAttribute?)). A problem was found starting at:
attribute.
Validated in -1 millisec.
The error actually is in the xsd:
Here is where the error happens in the xsd:
<xs:attributeGroup name="att.xmlspace.attribute.xmlspace">
<xs:attribute ref="xml:space"/>
</xs:attributeGroup>
Here is where xml:space is defined (in an imported xml.xsd)
<xs:attribute name="space">
<xs:annotation>
<xs:documentation>signals an intention that white space should be
preserved by applications</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
Here are my code to parse the xml (the xsd are in the catalogs files)
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setAttribute(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
// Create catalog resolver and set a catalog list.
XMLCatalogResolver resolver = new XMLCatalogResolver();
resolver.setPreferPublic(true);
resolver.setCatalogList(catalogs);
factory.setAttribute(
"http://apache.org/xml/properties/internal/entity-resolver",
resolver);
DocumentBuilder builder = factory.newDocumentBuilder();
ValidationReport report = new ValidationReport();
builder.setErrorHandler(report);
builder.setEntityResolver(resolver);
builder.parse(xmlFile);
return report;
I can't see what exactly is wrong with the xsd. Could someone help me
out?
Thanks!
Dazhi
--
Jiao, Dazhi <[email protected]>
Indiana University
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]