1 20 21 25 26 package org.ozoneDB.xml.dom; 27 28 import org.w3c.dom.*; 29 30 31 50 public final class NotationImpl extends NodeImpl implements NotationProxy { 51 52 final static long serialVersionUID = 1; 53 54 55 public short getNodeType() { 56 return NOTATION_NODE; 57 } 58 59 60 public final void setNodeValue( String value ) { 61 throw new DOMExceptionImpl( DOMException.NO_DATA_ALLOWED_ERR, "This node type does not support values." ); 62 } 63 64 65 public String getPublicId() { 66 return _publicID; 67 } 68 69 70 public void setPublicId( String publicID ) { 71 _publicID = publicID; 72 } 73 74 75 public String getSystemId() { 76 return _systemID; 77 } 78 79 80 public void setSystemId( String systemID ) { 81 _systemID = systemID; 82 } 83 84 85 public synchronized boolean equals( Object other ) { 86 NotationProxy otherX; 87 88 if (super.equals( other )) { 92 otherX = (NotationProxy)other; 93 return 94 (this.getPublicId() == null && otherX.getPublicId() == null || this.getPublicId() != null 95 && this.getPublicId().equals( otherX.getPublicId() )) && (this.getSystemId() == null 96 && otherX.getSystemId() == null || this.getSystemId() != null && this.getSystemId().equals( 97 otherX.getSystemId() )); 98 } 99 return false; 100 } 101 102 103 public final Object clone() { 104 TextProxy clone = null; 105 try { 106 clone = (TextProxy)database().createObject( TextImpl.class.getName() ); 107 clone.init( _ownerDocument, getNodeValue() ); 108 cloneInto( clone, true ); 109 } catch (Exception except) { 110 throw new DOMExceptionImpl( DOMExceptionImpl.PDOM_ERR, except.getMessage() ); 111 } 112 return clone; 113 } 114 115 116 public final Node cloneNode( boolean deep ) { 117 TextProxy clone = null; 118 try { 119 clone = (TextProxy)database().createObject( TextImpl.class.getName() ); 120 clone.init( _ownerDocument, getNodeValue() ); 121 cloneInto( clone, deep ); 122 } catch (Exception except) { 123 throw new DOMExceptionImpl( DOMExceptionImpl.PDOM_ERR, except.getMessage() ); 124 } 125 return clone; 126 } 127 128 129 public String toString() { 130 String name; 131 132 name = getNodeName(); 133 if (name.length() > 32) { 134 name = name.substring( 0, 32 ) + ".."; 135 } 136 if (getSystemId() != null) { 137 name = name + "] SYSTEM [" + getSystemId(); 138 } 139 if (getPublicId() != null) { 140 name = name + "] PUBLIC [" + getPublicId(); 141 } 142 return "Notation decl: [" + name + "]"; 143 } 144 145 146 public synchronized void cloneInto( NodeProxy into, boolean deep ) { 147 super.cloneInto( into, deep ); 148 ((NotationProxy)into).setSystemId( _systemID ); 149 ((NotationProxy)into).setPublicId( _publicID ); 150 } 151 152 153 protected final boolean supportsChildern() { 154 return false; 155 } 156 157 158 166 public NotationImpl( DocumentImpl owner, String name, String systemID, String publicID ) { 167 init( owner, name, systemID, publicID ); 168 } 169 170 171 public NotationImpl() { 172 super(); 173 } 174 175 176 public void init( DocumentProxy owner, String name, String systemID, String publicID ) { 177 super.init( owner, name, null, true ); 178 if (_systemID == null && _publicID == null) { 179 throw new IllegalArgumentException ( "Both 'systemID' and 'publicID' are missing." ); 180 } 181 _systemID = systemID; 182 _publicID = publicID; 183 } 184 187 private String _systemID; 188 189 192 private String _publicID; 193 194 } 195 | Popular Tags |