"Automation _ Continuous Integration" ___java___xml__dom Tim

Source: Internet
Author: User

One, the code is as follows
Package Com.wujianbo.five;import Java.io.file;import Java.security.cert.trustanchor;import Javax.xml.parsers.documentbuilder;import Javax.xml.parsers.documentbuilderfactory;import Javax.xml.transform.transformer;import Javax.xml.transform.transformerfactory;import Javax.xml.transform.dom.domsource;import Javax.xml.transform.stream.streamresult;import org.w3c.dom.Document; Import Org.w3c.dom.element;public class Demo09 {public static void main (string[] args) throws Exception {//TODO Auto-gene Rated method stubDemo09 demo09= new Demo09 ();d emo09.createxmlbydom (); private void Createxmlbydom () throws Exception {//TODO auto-generated method stubdocumentbuilderfactory dbf= Documentbui Lderfactory.newinstance ();d bf.setignoringelementcontentwhitespace (true); String xmlname= system.getproperty ("User.dir") + "\\data\\NewStudents.xml";//system.out.println (XMLName);D Ocumentbuilder db= Dbf.newdocumentbuilder ()//system.out.println (db);D ocument doc= db.parse (xmlName);//Element Root = Doc.getdocumentelement ();//element son= doc.createelement ("Son")//son.setattribute ("id", "001");//element name= doc.createelement (" Name ");//name.settextcontent (" Son ");//son.appendchild (name);//element age= doc.createelement (" age ");// Age.settextcontent ("ten");//son.appendchild (age);////root.appendchild (son);////transformerfactory factory= Transformerfactory.newinstance ();//transformer former= Factory.newtransformer ();//former.transform (New DOMSource ( DOC), New Streamresult (New File (XMLName)));}}

"Automation _ Continuous Integration" ___java___xml__dom Tim

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.