0

HI there,
The program which I am working on involves reading XML document and then depending on the input data save the output files(text) in different folders...can any body tell me where do i find tutorials which can help me in doing this....
I need help ..

waiting for response

shriyash.

2
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by Ezzaral
0

There are two commands available on a File object to create a directory. File.mkDir() will create just the directory specified by the File object. All parent directories must already exist. The second method, File.mkDirs() will create any necessary directories to create the entire path specified.

// if ParentDir exists, this invocation will work
File targetDir = new File("c:/ParentDir/TargetDir");
if (!targetDir.exists())
    targetDir.mkDir();

// if ParentDir may not exist yet, you can use 
// mkDirs() instead and all directories will be created
File targetDir = new File("c:/ParentDir/TargetDir");
if (!targetDir.exists())
    targetDir.mkDirs();
0

hey Ezzaral.
thanx a lot....can u plz help me with the bold part which i have mentioned in my thread....i.e" reading XML document with a JAVA program and then depending on the input data save the output files(text) in different folders
I am new to java programming and wud be very gratefull if you can suggest me with some tutorial links with which i can do this task.

shriyash.

1

You will need to use an XML parser to read the files for processing. If you are using J2SE5.0 or above, JAXP provides built-in XML libraries. If you are using earlier versions of Java, you will need to download a parser such as JDOM or Xerces (easily found with Google). If you use JAXP, you can find many tutorials on processing XML in Java at http://java.sun.com/webservices/jaxp/learning/tutorial/index.html

Votes + Comments
Good help to beginners.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.