Freeter wrote:
Quote:
Hi,
I have an xml snippet like this:
<ALabel name="ALabel1">
<property vname="Location" x="388" y="384" z="223"/>
<property vname="Label">
<parameter vname="label">
<String value="ALabel1"/>
</parameter>
</property>
</ALabel>
<APanel name="APanel1">
<property height="440" vname="Size" width="456"/>
<property vname="Location" x="712" y="220"/>
<AImageSizedButton name="AImageSizedButton1">
<property vname="Location" x="80" y="270"/>
</AImageSizedButton>
</APanel>
If i define multi-property elements, the XMLSpy will give an error:
"They must be defined with same name without dirivations!"
How to define the schema for it? Thanks!
|
Just make the relevant attributes optional.
For example, all your property elements have a vname attribute, so I'm
guessing that's probably compulsory. But x, y, and z don't always
appear, so they must be optional; same for height and width.
If specific combinations of attributes have to be compulsory, then they
don't really describe the same thing (a "property") and should be
encoded as a different element type, named separately with its own set
of attributes. Get the data model right to start with, rather than
trying to shoe-horn disparate objects into boxes made to fit something else.
///Peter
--
XML FAQ:
http://xml.silmaril.ie/