Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Java Tutorials



Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Xml Dom CreatXMLFile

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

17 comments so far (post your own) View All Comments Latest 10 Comments:

Getting below exception

INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.

Posted by Partha on Monday, 09.6.10 @ 17:06pm | #99411

very helpful

Posted by Rohan Ghosh on Tuesday, 06.22.10 @ 18:22pm | #97732

I appreciate you for providing such good stuff for the developers.

Posted by john on Tuesday, 05.18.10 @ 12:59pm | #97078

good example

Posted by Manjunatha.R on Thursday, 03.18.10 @ 17:50pm | #95660


Nice post. I however do not understand how the code was able to print these two lines of code :

C:\vinod\xml>javac CreatXMLFile.java

I would like to create an XML file like you have done, but also store it in some folder on my comp..

Please let me know!


Posted by Sudarshan on Thursday, 03.4.10 @ 09:35am | #95284


Works fine, except for the created xml-data is not saved
as an xml-file.

What to add to it or change to the code to make it the created xml-data actually save as an xml-file?


Posted by Jansen Lucas on Monday, 10.19.09 @ 20:28pm | #91903

It worked great. However I wonder how the formatting could be improved with newlines. Right now everything is on one line, so its not very readable.

Posted by Barry on Saturday, 10.17.09 @ 19:14pm | #91847

hello all .... i am trying to craete one servlet for all jsp files but i am getting any hint .....anybody can help plz...

Posted by abha on Tuesday, 03.17.09 @ 03:05am | #85923

public ArrayList extractClassesFromDir (String dirName) throws Exception {
StringTokenizer stoken= new StringTokenizer(DirName,"\\");
return classList;
public void Reader(String args) throws Exception {

File folder = new File(args);
File[] listOfFiles = folder.listFiles();
String str=null;
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
str =listOfFiles[i].getPath()+ listOfFiles[i].getName();
str = str.replace(Dir, "");
str = str.replace("\\", ".");
str = DirName+str;
else if (listOfFiles[i].isDirectory()) {

Posted by aatmaram patil on Wednesday, 12.24.08 @ 05:51am | #83131

This is very much helpful for me thank you..
Great work....

Posted by Shivprasad on Monday, 11.24.08 @ 23:57pm | #81991

Code is for create a simple XML file,Really this is a very good code.

Actully i have some attributes of the elements.
And some have no data.
Then how I do ....

Posted by Ratish on Monday, 11.17.08 @ 04:00am | #81740

ahhhh ! this site is gr8 for java developers i was searching for xml code n i found it on this site

Posted by Gurpreet Solaich on Thursday, 04.10.08 @ 14:20pm | #55824

This is one of the best websites to learn JAVA. Every line of code is explained in a very simple manner.

Posted by Ajay Anand on Tuesday, 01.8.08 @ 16:00pm | #44791

I got the following error while compiling the code. "DOMSource node as this type not supported."

Please advise!

Posted by Sylvia on Saturday, 12.15.07 @ 05:37am | #42377

I am new to both Java&XML, this site it the best I found so far. Thanks!

Posted by Y on Friday, 11.9.07 @ 00:32am | #36748

I searched for DOM answers all over the place until I found this tutorial. Clear, easy to understand with simple examples. Thanks!!

Posted by anon on Tuesday, 08.7.07 @ 23:02pm | #22890

the examples were very good and well explained. and they worked. liked this site very much. will visit again.

Posted by mohit on Saturday, 07.21.07 @ 15:34pm | #21691

Ask programming questions?



Back to Tutorial


  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.