Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Deciding XML structure [Thread Next] Re: Deciding XML structureTo: NULL Date: 8/5/2007 5:12:00 PM Martin Honnen wrote: > Mark wrote: >> Basic question (I think); when is it best to use one element with >> attributes vs. one without and child elements? For example: >> <book title="Some Book" author="Anderson, Jones"></book> >> versus: >> >> <book> >> <title>Some Book</title> >> <author>Anderson</author> >> <author>Jones</author> >> </book> >> >> Is there a rule or best practice? > > If you have several values like for the authors then I stronly suggest > to choose child elements as that way when the XML is parsed you get > access to each author while the attribute only gives you one attribute > value "Anderson, Jones" and XML parsers/tools (DOM, XSLT/XPath 1.0) will > not assist you in accessing items in that value. A good point, especially given the lack of support for separately accessing the values of an ENTITIES attribute in XSLT/XPath, something which the publishing industry had been hoping 2.0 would pay attention to. ///Peter | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
