You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sampath K Settipalli <Sa...@genome.wi.mit.edu> on 2002/09/21 20:05:48 UTC

Document.createElement(Integer.toString(int))

Hi ,

  I just wonder can I create a Element with name as
Integer.toString(integer) . I want to replace TXElement el = new
TXElement(Integer.toString(int)); which seems to work. I need to migrate
to xerces and hence get rid of TXElement.
 I had replaced with this code
doc.createElement(Integer.toString(testV.size()));  //doc is Document
OR say doc.createElement(Integer.toString(0));
It fails with exception org.w3c.dom.DOMException: DOM002 Illegal
character
How can I get this working

thanks in Advance,
Sampath





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Document.createElement(Integer.toString(int))

Posted by Andy Clark <an...@apache.org>.
Sampath K Settipalli wrote:
> It fails with exception org.w3c.dom.DOMException: DOM002 Illegal
> character
> How can I get this working

Elements (and attribute) names are not allowed to
begin with a digit. Therefore, you need to create an
element with a name that starts with a letter or
some other allowed character. (Check the XML spec
for details.) For example:

   doc.createElement("n"+testV.size());

If TXElement allowed you to do this, then it was a
bug in the code.

-- 
Andy Clark * andyc@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Document.createElement(Integer.toString(int))

Posted by Ryosuke Nanba <rn...@cyber.email.ne.jp>.
Hi,

>  I had replaced with this code
> doc.createElement(Integer.toString(testV.size()));  //doc is Document
> OR say doc.createElement(Integer.toString(0));
> It fails with exception org.w3c.dom.DOMException: DOM002 Illegal
> character

XML Spec prohibit tagname starts with digit such as <1st />
<2nd /> etc. 
---
	Ryosuke Nanba

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org