This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't ID contain numeric data??

 
senthil rajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frnds,

I tried a DTD with ID. In this I'm not able to store the numeric value.Its showing error that the ID value should obey the naming convention.



The XML file is :
----------------------------------------------
<!DOCTYPE CONTACTS

[ <!ELEMENT CONTACTS ANY>
<!ELEMENT CONTACT ANY>
<!ATTLIST CONTACT CONTACT_NUM ID #REQUIRED>
]>
<CONTACTS>
<CONTACT CONTACT_NUM = "11"/>
</CONTACTS>
----------------------------------------------

If I give like

<CONTACT CONTACT_NUM = "num"/>

Its not giving error..

Is it mean that i can't store the numbers in ID ???

- Thanks,
Senthil.
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by senthil rajan:
Hi Frnds,

I tried a DTD with ID. In this I'm not able to store the numeric value.Its showing error that the ID value should obey the naming convention.




Is it mean that i can't store the numbers in ID ???

- Thanks,
Senthil.


The value for DTD id attribute has to follow the standard XML naming rules (has to eb a valid XML name) and one of the rules is
"A name cannot start with a number or punctuation character"

Thsi is one great drawback of using DTD
HTH
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic