![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Deciding XML structure >Thread Next - Re: Deciding XML structure Re: Deciding XML structureTo: NULL Date: 8/5/2007 2:29:00 PM 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. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
