|
This topic has
6
replies
on
1
page.
|
|
|
xyoon
Posts:48
Registered: 6/11/03
|
|
|
|
|
Hi all,
I have a question here regarding converting XML string into a DOM document.
How can I do this in Java?
The Document.Parse() methods do not have one that takes in String as its parameter.
I'm not sure what is the best way to do this in Java.
Any help is greatly appreciated.
Thank you in advance.
regards,
Sean
|
|
Martin3
Posts:561
Registered: 4/28/98
|
|
|
|
|
See
http://cvs.sourceforge.net/viewcvs.py/mathml-x/mathml-x/examples/graph/src/com/neuralworks/graph/MixedMain.java?rev=1.1&view=markup
Check the internalXMLDocument object creation. The code prepares an InputStream from a String of mathml and
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/DocumentBuilder.html#parse(java.io.InputStream)
|
|
|
|
|
|
|
|
Convert XML String to Document with StringReader.
String xmlString;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmlString)));
|
|
xyoon
Posts:48
Registered: 6/11/03
|
|
|
|
|
Hi dvohra09,
That's exactly what I want.
Thank you so much :)
regards,
Sean
|
|
Martin3
Posts:561
Registered: 4/28/98
|
|
|
|
|
dvohra09,
That is a very neat and efficient way. I'll switch my stuff to what you presented too. Thanks!
|
|
|
|
|
|
|
|
Hai,
Thx. i was having the same problem i got the code and its working fine
|
|
JavaSUN
Posts:1
Registered: 5/13/07
|
|
|
|
|
Hi,
Thanks a lot for the reply. Its really helpful.
|
|
|
This topic has
6
replies
on
1
page.
|
|
Back to Forum
Read the Developer Forums Code of Conduct
Email this Topic
Edit this Topic
|
|
Site Upgrade
Forums 7.1.8 was deployed Oct 26th. The release consists of minor fixes & a few enhancements.
|
|
Forums Statistics
Users Online : 25 - Guests : 132
About Sun forums
-
Oracle Forums is a large collection of user generated
discussions. It is here to help you ask questions, find answers, and
participate in discussions.
Check out our guide on Getting
started with Oracle Forums for a full walkthrough of how to best
leverage the benefits of this community.
|
|