Results 1 to 6 of 6
Thread: XML read/write in Java
- 05-31-2010, 04:05 PM #1
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
XML read/write in Java
Hello,
I am a student at Computer Science, and for an exam that i have this week, i have to make two *.java files, one to read and the other one to write in an XML file.
The XML should be like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<conn_data>
<adress>localhost</adress></conn_data>
<port>1521</port>
<SID>xe</SID>
<username>RoCourier_LICENTA</username>
<password>roco</password>
Please, if someone know to help me.
Thank you!
Bogdan - Romania
- 05-31-2010, 05:51 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yeah, it's possible with Java. But you must show your effort first of all.
As a hint, you want to use javax.xml.parsers and javax.xml.xpath and dom too. Read more about those on the Java Doc.
- 05-31-2010, 05:53 PM #3
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
Re
yes, i agree 100%, that`s how i do usualy.
but i have exams all week and i realy don`t have the time to search and read and stuff... :(:(:(:(:(:(
- 05-31-2010, 06:00 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Okay, this is how you can locate the XML file.
Java Code:DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse (new File(file_path));
-
Sorry, but this is not our problem and does not change our recommendations as no one's going to do this for you; rather we encourage you to read the lessons on how to work with XML and create your code. Once you have your code created, if you run into problems, please come on back with your code and your questions and we'll be more than happy to help if we can.
Much luck.
- 05-31-2010, 06:08 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
How to read/write txt in Java
By megalomitis in forum New To JavaReplies: 2Last Post: 11-13-2009, 10:09 AM -
how to prevent users from read/write java codes in eclipse?
By anthrax in forum EclipseReplies: 1Last Post: 07-25-2009, 05:53 PM -
How to read first 9 bytes and write in...?
By aRTx in forum New To JavaReplies: 8Last Post: 03-26-2009, 02:54 PM -
Executable java to read and write to a txt file
By njoymirror in forum New To JavaReplies: 2Last Post: 03-21-2009, 01:19 AM -
How Read and Write XMl files using Java
By tjs in forum SWT / JFaceReplies: 0Last Post: 02-23-2009, 12:19 PM


LinkBack URL
About LinkBacks


Bookmarks