Is it valid to use dtd entities in defining XML ids?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it valid to use dtd entities in defining XML ids?

Mark Banner
I'm reviewing some code for a dialog in Address book and need some guidance.

The submitter has defined an id in the xml for the dialog as:

<textbox id="Home&StateAndZipCodeLeft.id;">

In the DTD it is defined as:

<!ENTITY StateAndZipCodeLeft.id         "State">

Is this valid?

In the specification I have been pointed to
(http://www.w3.org/TR/REC-xml/#sec-attribute-types) says the following:

"Values of type ID MUST match the Name production."

Name is defined as

Name       ::=          (Letter | '_' | ':') (NameChar)*

The submitter has since pointed out the text :

The Names and Nmtokens productions are used to define the validity of
tokenized attribute values after normalization (see 3.3.1 Attribute Types).

How I read that section implies that the id as defined above is valid.

Please can someone with more knowledge just confirm this for me?

Thanks
Standard8
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: Is it valid to use dtd entities in defining XML ids?

Axel Hecht
Mark Banner wrote:

> I'm reviewing some code for a dialog in Address book and need some
> guidance.
>
> The submitter has defined an id in the xml for the dialog as:
>
> <textbox id="Home&StateAndZipCodeLeft.id;">
>
> In the DTD it is defined as:
>
> <!ENTITY StateAndZipCodeLeft.id         "State">
>
> Is this valid?
>
> In the specification I have been pointed to
> (http://www.w3.org/TR/REC-xml/#sec-attribute-types) says the following:
>
> "Values of type ID MUST match the Name production."
>
> Name is defined as
>
> Name       ::=          (Letter | '_' | ':') (NameChar)*
>
> The submitter has since pointed out the text :
>
> The Names and Nmtokens productions are used to define the validity of
> tokenized attribute values after normalization (see 3.3.1 Attribute Types).
>
> How I read that section implies that the id as defined above is valid.
>
> Please can someone with more knowledge just confirm this for me?
>
> Thanks
> Standard8

http://www.w3.org/TR/2004/REC-xml11-20040204/#AVNormalize is the
reference in question here, and say that entity references are expanded
recursively. 3, 2nd <li>.

I think that naming the entity .id when it's really just half of the ID
value is a bit misleading, though. I'll probably forget to add that to
the bug by tomorrow, too :-(

Axel
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml