[jdom-interest] UNDECLARED_ATTRIBUTE
Laurent Bihanic
laurent.bihanic at atosorigin.com
Fri Apr 19 01:22:30 PDT 2002
Hi, Elliotte,
I do not agree with you: the sentence you are refering to is part of the
"Attribute-Value Normalization" section. Thus (IMHO) this sentence only
applies to the way parsers should normalize the value of undeclared attribute,
not the way they report the attribute type to the application.
Also, at the time I added the attribute type support, I did not want to use
CDATA as default because of the problems I encountered with enumerated types.
Have a look at SAXHandler's getAttributeType: Without the current hack, using
CDATA as default may lead to report as CDATA some ENUMERATED attributes if
someone uses a parser as weird as Xerces!!!
Laurent
Elliotte Rusty Harold wrote:
> The Attribute class defines integer constants for the various attribute
> types including a default of UNDECLARED_ATTRIBUTE
>
> protected int type = UNDECLARED_ATTRIBUTE;
>
> In my opinion, this is incorrect according to the XML 1.0 specification,
> http://www.w3.org/TR/REC-xml#sec-attribute-types , "All attributes for
> which no declaration has been read should be treated by a non-validating
> processor as if declared *CDATA*." (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.
>
> On a related note, should we perhaps be using the type-safe enum pattenr
> here instead of int constants?
>
More information about the jdom-interest
mailing list