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

NMTOKENS: good or evil?


use of nmtokens

The IPTC NewsML2 Working Group (www.iptc.org/dev) has tried to avoid NMTOKENS is drafting its specification.

 

The reason is that using a list of space-separated values is not really conformant to “the XML way” (it is à priori sensible to have a sub-element for each enumerated value). And that we don’t know about an easy way to process them using XSLT, XPATH or DOM for example. The problem seems rooted in XML parsers themselves, which usually treat them as strings (and not as collections of tokens) [1].

 

But in fact HTML – so broadly used – defines many NMTOKENS (eg class). HTML processors are everywhere. So it must not be so difficult to process them.

 

We have already adopted in NewsML2 one HTML (& CSS) attribute – media - which specifies the target media type(s) of a label, and is defined as NMTOKENS in HTML.

 

Ex of use:

<title media="handheld screen">Hello world</title>

 

We are more and more ambivalent about NMTOKENS: using attributes to convey collections of values could be interesting in many use cases, making the NewsML2 syntax more compact:

 

For example we could imagine replacing something like:

<subject type=”type:organisation” code=”nasdaq:MFRT”>

            <sameAs code=”isin:23234”/>

            <sameAs code=”sicovam:23234”/>

            <title>The Company</title>

</subject>

 

By

<subject type=”type:organisation” code=”nasdaq:MFRT” altcodes=”isin:23234 sicovam:ERT-345”>The Company</subject>

           

We need the help of the community to get clear ideas about questions like:

-          What are the problems for developers of XML processors when reading NMTOKENS and when editing them?

-          How shall implementers process NMTOKENS ?

o        If they use DOM?

o        If they use XSLT?  

o        If they use XPATH?

 

Laurent Le Meur

IPTC, NewsML2 Architecture WP chair

 

 

 

[1] http://lists.xml.org/archives/xml-dev/199806/msg00509.html  
“One other problem with the above syntax is the use of NMTOKENS for the 
enumeration.  An earlier objection on this list pointed out that most parsers 
today return a string of Nmtoken's, rather than an array, which forces the 
application to parse the string themselves.” (rbourret)

 



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individ ual or entity to whom it is addressed. If you have received this email in error, please contact the sende r and delete the email from your system. If you are not the named addressee you should not disseminate, distr ibute or copy this email.

For more information on Agence France-Presse, please visit our web site at http://www.afp.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




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.