Schema Reuse

In the Complex XPath example I just posted, I built a Books schema, which includes a “record” which then points to a second schema called “Book”.

We do this all the time at my various clients.

I decided to take some quick screen shots and show how it works here:

First, build the schema to be included (book.xsd):

Then, build the schema that uses it (books.xsd):

After adding the “Books” element to the “Books.xsd” schema, I clicked the word <Schema> above the root element. From there, I went to the properties window, and clicked the … on Imports. Then leaving the “Import New Schema as” value to the default of “XSD Import”, I cliked the “Add” button, and picked the “book.xsd” schema from the selection list. After that, I overtyped the default prefix value of “ns0” to “bk”.

When this schema was built, I added a “child record” under books. Then, click the properties for that “record” and changed the “Data Structure:

To see the resulting XML and a lesson on Complex XPath,
see this page on Complex XPath.


Leave a Reply