some elements with same name but different attributtes

F

Freeter

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!
 
?

=?ISO-8859-1?Q?P=E8re_No=EBl?=

Freeter said:
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!

because i'm running over MacOS X i can't say about XMLSpy, but using the
command line (dtdinst and trang) i get what u want here :

<http://www.yvon-thoraval.com/Some/>

hope this could help ;-)
 
P

Peter Flynn

Freeter said:
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
 
F

Freeter

Thanks, P¨¨re, Peter!
Yes, I think the best way now is to combine all the the attributes into
Property and make them optional.
Thanks again.

"Peter Flynn дµÀ£º
"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,007
Messages
2,570,266
Members
46,865
Latest member
AveryHamme

Latest Threads

Top