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

Hierarchical Schema File Organization

P: n/a
Hi, everyone,

I'm designing my first XML-based application and am stuck on an issue that I
presume is pretty simple. I'm trying to write a schema that can be used to
validate my XML file. However, I want to define components of this schema
in different files so that I can do isolated tests on these subsections. As
an example, consider this XML file:

<container>
<name>Me</name>
<object>
...
</object>
</container>

In my program, there is a class for the 'container' type and a class for the
'object' type. I'd like to be able to make a unit test for my 'object' XML
I/O as well as the 'container' XML I/O. However, to do this I need a schema
for both types. Then, to avoid redundancy, I don't want the 'container'
schema to define how the 'object' component will look. I'd prefer to have
the 'container' schema refer to the 'object' schema which will be defined in
another file.

Can this be done? If not, is there a better way to set up unit tests for my
components so that I can verify that they work in isolation before trying to
use the 'object' code in the 'container' code?

Thanks!
Scott

--
Remove .nospam from my e-mail address to mail me.

http://www.e-scott.net
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Scott Brady Drummonds" <sc**********************@intel.com> wrote in
message news:cn**********@news01.intel.com...
Hi, everyone,

I'm designing my first XML-based application and am stuck on an issue that I presume is pretty simple. I'm trying to write a schema that can be used to validate my XML file. However, I want to define components of this schema
in different files so that I can do isolated tests on these subsections. As an example, consider this XML file:


A couple of days later I found a book that had my answer. I'm posting a
synopsis here for posterity.

The key here is the use of the <import> tag in the <schema> section. In the
top-level schema file definition, calling <import> on the file that contains
definitions that are needed and specifying the a namespace prefix for the
namespace, definitions in the other file can be referenced through the
<element> tag's "ref" attribute. Therefore definitions in one XML schema
file can be used in another.

Scott
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.