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

undeclared attribute types

  • To: sax-devel@l...
  • Subject: undeclared attribute types
  • From: Elliotte Rusty Harold <elharo@m...>
  • Date: Fri, 19 Apr 2002 07:59:28 -0400
  • Cc: Laurent Bihanic <laurent.bihanic@a...>,xml-dev@l...
  • In-reply-to: <3CBFD3C6.3050005@a...>
  • References: <3CBEE259.9030407@m...><3CBFD3C6.3050005@a...>

sax attribute type
Consider the following simple XML document:

<Greeting importance="1">
   Hello!
</Greeting>

Notice that this document has no DTD. What is the type of the 
importance attribute?

I've been saying that in cases like this, importance has type CDATA 
by default. However, Laurent Bihanic pointed out to me that the only 
place in the XML spec that indicates this really only refers to 
attribute value normalization, not to anything else. This is in 
section 3.3.3 which states:

All attributes for which no declaration has been read should be 
treated by a non-validating processor as if declared CDATA.

This does *not* say that such attributes do have type CDATA, and I 
can't find anything else in the spec that says they do. (The 
restriction to non-validating processors here is IMO an erratum in 
the spec which I just reported to the editors.) I think we should 
delete the UNDECLARED_ATTRIBUTE field and use CDATA as the default 
attribute type.

The SAX JavaDoc does says this. See 
http://www.saxproject.org/apidoc/org/xml/sax/Attributes.html#getType(int) 
which states:

The attribute type is one of the strings "CDATA", "ID", "IDREF", 
"IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" 
(always in upper case).

If the parser has not read a declaration for the attribute, or if the 
parser does not report attribute types, then it must return the value 
"CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, 
"Attribute-Value Normalization").

However, it's not at all clear that SAX is correct here. I think SAX 
may need to change in order to distinguish between genuine CDATA 
attributes and undeclared or untyped attributes. Thoughts?
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@m... | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+

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.