[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML element names (was: Ten Years Later - XML 1.0 Fifth Edition?)

  • From: Nicholas Sushkin <nsushkin@o...>
  • To: xml-dev@l...
  • Date: Mon, 18 Feb 2008 12:33:25 -0500

XML element names (was: Ten Years Later - XML 1.0 Fifth Edition?)
On Monday 18 February 2008 11:09, Mukul Gandhi wrote: 

> Some of the directory/file names didn't conform to the XML name
> conventions. Like, some directory names started with numeric. Some
> contained characters like - (hyphen), ~ etc.
>
> Would somebody agree with me, that XML names should allow such rules?
> My problem could serve as a use case ...

Mikul,

I think the rule of thumb in developing your XML schema is to name elements 
after your object types and represent object properties as element content, 
either attributes or elements. So, most people would design xml as
<dir name="..."/> and <file name="..."/>. Imagine flikr or picasaweb XML, 
they'll go for <album title="..."/> and <picture caption="..."/>. This way 
they can preserve user chosen title and caption.

If you design your XML as dir/@name and file/@name, it would make your XPath 
queries look natural, making it easier to search your XML and write an 
stylesheet for HTML rendering. For example, to find directories with 
pictures, you would use XPath "dir[contains(file/@name, '.jpg')]"
or convert a file to a table row, you would write the following template:

<xsl:template match="file">
  <tr><td><xsl:value-of select="@name"/></td></tr>
</xsl:template>

-- 
Nicholas Sushkin, Senior Software Engineer
http://www.openfinance.com http://www.wealthinformationexchange.com

smime.p7s



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.