1 5 6 package com.hp.hpl.jena.rdf.arp; 7 8 import javax.xml.transform.*; 9 import javax.xml.transform.dom.*; 10 import javax.xml.transform.sax.*; 11 import org.w3c.dom.*; 12 13 import com.hp.hpl.jena.rdf.model.*; 14 import com.hp.hpl.jena.shared.*; 15 16 22 public class DOM2Model extends SAX2Model { 23 24 36 public DOM2Model(String base, Model m) throws MalformedURIException { 37 this(base, m, ""); 38 } 39 40 59 public DOM2Model(String base, Model m, String lang) 60 throws MalformedURIException { 61 super(base, m, lang); 62 } 63 69 public void load(Node document) { 70 Source input = new DOMSource(document); 71 72 SAXResult output = new SAXResult(this); 74 output.setLexicalHandler(this); 75 76 TransformerFactory xformFactory = TransformerFactory.newInstance(); 78 try { 79 Transformer idTransform = xformFactory.newTransformer(); 80 idTransform.transform(input, output); 81 } 82 catch (RuntimeException rte){ 83 throw rte; 84 } 85 catch (Exception nrte){ 86 throw new JenaException(nrte); 87 } 88 } 89 90 } 91 92 117 118 | Popular Tags |