OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   creating xml file

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev <xml-dev@lists.xml.org>
  • Subject: creating xml file
  • From: Seetha Rama Krishna <ram_kurra@yahoo.co.in>
  • Date: Fri, 2 Jun 2006 13:23:35 +0100 (BST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=JMrKCEFfa5JNWAvWyJDrhEc3wbLq5tsM4XKDdu2BrD6kycPUrsC1GhxSqHoTqIVBReEwfXVWQuTQFSl7sAE4biUk4zvhPTsHtLpp81cGHs8+GSY2ATpt/6Ngd7xb2X/ELc2I5xbrruoLnsuddmLTGTDDPdEA23MCDDt2gkgSPjc= ;

Hello Techies,
          I am trying to create xml file using DOM.
       Here is my code.


public static void main(String[] args) {
        // TODO Auto-generated method stub
        try {
            DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = fact.newDocumentBuilder();
            Document doc = db.newDocument();
            Element root = null;
            root = doc.createElement(application);
            doc.appendChild(root);
            Element aid = doc.createElement(application_Id);
            root.appendChild(aid);
            System.out.println("applicationId is added");
            Text t = doc.createTextNode("application");
            t.setNodeValue("test");
            aid.appendChild(t);
            Text t1 = doc.createTextNode("ruleSet_Name");
            t1.setNodeValue("1");
            aid.appendChild(t1);
           
        } catch (ParserConfigurationException pce) {
            // TODO: handle exception
            System.out.println("ParserException" + pce.getMessage());
        }

    }


       I want to store it with name application.xml   .  How can I do this one. Can u guys help me out



regards,
ramu

Send instant messages to your online friends http://in.messenger.yahoo.com

Stay connected with your friends even when away from PC. Link: http://in.mobile.yahoo.com/new/messenger/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS