Using schema to validate xml file segment

Discussion in 'XML' started by Aaron P Frenger, Nov 4, 2004.

  1. 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++

    My idea is to have one schema specified in the main file. At some
    point 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 would
    then want to use the schema specified in the main file to validate it.
    Is there a way to move to a specific section of the schema file
    specified in the main file and use that section to validate another
    xml file?

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs=""
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="EXAMPLE">
    <xs:element name="EXTERNAL_FILE_NAME"/>
    <xs:element name="TEST_DATA">
    <xs:element name="TEST1"/>
    <xs:element name="TEST2"/>

    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.

    Aaron ()
    Aaron P Frenger, Nov 4, 2004
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page