1 16 17 package com.sun.org.apache.xerces.internal.util; 18 19 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; 20 import org.w3c.dom.Node ; 21 22 27 public final class DOMInputSource extends XMLInputSource { 28 29 private Node fNode; 30 31 public DOMInputSource() { 32 this(null); 33 } 34 35 public DOMInputSource(Node node) { 36 super(null, getSystemIdFromNode(node), null); 37 fNode = node; 38 } 39 40 public DOMInputSource(Node node, String systemId) { 41 super(null, systemId, null); 42 fNode = node; 43 } 44 45 public Node getNode() { 46 return fNode; 47 } 48 49 public void setNode(Node node) { 50 fNode = node; 51 } 52 53 private static String getSystemIdFromNode(Node node) { 54 if (node != null) { 55 try { 56 return node.getBaseURI(); 57 } 58 catch (NoSuchMethodError e) { 62 return null; 63 } 64 catch (Exception e) { 67 return null; 68 } 69 } 70 return null; 71 } 72 73 } | Popular Tags |