| Author |
Document : set raw xml (java)
|
jay vas
Ranch Hand
Joined: Aug 30, 2005
Posts: 407
|
|
Hi guys : Im trying to set the text in an XML document in jave using the default java xml implementation (org.w3c.dom.) Its not working ? I just want to set the raw xml text. This is driving me crazy please help !???
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
An XML document can't consist of only text. It has to have a root element. That's why it's "not working", as you put it. Now if you went to the root element of the document and tried to set its content to some text, that probably wouldn't throw any exceptions.
|
 |
jay vas
Ranch Hand
Joined: Aug 30, 2005
Posts: 407
|
|
Thanks ! So then is there any simple way in the java document api way to go from raw text (a String) to a Document object without a file name ?
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Document objects don't have a file name. I don't understand this question at all. Perhaps you could explain what you are really trying to do.
|
 |
jay vas
Ranch Hand
Joined: Aug 30, 2005
Posts: 407
|
|
Thanks again. Well its pretty simple. I want to create a create a Document object which represents a string...I want to be able to do something like this...
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Oh, I see. You have a String containing XML and you want to parse it into a Document. Like this:
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Document : set raw xml (java)
|
|
|