1 18 package org.apache.batik.dom; 19 20 import org.apache.batik.dom.util.DOMUtilities; 21 import org.apache.batik.dom.util.XMLSupport; 22 import org.w3c.dom.DOMException ; 23 import org.w3c.dom.Node ; 24 25 31 32 public abstract class AbstractElementNS extends AbstractElement { 33 36 protected String namespaceURI; 37 38 41 protected AbstractElementNS() { 42 } 43 44 59 protected AbstractElementNS(String nsURI, String qname, 60 AbstractDocument owner) 61 throws DOMException { 62 super(qname, owner); 63 namespaceURI = nsURI; 64 String prefix = DOMUtilities.getPrefix(qname); 65 if (prefix != null) { 66 if (nsURI == null || nsURI.equals("") || 67 ("xml".equals(prefix) && 68 !XMLSupport.XML_NAMESPACE_URI.equals(nsURI))) { 69 throw createDOMException 70 (DOMException.NAMESPACE_ERR, 71 "namespace.uri", 72 new Object [] { new Integer (getNodeType()), 73 getNodeName(), 74 nsURI }); 75 } 76 } 77 } 78 79 83 public String getNamespaceURI() { 84 return namespaceURI; 85 } 86 87 90 protected Node export(Node n, AbstractDocument d) { 91 super.export(n, d); 92 AbstractElementNS ae = (AbstractElementNS)n; 93 ae.namespaceURI = namespaceURI; 94 return n; 95 } 96 97 100 protected Node deepExport(Node n, AbstractDocument d) { 101 super.deepExport(n, d); 102 AbstractElementNS ae = (AbstractElementNS)n; 103 ae.namespaceURI = namespaceURI; 104 return n; 105 } 106 107 111 protected Node copyInto(Node n) { 112 super.copyInto(n); 113 AbstractElementNS ae = (AbstractElementNS)n; 114 ae.namespaceURI = namespaceURI; 115 return n; 116 } 117 118 122 protected Node deepCopyInto(Node n) { 123 super.deepCopyInto(n); 124 AbstractElementNS ae = (AbstractElementNS)n; 125 ae.namespaceURI = namespaceURI; 126 return n; 127 } 128 } 129 | Popular Tags |