Source for gnu.xml.libxmlj.util.StandaloneDocumentType

   1: /* StandaloneDocumentType.java -
   2:    Copyright (C) 2004 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: package gnu.xml.libxmlj.util;
  39: 
  40: import org.w3c.dom.Document;
  41: import org.w3c.dom.DocumentType;
  42: import org.w3c.dom.DOMException;
  43: import org.w3c.dom.NamedNodeMap;
  44: import org.w3c.dom.Node;
  45: import org.w3c.dom.NodeList;
  46: import org.w3c.dom.UserDataHandler;
  47: 
  48: /**
  49:  * A "standalone" document type, i.e. one that isn't attached to a document
  50:  * node.
  51:  * This can be used to create new documents.
  52:  */
  53: public final class StandaloneDocumentType
  54: implements DocumentType
  55: {
  56: 
  57:   private final String name;
  58:   private final String publicId;
  59:   private final String systemId;
  60: 
  61:   public StandaloneDocumentType (String name, String publicId, String systemId)
  62:   {
  63:     this.name = name;
  64:     this.publicId = publicId;
  65:     this.systemId = systemId;
  66:   }
  67: 
  68:   public String getName ()
  69:   {
  70:     return name;
  71:   }
  72: 
  73:   public NamedNodeMap getEntities ()
  74:   {
  75:     // TODO
  76:     return null;
  77:   }
  78: 
  79:   public NamedNodeMap getNotations ()
  80:   {
  81:     // TODO
  82:     return null;
  83:   }
  84: 
  85:   public String getPublicId ()
  86:   {
  87:     return publicId;
  88:   }
  89: 
  90:   public String getSystemId ()
  91:   {
  92:     return systemId;
  93:   }
  94: 
  95:   public String getInternalSubset ()
  96:   {
  97:     return null;
  98:   }
  99: 
 100:   // -- Node --
 101: 
 102:   public String getNodeName ()
 103:   {
 104:     return getName ();
 105:   }
 106: 
 107:   public String getNodeValue ()
 108:     throws DOMException
 109:   {
 110:     return null;
 111:   }
 112: 
 113:   public void setNodeValue (String nodeValue)
 114:     throws DOMException
 115:   {
 116:   }
 117: 
 118:   public short getNodeType ()
 119:   {
 120:     return DOCUMENT_TYPE_NODE;
 121:   }
 122: 
 123:   public Node getParentNode ()
 124:   {
 125:     return null;
 126:   }
 127: 
 128:   public NodeList getChildNodes ()
 129:   {
 130:     return new EmptyNodeList ();
 131:   }
 132: 
 133:   public Node getFirstChild ()
 134:   {
 135:     return null;
 136:   }
 137: 
 138:   public Node getLastChild ()
 139:   {
 140:     return null;
 141:   }
 142: 
 143:   public Node getPreviousSibling ()
 144:   {
 145:     return null;
 146:   }
 147: 
 148:   public Node getNextSibling ()
 149:   {
 150:     return null;
 151:   }
 152: 
 153:   public NamedNodeMap getAttributes ()
 154:   {
 155:     return null;
 156:   }
 157: 
 158:   public Document getOwnerDocument ()
 159:   {
 160:     return null;
 161:   }
 162: 
 163:   public Node insertBefore (Node newChild, Node refChild)
 164:     throws DOMException
 165:   {
 166:     throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 167:   }
 168: 
 169:   public Node replaceChild (Node newChild, Node oldChild)
 170:     throws DOMException
 171:   {
 172:     throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 173:   }
 174: 
 175:   public Node removeChild (Node oldChild)
 176:     throws DOMException
 177:   {
 178:     throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 179:   }
 180: 
 181:   public Node appendChild (Node oldChild)
 182:     throws DOMException
 183:   {
 184:     throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 185:   }
 186: 
 187:   public boolean hasChildNodes ()
 188:   {
 189:     return false;
 190:   }
 191: 
 192:   public Node cloneNode (boolean deep)
 193:   {
 194:     return new StandaloneDocumentType (name, publicId, systemId);
 195:   }
 196: 
 197:   public void normalize ()
 198:   {
 199:   }
 200: 
 201:   public boolean isSupported (String feature, String version)
 202:   {
 203:     return false;
 204:   }
 205: 
 206:   public String getNamespaceURI ()
 207:   {
 208:     return null;
 209:   }
 210: 
 211:   public String getPrefix ()
 212:   {
 213:     return null;
 214:   }
 215: 
 216:   public void setPrefix (String prefix)
 217:   {
 218:     throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 219:   }
 220: 
 221:   public String getLocalName ()
 222:   {
 223:     return getName ();
 224:   }
 225: 
 226:   public boolean hasAttributes ()
 227:   {
 228:     return false;
 229:   }
 230: 
 231:   // DOM Level 3
 232: 
 233:   public String getBaseURI ()
 234:   {
 235:     return null;
 236:   }
 237: 
 238:   public short compareDocumentPosition (Node node)
 239:   {
 240:     return -1;
 241:   }
 242: 
 243:   public String getTextContent ()
 244:   {
 245:     return null;
 246:   }
 247: 
 248:   public void setTextContent (String content)
 249:   {
 250:     throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
 251:   }
 252: 
 253:   public boolean isSameNode (Node other)
 254:   {
 255:     return equals (other);
 256:   }
 257: 
 258:   public String lookupPrefix (String namespace)
 259:   {
 260:     return null;
 261:   }
 262: 
 263:   public boolean isDefaultNamespace (String namespace)
 264:   {
 265:     return false;
 266:   }
 267: 
 268:   public String lookupNamespaceURI (String prefix)
 269:   {
 270:     return null;
 271:   }
 272: 
 273:   public boolean isEqualNode (Node other)
 274:   {
 275:     return equals (other);
 276:   }
 277: 
 278:   public Object getFeature (String feature, String version)
 279:   {
 280:     return null;
 281:   }
 282: 
 283:   public Object setUserData (String name, Object value,
 284:                              UserDataHandler handler)
 285:   {
 286:     return null;
 287:   }
 288: 
 289:   public Object getUserData (String name)
 290:   {
 291:     return null;
 292:   }
 293: 
 294: }