Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - DTD / XML schema question [Thread Next] Re: DTD / XML schema questionTo: NULL Date: 4/2/2006 7:38:00 PM kurtrips@g... wrote: > What I want to achieve: > <ARTICLE type="CoverStory">ABCD</ARTICLE> > <ARTICLE type="Sports">XYZ</ARTICLE> > > ==> There should be one and only one ARTICLE element which has > "CoverStory" as the value of its "type" attribute. > > How do I do this using DTD or XML-schema? With a DTD you could define an attribute of type ID, but that way that attribute value (e.g. CoverStory) must be unique for all attributes of type ID in the document. With a W3C XSD schema you could define an xs:unique constraints for that ARCTICLE element with the attribute type. > Can I do this if "type" is made a child-node of ARTICLE rather than an > attribute. Not with a DTD but the schema ways works with a child node too. -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
