on 07-31-2007 11:00 AM
Hi frnds
I need your help as m not a java programmer so m getting a problem in the respective scenario..
I have to write a java program which accept xml as a string and convert xml string to xml dom object, and create a xml file using the xml dom object.
i have done some coding for accepting the xml file and print it on the console that is as like..
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
class XMLConverter
{
public static void main(String args[])
{
String XML_FOLDER_NAME="D:/java/client.xml";
String selectXMLFile="";
try
{
BufferedReader in1 =new BufferedReader(new FileReader(XML_FOLDER_NAME));
String str1 = "";
while ((str1 = in1.readLine()) != null)
{
System.out.println(str1);
}
}
catch (Exception e)
{
System.out.println("Exception: " +e);
}
}
}
But hw to convert xml string to xml dom object and the further evaluation. Plz help me out.
Thnx
Adhir
Hi,
Please check this link. It will be useful.
http://www.brics.dk/~amoeller/XML/programming/domexample.html
Note: http://www.brics.dk/~amoeller/XML/xml/recipes.xml - XML file used by the sample program
Regards,
Dhanasekar K
Reward points if found useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adhir,
These two links from java.sun.com may help you.
First one is about Reading XML Data into a DOM.
1.http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/dom/1_read.html
Second is about Writing Out a DOM as an XML File
2.http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/xslt/2_write.html
Best Regards,
Nitesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Please go through my code snipet in Wiki. To that visit this link
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/java/createDOMObjectfromXMLinJava&
Thanks.
Rajes
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.