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 32 33 public abstract class AbstractAttrNS extends AbstractAttr { 34 37 protected String namespaceURI; 38 39 42 protected AbstractAttrNS() { 43 } 44 45 65 protected AbstractAttrNS(String nsURI, 66 String qname, 67 AbstractDocument owner) 68 throws DOMException { 69 super(qname, owner); 70 namespaceURI = nsURI; 71 String prefix = DOMUtilities.getPrefix(qname); 72 if (prefix != null) { 73 if (nsURI == null || nsURI.equals("") || 74 ("xml".equals(prefix) && 75 !XMLSupport.XML_NAMESPACE_URI.equals(nsURI)) || 76 ("xmlns".equals(prefix) && 77 !XMLSupport.XMLNS_NAMESPACE_URI.equals(nsURI))) { 78 throw createDOMException 79 (DOMException.NAMESPACE_ERR, 80 "namespace.uri", 81 new Object [] { new Integer (getNodeType()), 82 getNodeName(), 83 nsURI }); 84 } 85 } else if ("xmlns".equals(qname) && 86 !XMLSupport.XMLNS_NAMESPACE_URI.equals(nsURI)) { 87 throw createDOMException(DOMException.NAMESPACE_ERR, 88 "namespace.uri", 89 new Object [] { new Integer (getNodeType()), 90 getNodeName(), 91 nsURI }); 92 } 93 } 94 95 99 public String getNamespaceURI() { 100 return namespaceURI; 101 } 102 103 106 protected Node export(Node n, AbstractDocument d) { 107 super.export(n, d); 108 AbstractAttrNS aa = (AbstractAttrNS)n; 109 aa.namespaceURI = namespaceURI; 110 return n; 111 } 112 113 116 protected Node deepExport(Node n, AbstractDocument d) { 117 super.deepExport(n, d); 118 AbstractAttrNS aa = (AbstractAttrNS)n; 119 aa.namespaceURI = namespaceURI; 120 return n; 121 } 122 123 127 protected Node copyInto(Node n) { 128 super.copyInto(n); 129 AbstractAttrNS aa = (AbstractAttrNS)n; 130 aa.namespaceURI = namespaceURI; 131 return n; 132 } 133 134 138 protected Node deepCopyInto(Node n) { 139 super.deepCopyInto(n); 140 AbstractAttrNS aa = (AbstractAttrNS)n; 141 aa.namespaceURI = namespaceURI; 142 return n; 143 } 144 } 145 | Popular Tags |