[jdom-interest] Error org.jdom.IllegalNameException

John L. Webber John.Webber at jentro.com
Fri Nov 14 04:49:58 PST 2003


How about:

String text = element.getText();
text = text.replaceAll(" ", "");
rootElement.setName(text);

Moipone Mocoancoeng wrote:

> In my program I extract text from one of the element in my xml 
> document and I need to change the root element of the xml document to 
> the text that I've extracted from one of the element in the doc
>
> [CODE]
>
> Element rootElement = (Element) xmlObject.getElement();
>
> Element element= rootElement.getChild("Element");
>
> String text= element.getText();
>
> rootElement.setName(text);
>
> [/CODE]
>
> I get an error [I]The name "Internal Training"(which is the text 
> returned) is not legal for JDOM/XML elements: XML names cannot contain 
> the character " "
>
> How do I remove the characters "".
>
> ------------------------------------------------------------------------

-- 
---------------------------------------------------------
 Jentro Technologies GmbH
 John L. Webber, Software Development
---------------------------------------------------------
 Rosenheimer Str. 145e	    81671 München
 Tel. +49 700 881 199 88    mailto:John.Webber at jentro.com 
 Fax  +49 700 881 199 88    http://www.jentro.com
---------------------------------------------------------
NOTICE: The information contained in this e-mail is confidential or may otherwise be legally privileged. It is intended for the named recipient only. If you have received it in error, please notify us immediately by reply or by calling the telephone number above and delete this message and all its attachments without any use or further distribution of its contents. Please note that any unauthorised review, copying, disclosing or otherwise making use of the information is strictly prohibited. Thank you. 
---------------------------------------------------------





More information about the jdom-interest mailing list