home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / parser / DTD$HashNamedNodeMap.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  1.6 KB  |  55 lines

  1. package com.ibm.xml.parser;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Hashtable;
  5. import org.w3c.dom.NamedNodeMap;
  6. import org.w3c.dom.Node;
  7.  
  8. class DTD$HashNamedNodeMap implements NamedNodeMap {
  9.    Hashtable hash;
  10.    Node[] data;
  11.  
  12.    DTD$HashNamedNodeMap(Hashtable var1) {
  13.       this.hash = var1;
  14.       this.makeArray();
  15.    }
  16.  
  17.    public Node getNamedItem(String var1) {
  18.       Object var2 = this.hash.get(var1);
  19.       if (var2 == null) {
  20.          return null;
  21.       } else if (var2 instanceof TXNotation) {
  22.          return ((TXNotation)var2).getNotationImpl();
  23.       } else if (var2 instanceof EntityDecl) {
  24.          return ((EntityDecl)var2).getEntityImpl();
  25.       } else {
  26.          throw new RuntimeException("XML4J internal error: non-supported hash.");
  27.       }
  28.    }
  29.  
  30.    public Node setNamedItem(Node var1) {
  31.       throw new TXDOMException((short)7, "This NamedNodeMap is read-only.");
  32.    }
  33.  
  34.    public Node removeNamedItem(String var1) {
  35.       throw new TXDOMException((short)7, "This NamedNodeMap is read-only.");
  36.    }
  37.  
  38.    public Node item(int var1) {
  39.       return this.data[var1];
  40.    }
  41.  
  42.    public int getLength() {
  43.       return this.data.length;
  44.    }
  45.  
  46.    private void makeArray() {
  47.       this.data = new Node[this.hash.size()];
  48.       Enumeration var1 = this.hash.elements();
  49.  
  50.       for(int var2 = 0; var1.hasMoreElements(); this.data[var2++] = (Node)var1.nextElement()) {
  51.       }
  52.  
  53.    }
  54. }
  55.