1 16 17 package org.apache.xerces.dom; 18 19 import org.apache.xerces.util.URI; 20 import org.w3c.dom.DOMException ; 21 import org.w3c.dom.Node ; 22 import org.w3c.dom.Notation ; 23 24 47 public class NotationImpl 48 extends NodeImpl 49 implements Notation { 50 51 55 56 static final long serialVersionUID = -764632195890658402L; 57 58 62 63 protected String name; 64 65 66 protected String publicId; 67 68 69 protected String systemId; 70 71 72 protected String baseURI; 73 74 78 79 public NotationImpl(CoreDocumentImpl ownerDoc, String name) { 80 super(ownerDoc); 81 this.name = name; 82 } 83 84 88 92 public short getNodeType() { 93 return Node.NOTATION_NODE; 94 } 95 96 99 public String getNodeName() { 100 if (needsSyncData()) { 101 synchronizeData(); 102 } 103 return name; 104 } 105 106 110 114 public String getPublicId() { 115 116 if (needsSyncData()) { 117 synchronizeData(); 118 } 119 return publicId; 120 121 } 123 127 public String getSystemId() { 128 129 if (needsSyncData()) { 130 synchronizeData(); 131 } 132 return systemId; 133 134 } 136 140 144 public void setPublicId(String id) { 145 146 if (isReadOnly()) { 147 throw new DOMException ( 148 DOMException.NO_MODIFICATION_ALLOWED_ERR, 149 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); 150 } 151 if (needsSyncData()) { 152 synchronizeData(); 153 } 154 publicId = id; 155 156 } 158 162 public void setSystemId(String id) { 163 164 if(isReadOnly()) { 165 throw new DOMException ( 166 DOMException.NO_MODIFICATION_ALLOWED_ERR, 167 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); 168 } 169 if (needsSyncData()) { 170 synchronizeData(); 171 } 172 systemId = id; 173 174 } 176 177 185 public String getBaseURI() { 186 if (needsSyncData()) { 187 synchronizeData(); 188 } 189 if (baseURI != null && baseURI.length() != 0 ) { try { 191 return new URI(baseURI).toString(); 192 } 193 catch (org.apache.xerces.util.URI.MalformedURIException e){ 194 return null; 196 } 197 } 198 return baseURI; 199 } 200 201 202 public void setBaseURI(String uri){ 203 if (needsSyncData()) { 204 synchronizeData(); 205 } 206 baseURI = uri; 207 } 208 209 } | Popular Tags |