![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: some elements with same name but different attributtes [Thread Next] Re: some elements with same name but different attributtesTo: NULL Date: 1/2/2007 11:39:00 PM Thanks, P=A8=A8re, 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 =D0=B4=B5=C0=A3=BA " > Freeter wrote: > > Hi, > > I have an xml snippet like this: > > <ALabel name=3D"ALabel1"> > > <property vname=3D"Location" x=3D"388" y=3D"384" z=3D"2= 23"/> > > <property vname=3D"Label"> > > <parameter vname=3D"label"> > > <String value=3D"ALabel1"/> > > </parameter> > > </property> > > </ALabel> > > <APanel name=3D"APanel1"> > > <property height=3D"440" vname=3D"Size" width=3D"456"/> > > <property vname=3D"Location" x=3D"712" y=3D"220"/> > > <AImageSizedButton name=3D"AImageSizedButton1"> > > <property vname=3D"Location" x=3D"80" y=3D"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 el= se. >=20 > ///Peter > --=20 > XML FAQ: http://xml.silmaril.ie/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
