cancel
Showing results for 
Search instead for 
Did you mean: 

How To Convert XML into String?

Former Member
0 Kudos

Hi,

I have a requirement in which I need to convert the data from XML file to string.

E.g.

<Drawing>

<DrawingSpecification>

<Header>

<SoldTo>SDN</SoldTo>

<SoldToName>SAP</SoldToName>

<Date/>

<Manager>CEO</Manager>

< Plant>INDIA</Name>

<Items>

<Item>

< MaterialNumber>MatNum12</ MaterialNumber>

<ProductNumber>ProName12</ ProductNumber>

</Item>

</Items>

< ClientId>ClientID123</ ClientId>

<FileName>FileName123</FileName>

<Type/>

< TemplateName/>

</DrawingSpecification>

<Image contentType=""/>

< /Drawing>

Output should be like:

< File>

< Content> SDN SAP CEO INDIA MatNum12 ProName12 ClientID123 FileName123</Content>

< /File>

Please provide solution for the same.

Thanks,

Abhishek.

View Entire Topic
Former Member
0 Kudos

Hi,

You can use DOM Parser for this. Check these links.

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM3.html

http://www.developerfusion.com/code/2064/a-simple-way-to-read-an-xml-file-in-java/

Once the string is obtained, you can create the output file.

Regards,

Harini S