home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2004 May / DPPCPRO0504.ISO / May / Seatools / SeaTools.iso / tools / en / webhelp / webhelp.jar / BsscXML / BsscXMLElement.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-04-17  |  2.2 KB  |  101 lines

  1. package BsscXML;
  2.  
  3. import java.util.Hashtable;
  4. import java.util.Vector;
  5.  
  6. public class BsscXMLElement implements IBsscXMLElementBuilder, IBsscXMLElementReader {
  7.    private BsscXMLElement m_oParent = null;
  8.    private Vector m_vChildren = null;
  9.    private Hashtable m_hAttr = null;
  10.    private String m_sValue = null;
  11.    private String m_sName = null;
  12.  
  13.    public int findChild(IBsscXMLElementReader var1) {
  14.       return var1 instanceof BsscXMLElement ? this.m_vChildren.indexOf((BsscXMLElement)var1) : -1;
  15.    }
  16.  
  17.    public IBsscXMLElementReader getChild(int var1) {
  18.       IBsscXMLElementReader var2 = null;
  19.  
  20.       try {
  21.          var2 = (IBsscXMLElementReader)this.m_vChildren.elementAt(var1);
  22.       } catch (ArrayIndexOutOfBoundsException var3) {
  23.       }
  24.  
  25.       return var2;
  26.    }
  27.  
  28.    public void setAttribute(String var1, String var2) {
  29.       this.m_hAttr.put(var1, var2);
  30.    }
  31.  
  32.    public void setValue(String var1) {
  33.       this.m_sValue = var1;
  34.    }
  35.  
  36.    public String getValue() {
  37.       return this.m_sValue;
  38.    }
  39.  
  40.    public String getAttribute(String var1) {
  41.       return (String)this.m_hAttr.get(var1);
  42.    }
  43.  
  44.    public IBsscXMLElementReader getNextSibling() {
  45.       if (this.m_oParent != null) {
  46.          int var1 = this.m_oParent.findChild(this.m_oParent);
  47.          return this.m_oParent.getChild(var1 + 1);
  48.       } else {
  49.          return null;
  50.       }
  51.    }
  52.  
  53.    public void setParent(IBsscXMLElementBuilder var1) throws BsscXMLException {
  54.       if (var1 instanceof BsscXMLElement) {
  55.          if (this.m_oParent == null) {
  56.             this.m_oParent = (BsscXMLElement)var1;
  57.          } else {
  58.             throw new BsscXMLException("Internal Error!");
  59.          }
  60.       } else {
  61.          throw new BsscXMLException("Type Mismatch!");
  62.       }
  63.    }
  64.  
  65.    public IBsscXMLElementReader getParent() {
  66.       return this.m_oParent;
  67.    }
  68.  
  69.    public BsscXMLElement(String var1) {
  70.       this.m_sName = var1;
  71.       this.m_vChildren = new Vector();
  72.       this.m_hAttr = new Hashtable();
  73.       this.m_sValue = "";
  74.    }
  75.  
  76.    public IBsscXMLElementReader getPrevSibling() {
  77.       if (this.m_oParent != null) {
  78.          int var1 = this.m_oParent.findChild(this.m_oParent);
  79.          return this.m_oParent.getChild(var1 - 1);
  80.       } else {
  81.          return null;
  82.       }
  83.    }
  84.  
  85.    public boolean checkName(String var1) {
  86.       return var1 != null && var1.length() != 0 ? var1.equals(this.m_sName) : true;
  87.    }
  88.  
  89.    public void addChild(IBsscXMLElementBuilder var1) throws BsscXMLException {
  90.       if (var1 instanceof BsscXMLElement) {
  91.          this.m_vChildren.addElement((BsscXMLElement)var1);
  92.       } else {
  93.          throw new BsscXMLException("Type Mismatch!");
  94.       }
  95.    }
  96.  
  97.    public String getName() {
  98.       return this.m_sName;
  99.    }
  100. }
  101.