[
https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433913#comment-13433913
]
Radu Coravu commented on XERCESJ-1577:
--------------------------------------
Hi,
The validation does not work on the code which exists on the branch:
https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev
The code I used is like this:
File xsdFile = new File("C:/Users/radu_coravu/Desktop/xsdProblem/main.xsd");
StreamSource[] schemaDocuments = new StreamSource[] {new
StreamSource(xsdFile)};
XMLSchema11Factory sf = new XMLSchema11Factory();
try {
sf.setFeature(Constants.XERCES_FEATURE_PREFIX +
Constants.SCHEMA_FULL_CHECKING, true);
Schema s = sf.newSchema(schemaDocuments);
} catch (SAXNotRecognizedException e1) {
e1.printStackTrace();
} catch (SAXNotSupportedException e1) {
e1.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
And the received exception is this one:
org.xml.sax.SAXParseException: src-resolve.4.1: Error resolving component
'p.trans'. It was detected that 'p.trans' has no namespace, but components with
no target namespace are not referenceable from schema document
'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is
intended to have a namespace, perhaps a prefix needs to be provided. If it is
intended that 'p.trans' has no namespace, then an 'import' without a
"namespace" attribute should be added to
'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at
org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4446)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4441)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1874)
at
org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:349)
at
org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:241)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1621)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:724)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
at
org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
at jaxp.InlineSchemaValidator.main(InlineSchemaValidator.java:367)
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
> Key: XERCESJ-1577
> URL: https://issues.apache.org/jira/browse/XERCESJ-1577
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.0 Structures
> Affects Versions: 2.11.0
> Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta
> release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <xs:element name="elem" substitutionGroup="p.trans"/>
> <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
> <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema)
> reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that
> 'p.trans' has no namespace, but components with no target namespace are not
> referenceable from schema document
> 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is
> intended to have a namespace, perhaps a prefix needs to be provided. If it is
> intended that 'p.trans' has no namespace, then an 'import' without a
> "namespace" attribute should be added to
> 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon
> schema is not properly binded once the schema is included from a schema which
> has a target namespace.
> This worked in Xerces 2.9.1.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]