1 2 package com.sun.xml.fastinfoset.tools; 3 4 import com.sun.xml.fastinfoset.dom.DOMDocumentSerializer; 5 import java.io.InputStream ; 6 import java.io.OutputStream ; 7 import javax.xml.parsers.DocumentBuilder ; 8 import javax.xml.parsers.DocumentBuilderFactory ; 9 import org.w3c.dom.Document ; 10 11 public class XML_DOM_FI extends TransformInputOutput { 12 13 public XML_DOM_FI() { 14 } 15 16 public void parse(InputStream document, OutputStream finf) throws Exception { 17 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 18 dbf.setNamespaceAware(true); 19 DocumentBuilder db = dbf.newDocumentBuilder(); 20 Document d = db.parse(document); 21 22 DOMDocumentSerializer s = new DOMDocumentSerializer(); 23 s.setOutputStream(finf); 24 s.serialize(d); 25 } 26 27 public static void main(String [] args) throws Exception { 28 XML_DOM_FI p = new XML_DOM_FI(); 29 p.parse(args); 30 } 31 32 } | Popular Tags |