File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't ID contain numeric data??

 
senthil rajan
Ranch Hand
Posts: 36
  • 0
  • 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
  • 0
  • 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