You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Graham Mann <gm...@Adobe.COM> on 2000/08/25 19:39:13 UTC

Multiple SchemaLocation attribute

Hi,

I'm using Xerces-J 1.1.3 and using the SAX2Count example to check out schema validation.

I'm attempting to create a schema that allows for the inclusion of other schema definitions using:
...
<xsd:group name="Extendable_Group">
		<xsd:element name="MemberONE" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element name="MemberTWO" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:any namespace="##any" processContents="strict" minOccurs="0"/>
</xsd:group>
<xsd:element name="RootElement">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Extendable_Pool">
					<xsd:complexType>
						<xsd:group ref="jdf:Extendable_Group"/>
					</xsd:complexType>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
</xsd:element>


And then using this in a instance like:

<?xml version="1.0" encoding="UTF-8"?>
<RootElement xmlns="http://www.example.com/Base" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/Base http://www.example.com/Base.xsd">
	<Extendable_Pool>
		<MemberONE/>
		<ANewMember xmlns="http://www.example.com/Extension"/>
	</Extendable_Pool>
</RootElement>

Here from say SAX2Count I get the following:
c =118
c =115
http://www.example.com/Extension grammar not found
[Error] example3.xml:10:60: Element type "ANewMember" must be declared.
file:///d:\xmlstuff\schemas\extentions\example3.xml: 3859 ms (7 elems, 1 attrs, 21 spaces, 0 chars)

Which is OK: it cant find the grammar. (Although the examples I've seen imply this is complete should the processContents attribute be set to skip (which is currently unavailable in this release according to the Xerces parser messages)).

If I try to tell the instance about the extra grammar by adding to xsi:schemaLocation such as
xsi:schemaLocation="http://www.example.com/Base http://www.example.com/Base.xsd http://www.example.com/Extension http://www.example.com/Extension.xsd">

Then I get 
c =118
c =115
[Fatal Error] :0:0: File "" not found.
org.xml.sax.SAXParseException: File "" not found etc etc

Is this a bug or a misunderstanding? Either way I'd appreciate some help.

Regards,
Graham Mann
Adobe Systems Europe Ltd.
Tel:    +44 (0)1603 226749



RE: Multiple SchemaLocation attribute

Posted by rsanford <rs...@nolimitsystems.com>.
> It appears that resolveSchemaGrammar is being called three times 
> - twice with the correct values, lastly with a null value for the 
> file name (with what looks like a count value at the end of the 
> input string)
> 
> I'll try to dig around more later - hope this helps.

do any of your schema documents specify a DOCTYPE attribute? if
a schema is specifying a doctype attribute xerces will attempt to
locate the schema for that doctype even if none exists. this will
result in your schema not being parsed. the solution is to remove
the doctype declaration from inside of your schema.

rjsjr

aka - he who spent many hours learning this very painful lesson


Re: Multiple SchemaLocation attribute

Posted by Graham Mann <gm...@Adobe.COM>.
Eric,

Thanks for the reply.

At Monday 15:01 28/08/00 -0700, you wrote:
>Try the latest source in the CVS.
I'll try ASAP - but...

>Also make sure all the .xsd files are accessible to the parser, cause I
>noticed your xsd files seem to sit on a web server.
Yeah - that's because I made up the examples (for simplification!) I'm actually using a simple local model.

I've done a bit more digging around.
The SchemaLocation pairs are being successfully put into a hash table.

It appears that resolveSchemaGrammar is being called three times - twice with the correct values, lastly with a null value for the file name (with what looks like a count value at the end of the input string)

I'll try to dig around more later - hope this helps.


Regards,
Graham Mann
Adobe Systems Europe Ltd.
Tel:    +44 (0)1603 226749



Re: Multiple SchemaLocation attribute

Posted by Eric Ye <er...@locus.apache.org>.
Try the latest source in the CVS.
Also make sure all the .xsd files are accessible to the parser, cause I
noticed your xsd files seem to sit on a web server.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Graham Mann" <gm...@Adobe.COM>
To: <xe...@xml.apache.org>
Cc: <ms...@Adobe.COM>
Sent: Friday, August 25, 2000 10:39 AM
Subject: Multiple SchemaLocation attribute


> Hi,
>
> I'm using Xerces-J 1.1.3 and using the SAX2Count example to check out
schema validation.
>
> I'm attempting to create a schema that allows for the inclusion of other
schema definitions using:
> ...
> <xsd:group name="Extendable_Group">
> <xsd:element name="MemberONE" minOccurs="0" maxOccurs="unbounded"/>
> <xsd:element name="MemberTWO" minOccurs="0" maxOccurs="unbounded"/>
> <xsd:any namespace="##any" processContents="strict" minOccurs="0"/>
> </xsd:group>
> <xsd:element name="RootElement">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Extendable_Pool">
> <xsd:complexType>
> <xsd:group ref="jdf:Extendable_Group"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
>
> And then using this in a instance like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <RootElement xmlns="http://www.example.com/Base"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com/Base
http://www.example.com/Base.xsd">
> <Extendable_Pool>
> <MemberONE/>
> <ANewMember xmlns="http://www.example.com/Extension"/>
> </Extendable_Pool>
> </RootElement>
>
> Here from say SAX2Count I get the following:
> c =118
> c =115
> http://www.example.com/Extension grammar not found
> [Error] example3.xml:10:60: Element type "ANewMember" must be declared.
> file:///d:\xmlstuff\schemas\extentions\example3.xml: 3859 ms (7 elems, 1
attrs, 21 spaces, 0 chars)
>
> Which is OK: it cant find the grammar. (Although the examples I've seen
imply this is complete should the processContents attribute be set to skip
(which is currently unavailable in this release according to the Xerces
parser messages)).
>
> If I try to tell the instance about the extra grammar by adding to
xsi:schemaLocation such as
> xsi:schemaLocation="http://www.example.com/Base
http://www.example.com/Base.xsd http://www.example.com/Extension
http://www.example.com/Extension.xsd">
>
> Then I get
> c =118
> c =115
> [Fatal Error] :0:0: File "" not found.
> org.xml.sax.SAXParseException: File "" not found etc etc
>
> Is this a bug or a misunderstanding? Either way I'd appreciate some help.
>
> Regards,
> Graham Mann
> Adobe Systems Europe Ltd.
> Tel:    +44 (0)1603 226749
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>