xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "aaz" <...@webcapacity.com>
Subject re: re: dumb question
Date Tue, 17 Apr 2001 04:29:54 GMT
Hi all,
Thanks for the start, I tried this after looking at the java docs but get the following as
the result:
Not what I am expecting I guess given my code below, is this correct?

<?xml version="1.0" encoding="UTF-8" ?> 
  <TestRoot /> 
-----------------------------------------------------


        org.w3c.dom.DOMImplementation di  = (org.w3c.dom.DOMImplementation) new org.apache.xerces.dom.DOMImplementationImpl();
        org.w3c.dom.Document d = di.createDocument(null,"TestRoot",null);

        org.w3c.dom.Attr attr = d.createAttribute("attr1");
        attr.setValue("testval");

        org.w3c.dom.Element e = d.createElement("TestElement");
        e.setAttributeNode(attr);

        DOMSource dsource = new DOMSource(d);
        File f = new File("c:/Test.xml");
        f.createNewFile();
        StreamResult st = new StreamResult(f);

        TransformerIdentityImpl ti =  new TransformerIdentityImpl();
        Transformer t = ti.getTransformer();
        t.transform(dsource,st);



Mime
View raw message