You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Minh Kama Yie <mi...@nuix.com.au> on 2001/11/27 04:05:27 UTC

Error referencing w3c schema files

Hi List,

I am using xerces 1.4.3 and am trying to parse a XML Schema document I wrote. 

The document is:

<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema 
http://www.w3.org/2001/XMLSchema.xsd"
	    targetNamespace="http://jetty.coxless.com/schema/tmp"
	    xmlns:my-prefix="http://jetty.coxless.com/schema/tmp">


    <xsd:element name="form">
        <xsd:complexType>
	    <xsd:sequence>
		<xsd:element ref="my-prefix:header"/>
            </xsd:sequence>
	</xsd:complexType>
    </xsd:element>
	   
    <xsd:element name="header" id="header">
        <xsd:complexType>
            <xsd:attributeGroup ref="my-prefix:myAttrGroup"/>
	</xsd:complexType>
    </xsd:element>	        

    <xsd:attributeGroup name="myAttrGroup" id="myAttrGroup">
	<xsd:attribute ref="my-prefix:label" use="required"/>
        <xsd:attribute ref="my-prefix:value" use="required"/>
    </xsd:attributeGroup>

    <xsd:attribute name="label" id="label" type="xsd:string"/>

    <xsd:attribute name="value" id="value" type="xsd:string"/>

</xsd:schema>



This document validates fine on http://www.w3.org/2001/03/webdata/xsv

When I parse it with xerces however, I receive mulitple errors. The first 
errors concerns me the most:

MINH: Parsing attribute : xs:attribute
MINH: The refStr is: xml:lang
MINH: The colon is at: 3
MINH: the uriStr is: 
org.xml.sax.SAXParseException: Schema error: prefix : [xml] cannot be 
resolved to a URI.
	at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1204)
	at 
org.apache.xerces.validators.schema.TraverseSchema.reportSchemaError(TraverseSchema.java:8914)
	at 
org.apache.xerces.validators.schema.TraverseSchema.reportGenericSchemaError(TraverseSchema.java:8901)
	at 
org.apache.xerces.validators.schema.TraverseSchema.resolvePrefixToURI(TraverseSchema.java:506)
	at 
org.apache.xerces.validators.schema.TraverseSchema.traverseAttributeDecl(TraverseSchema.java:5881)
	at 
org.apache.xerces.validators.schema.TraverseSchema.traverseAttributeGroupDecl(TraverseSchema.java:6379)
	at 
org.apache.xerces.validators.schema.TraverseSchema.doTraverseSchema(TraverseSchema.java:747)
<snip>
ERROR: at column 60, line 6.


As you may notice, I put in system.out statements in the xerces code prefixed 
by "MINH:" and these statements seem to say the parser has trouble dealing 
with the line in the XMLSchema.xsd file:

<xs:attribute ref="xml:lang" /> 

It seems to say that is can't find the uri referenced by the prefix "xml" but 
this seems illogical since that is straight out of the w3c root Schema 
document.

I was wondering if anyone could tell me what I'm doing wrong here? Am I 
incorrectly referencing the root Schema document (ie. 
http://www.w3.org/2001/XMLSchema) ?

Thanks in advance!

-- 
Regards, 

Minh Kama Yie
Nuix

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org