OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] W3C Schema substitution-group question

[ Lists Home | Date Index | Thread Index ]

David Byrden <David@Byrden.com> writes:

> I'm using a substitution group of 2 element types. The head element
> and the alternative element are in different namespaces.
> In my XML document, I'm instantiating the alternative element
> where the schema mandates the head should go. If I import the
> 2nd namespace in the schema, everything works.

Which schema?  Here's what I understand you to be describing:

<xs:schema targetNamespace="urn:s:1" xmlns:s1="urn:s:1">
 <xs:complexType name="rootType">
   . . .
   <xs:element ref="s1:head"/>
   . . .

 <xs:element name="head">...</xs:element>

<xs:schema targetNamespace="urn:s:2" xmlns:s1="urn:s:1">
 <xs:import namespace="urn:s:1"/>
 <xs:element name="alt" substitutionGroup="s1:head">...</xs:element>


<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:s1="urn:s:1" xmlns:s2="urn:s:2"
      xsi:schemaLocation="urn:s:1 s1.xsd urn:s:2 s2.xsd"

> But why should I import the 2nd namespace in the schema
> if nothing in the schema refers to it? I want the dependencies to
> be one-way. I'd prefer to get this 2nd namespace with the
> schemaLocation attribute in the document, because the
> document DOES depend on it.

I'm not sure I'm answering your question, but the above is the minimum
necessary, and is schema-valid.

> But when I try to do so, the processor does not even read my
> 2nd namespace's schema as specified in schemaLocation. It
> reads the original schema and tells me I have invalid content.

> It seems as if the processor wants all schemas referenced
> by schemaLocation to be complete in and of themselves, ignoring
> possible inheritance across them. Maybe this is the correct behaviour,
> but I don't know.
> I'm using Java and JWSDP1.0_01

What processor is that?  Please unpack the acronym.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS