Data
Model
----------------------------------------
We have a abstract data model
defined as a tree of objects.
- there are
fixed number of primitive object types such as bool, int, or
str
- any object
can contain any other
objects
- sometimes
this tree structure is predefined
- other times
this tree structure is highly dynamic
Problem
Statement
----------------------------------------
Ideally we would like to create a simple XML syntax for this
data model where:
- a small
simple XML Schema can describe any tree of objects
- larger XML
Schemas which could be used to describe predefined trees of objects
so that standard tools could be used to generate code
stubs, etc
- but either
of the above the Schemas would provide a unified XML syntax
- this XML will be used for REST and in
SOAP/WSDL web services
Current
Syntax
----------------------------------------
Our current schema produces XML which looks like
this:
<obj
name="WeatherReport">
<real name="temperature" val="75.0"
units="fahrenheit"/>
<real name="humidity" val="53" units="percent"/>
<bool name="sundown" val="true"/>
</obj>
This is a nice
simple schema where the content is completely self defining. However it
doesn't play
real nice with
XML Schema tools since if you want a "getTemperature()" method, "temperature"
really needs to be
the element name.
Ideal
Syntax
----------------------------------------
That leads to us to syntax which looks something like
this:
<obj
name="WeatherReport">
<temperature real="75.0" units="fahrenheit"/>
<humidity real="53" units="percent"/>
<sundown bool="true"/>
</obj>
But we have have
great trouble arriving at a XML Schema design that would let us solve our
problem
statement - we know
ahead of time that WeatherReport has a temperature, but we don't know about
humidity and
sundown (however we do know they all
conform to a limited number of object types).
Is this
possible? What is the preferred design which plays well with XML Schema tools?
Brian