| Author |
How to convert String of XML elements into Document Object
|
Nilesh Raje
Ranch Hand
Joined: Aug 02, 2005
Posts: 153
|
|
Hi there, I have written a parser which can parse a xml document using the following way. xmlDoc = new SAXBuilder().build(eventConfigFile); where eventConfigFile is my XML file . This parser successfully parses a XML document. Now here is my problem. In real world this input would not be a XML file. it would be a one continous String with the contents of the XML file. example: "<DatahubRequest><Job>DHTest.Tibco</Job><ExternalID>12354</ExternalID><Source><Source_Location>RC_test</Source_Location><Source_Filename>DH_Test_in_20080811</Source_Filename><Source_Daydecrement>0</Source_Daydecrement></Source><Target><Target_Location>RC_test_11</Target_Location><Target_Filename>DH_Test_in_11111</Target_Filename><Target_Daydecrement>1</Target_Daydecrement></ Target><Target><Target_Location>RC_test_22</Target_Location><Target_Filename>DH_Test_in_2222</Target_Filename><Target_Daydecrement>1</Target_Daydecrement></Target></DatahubRequest>" This string will be actually a pushed as a message on TIBCO EMS and i will pull it from there and read it as XML and extract the values and build my Objects. How do i generate a Document Object out of this String which contains XML and parse it.
|
Thanks and Regards,<br />Nilesh<br />SCJP 1.4, SCWCD 1.4
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16479
|
|
|
You would have to look at the documentation of that SAXBuilder class and see what kind of inputs it can take. It isn't part of the standard Java API, so we (at least I) can't look at the documentation for you because we (at least I) don't know where it is.
|
 |
 |
|
|
subject: How to convert String of XML elements into Document Object
|
|
|