This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java and XML problems

 
Luis Jacho
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just want to append a child to a xml document from NetBeans but i dont know whats wrong
try{
DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document futxml = dBuilder.parse(new File("xmlsrc/xxml.xml"));
if( futxml.hasChildNodes()) System.out.println("SI");
Element hijo = futxml.createElement(jTextField2.getText().trim());
// Text text = futxml.createTextNode(jTextArea.getText().trim());
// hijo.appendChild(text);
futxml.appendChild(hijo);


This is my error org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
please help !!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the source of this xxml.xml file you are trying to parse?

If you created it, did you use Microsoft Word?

Bill
 
Paul Clapham
Sheriff
Pie
Posts: 20719
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And as always when you get an exception: what line of code threw the exception? Don't just ignore the stack trace, it tells you that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic