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.

Recommended Answers

All 3 Replies

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();

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.

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

commented: Good help to beginners. +20
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.