Results 1 to 6 of 6
Thread: Xml
- 06-29-2010, 11:13 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 17
- Rep Power
- 0
Xml
Hi Guys
I have an XML which i want to convert to a Document:
Here is my XML: Can someone direct me to a link or give a hint of how to do it:
Java Code:<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.server.vit.za.mfgad.com/"> <soapenv:Header/> <soapenv:Body> <web:newOutboundVoiceRouteRequest> <!--Optional:--> <requestDetail> <!--Optional:--> <assignedUser>?</assignedUser> <!--Optional:--> <externalCorrIdentifier>?</externalCorrIdentifier> <!--Optional:--> <externalIdentifier>?</externalIdentifier> <!--Optional:--> <interactionSource>?</interactionSource> <!--Optional:--> <mediaChannelRouteIdentifier>?</mediaChannelRouteIdentifier> <!--Zero or more repetitions:--> <dialNumbers>?</dialNumbers> <!--Optional:--> <displayInformation>?</displayInformation> <!--Optional:--> <externalPartyIdentifier>?</externalPartyIdentifier> <!--Optional:--> <externalPartyName>?</externalPartyName> </requestDetail> </web:newOutboundVoiceRouteRequest> </soapenv:Body> </soapenv:Envelope>
Thank you:
Thuto(South Africa)
Moderator edit: code tags addedLast edited by Fubarable; 06-29-2010 at 02:04 PM. Reason: Moderator edit: code tags added
- 06-29-2010, 01:52 PM #2
Member
- Join Date
- Jun 2010
- Posts
- 4
- Rep Power
- 0
here is the example xml to documnet parser
- 06-30-2010, 08:59 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 9
- Rep Power
- 0
@tolja, That was a great help ..
Can somebody please help me with something similiar ?
I have to read xml file using jxl and dump its contents to an excel file (again using jxl).
writing contents to excel file is straight-forward. I am struck with readin xml contents using jxl.
its urgent !! I am in need of it before end of today,
- 07-01-2010, 01:57 AM #4
Member
- Join Date
- Jun 2010
- Location
- USA
- Posts
- 19
- Rep Power
- 0
Java Code:String xml = //... StreamSource source = new StreamSource(new StringReader(xml)); DOMResult result = new DOMResult(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(source, result); Document root = (Document)result.getNode();
Last edited by mangstadt; 07-01-2010 at 02:27 PM.
- 07-01-2010, 06:17 AM #5
Member
- Join Date
- Mar 2010
- Posts
- 9
- Rep Power
- 0
@mangstadt,
thanx for help.. but i m getting null for my root.
- 07-01-2010, 02:36 PM #6
Member
- Join Date
- Jun 2010
- Location
- USA
- Posts
- 19
- Rep Power
- 0
There was a mistake in my code sample. See my prev post for the updated code.
What are you doing to test for it being null? The following is normal output for System.out.println(root);
[#document: null]
This doesn't mean the document is null. To get the root XML element, call root.getFirstChild();
How do you like the World Cup? ;)


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks