Hi Ben, "Leis, Benjamin" <benl...@amazon.com> wrote on 11/18/2010 08:24:05 PM:
> I?m pretty new to xsd and am running into some issues when trying to > use Xinclude in my schema (with Xerces). > > 1) All the sample documentation seemed to imply that you could > import xinclude as follows: > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xi="http://www.w3.org/2001/XInclude" > > > <xs:import namespace="http://www.w3.org/2001/XInclude" > schemaLocation=?xinclude.xsd"/> > > However I could only get this to work with a full URL: > > i.e. schemaLocation=?http://www.w3.org/2001/xinclude.xsd? > > Does everyone else have xinclude.xsd downloaded somewhere local? You haven't shown any of your source code but would guess that the challenge you're having with schema loading would be due to a missing base URI, which your application must provide in order for the schema loader to be able to resolve a relative URIs such as "xinclude.xsd". > 2) When I actually go to include references to an inclusion in > my xml file I?m hitting the following error: > > cvc-complex-type.2.4.a: Invalid content was found starting with > element 'xi:include'. One of '{"http://www.w3.org/2001/XInclude > ":include, GlobalConfiguration, TestTemplate, TestGroup}' is expected. Did you enable namespace awareness on the parser instance you tried this with? > Xsd: > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xi="http://www.w3.org/2001/XInclude" > > > <xs:import namespace="http://www.w3.org/2001/XInclude" > schemaLocation="http://www.w3.org/2001/xinclude.xsd"/> > > <xs:element name="Gauntlet"> > > <xs:complexType> > <xs:sequence> > <xs:choice maxOccurs="unbounded"> > <xs:element ref="xi:include" minOccurs="0" /> > <xs:element ref="GlobalConfiguration" maxOccurs="1" /> > <xs:element ref="TestTemplate" minOccurs="0" > maxOccurs="unbounded" /> > <xs:element ref="TestGroup" maxOccurs="unbounded" /> > </xs:choice> > </xs:sequence> > > </xs:complexType> > > > XML: > > <?xml version="1.0" encoding="UTF-8"?> > <Gauntlet xmlns:xi="http://www.w3.org/2001/XInclude"> > <xi:include href="fragment.xml" /> > > Thanks for any help, > Ben Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org