OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   undeclared attribute types

[ Lists Home | Date Index | Thread Index ]

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@metalab.unc.edu | 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/    |
+----------------------------------+---------------------------------+




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS