C
Christine McGavran
To continue a previous thread, sort of...
I have defined a schema for describing a windows-style user interface. My
application correctly parses and uses that schema. I'm now trying to get
that schema to be legal, so that if I threw my UI.xml and UISchema.xml at a
validator it would succeed.
I have just learned that the order of elements is important, that is if you
define a schema with element a followed by element b, then in the xml they
must also be in that order. That turns out to be very inconvenient for me,
as the order is important for my UI system. I'm curious why this order is
seen as an important thing, and again looking for suggestions on how to do
things more legally in my situation.
A rough example:
<complexType name="Window">
<sequence>
<element name="align" type="ui:Align" minOccurs="0" maxOccurs="1"
/>
<element name="size" type=ui:Size" minOccurs="0" maxOccurs="1" />
<element name="children" minOccurs="0" maxOccurs="1">
<complexType>
<sequence>
<element name="redWindow" type="ui:Window"
minOccurs="0" maxOccurs="unbounded" />
<element name="blueWindow" type="ui:Window"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="window" type="ui:Window" />
I would like my xml to be able to create a window with children windows from
left to right being red blue red. For example:
<window>
<size x="30" y="10" />
<children>
<redWindow>
<align left="parentLeft" top="parentTop" bottom="parentBottom"
/>
<size x="10" />
</redWindow>
<blueWindow>
<align left="prevRight" top="parentTop" bottom="parentBottom" />
<size x="10" />
</blueWindow>
<redWindow>
<align left="prevRight" top="parentTop" bottom="parentBottom" />
<size x="10" />
</redWindow>
</children>
</window>
This xml will not validate because redWindow is not allowed to follow
blueWindow. My application, however, parses and uses this xml just fine. You
might be able to think of a few ways around this simple case, but when the
window contents get complex, being able to enforce order becomes very handy.
The only other alternative I can think of is to put some GUID on each window
to use for ID in alignment, which seems like a pain for the user.
Thanks in advance,
Christine
I have defined a schema for describing a windows-style user interface. My
application correctly parses and uses that schema. I'm now trying to get
that schema to be legal, so that if I threw my UI.xml and UISchema.xml at a
validator it would succeed.
I have just learned that the order of elements is important, that is if you
define a schema with element a followed by element b, then in the xml they
must also be in that order. That turns out to be very inconvenient for me,
as the order is important for my UI system. I'm curious why this order is
seen as an important thing, and again looking for suggestions on how to do
things more legally in my situation.
A rough example:
<complexType name="Window">
<sequence>
<element name="align" type="ui:Align" minOccurs="0" maxOccurs="1"
/>
<element name="size" type=ui:Size" minOccurs="0" maxOccurs="1" />
<element name="children" minOccurs="0" maxOccurs="1">
<complexType>
<sequence>
<element name="redWindow" type="ui:Window"
minOccurs="0" maxOccurs="unbounded" />
<element name="blueWindow" type="ui:Window"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="window" type="ui:Window" />
I would like my xml to be able to create a window with children windows from
left to right being red blue red. For example:
<window>
<size x="30" y="10" />
<children>
<redWindow>
<align left="parentLeft" top="parentTop" bottom="parentBottom"
/>
<size x="10" />
</redWindow>
<blueWindow>
<align left="prevRight" top="parentTop" bottom="parentBottom" />
<size x="10" />
</blueWindow>
<redWindow>
<align left="prevRight" top="parentTop" bottom="parentBottom" />
<size x="10" />
</redWindow>
</children>
</window>
This xml will not validate because redWindow is not allowed to follow
blueWindow. My application, however, parses and uses this xml just fine. You
might be able to think of a few ways around this simple case, but when the
window contents get complex, being able to enforce order becomes very handy.
The only other alternative I can think of is to put some GUID on each window
to use for ID in alignment, which seems like a pain for the user.
Thanks in advance,
Christine