Can't you just override the nameSpaceSchemaLocation by doing this in  your parser:

   parser.setProperty( "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", "exampleSchema.xsd" );

where the exampleSchema.xsd is your schema file.

-ramin





"Adam Rabung" <[EMAIL PROTECTED]>

10/18/2004 12:19 PM

Please respond to
[EMAIL PROTECTED]

To
[EMAIL PROTECTED]
cc
Subject
xml attributes





I have a question about validating against a schema which uses elements from the default xml namespace,
http://www.w3.org/XML/1998/namespace.  Using these attributes (base, space, and lang) require a schema import, like so:
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd" />.

It seems that passing a custom xsd into schemaLocation is illegal:
The prefix "xml" cannot be bound to any namespace other than its usual namespace; neither can the namespace for "xml" be bound to
any prefix other than "xml".

However, not using the schemaLocation at all will result in errors like these:
src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.

What is the default value of schemaLocation?  If it is only allowed to be set to one value legally
(http://www.w3.org/2001/03/xml.xsd), would it be possible to have it default to that?  Is there any way to configure the parser to
allow for custom xml schemas?

This is closely related to the problem reported here:
http://issues.apache.org/eyebrowse/ReadMsg?listId=85&msgNo=4072

And may be related to:
http://nagoya.apache.org/jira/browse/XERCESJ-1002

I'm using Xerces-J 2.6.2.

Example schema:
<?xml version="1.0"?>
<xsd:schema xmlns="http://example.com"
targetNamespace="http://example.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
elementFormDefault="unqualified">
<!-- Leaving off schemaLocation, or setting it to anything besides http://www.w3.org/2001/03/xml.xsd will result in an error. -->
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
<xsd:attributeGroup name="attr.base">
<xsd:attribute ref="xml:base" use="optional"/>
</xsd:attributeGroup>
<xsd:element name="father" type="fatherType"/>
<xsd:element name="child" type="childType"/>
<xsd:complexType name="fatherType">
<xsd:sequence>
<xsd:element ref="child"/>
</xsd:sequence>
<xsd:attribute ref="xml:base"/>
</xsd:complexType>
<xsd:complexType name="childType">
<xsd:attributeGroup ref="attr.base"/>
</xsd:complexType>
</xsd:schema>

Thank you,
Adam Rabung


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to