A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Software Craftsman
this week in the
XML and Related Technologies
Retrieve inner XML & convert into String
Joined: Aug 07, 2013
Aug 07, 2013 23:37:39
I am looking to get the inner xml as
type from the XML file.
<xml version = "1.0">
I am looking to get the inner xml of <Root> node as String like -
String s = "<Child1>abc</Child1>
Is it possible to do it through JAX-B or should I get it through some XML parser. If the XML is a large file with around 300 <ChildN> nodes, would it impact the performance in case of parsing it.
Could you please help with the code snippet, if possible.
Thanks in advance.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Aug 08, 2013 07:43:25
If all you want is the text between the <root> and </root> lines that is not an XML problem at all but a text file reading one.
Open the file with a reader, read line by line, start writing content to a string buffer when you pass the opening Root tag and repeat til you hit the closing tag.
I agree. Here's the link:
subject: Retrieve inner XML & convert into String
Create New XML Document using XPATH
Can an XML Node be converted to a String
Deleting the children from node - xml
Problem in creating XML using DOM
Find Level of Element in XML
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015