You can define namespaces for base and extension schemas and then set
parser property XMLUni::fgXercesSchemaExternalSchemaLocation accordingly
("base_schema_ns base_schema.xsd extension_schema_ns ext_schema.xsd")
Good luck!
Vitaly
VitaminSmooth wrote:
I have two schemas: a base schema that is extensible through an 'any'
element, and an extension schema that defines the element I expect to find
there for a certain project.
base schema fragment:
<xsd:complexType name="custom">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:any namespace="##any" processContents="lax"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element ref="custom"/>
extension schema fragment:
<xsd:element name="somethingnew">
...
</xsd:element>
instance fragment:
<custom>
<somethingnew>
...
</somethingnew>
</custom>
Using Xerces-C, I can validate the file using the base schema, which will
accept any well-formed xml in place of the 'any' element. My question is
how do I validate the 'somethingnew' element using the separate extension
schema? I could modify a copy of the base schema to include the extension
element, but I'd like to be able to use the two files in their unmodified
forms, as they are standard documents. Can I somehow load both schemas into
a grammar pool and validate the whole instance?
I'd really appreciate any help. Thanks for sharing your knowledge!