By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

Validating a portion of an XML file via a full schema

P: n/a
Hello All,

I have a very large XML file that I would like to split up into a few
smaller files, but still use only one schema. I am using Xerces C++
libraries.

My idea is to have one schema specified in the main file. At certain
points in the schema I would add a choice element that would either
have a tag that specifies an external file or a tree of tags. Once
the main xml file is loaded I would search for any instances where the
external file tag was populated and load that external file. I want
to use the schema specified in the main file to validate it. Is
there any way to move to a specific section of the schema file and
validate another xml file from that point? The external files would
not have any schema associated with them.

Example:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="EXAMPLE">
<xs:complexType>
<xs:choice>
<xs:element name="EXTERNAL_FILE_NAME"/>
<xs:element name="TEST_DATA">
<xs:complexType>
<xs:all>
<xs:element name="TEST1"/>
<xs:element name="TEST2"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

In this case if EXTERNAL_FILE_NAME was populated I would read in that
file and validate it against the schema using the sub tree starting at
<xs:element name="TEST_DATA">.

Any suggestions would be appreciated,
Thanks
Aaron

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.