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 / dom / AttrImpl.class (.txt) next >
Encoding:
Java Class File  |  1999-08-30  |  2.2 KB  |  96 lines

  1. package com.ibm.xml.dom;
  2.  
  3. import org.w3c.dom.Attr;
  4. import org.w3c.dom.DOMException;
  5. import org.w3c.dom.Element;
  6. import org.w3c.dom.Node;
  7.  
  8. public class AttrImpl extends NodeImpl implements Attr {
  9.    static final long serialVersionUID = -4421396439224009670L;
  10.    protected boolean owned;
  11.    protected boolean specified = true;
  12.  
  13.    public AttrImpl(DocumentImpl var1, String var2) {
  14.       super(var1, var2, (String)null);
  15.    }
  16.  
  17.    public short getNodeType() {
  18.       return 2;
  19.    }
  20.  
  21.    public void setNodeValue(String var1) throws DOMException {
  22.       this.setValue(var1);
  23.    }
  24.  
  25.    public String getNodeValue() {
  26.       return this.getValue();
  27.    }
  28.  
  29.    public Node getParentNode() {
  30.       return null;
  31.    }
  32.  
  33.    public String getName() {
  34.       if (super.syncData) {
  35.          ((NodeImpl)this).synchronizeData();
  36.       }
  37.  
  38.       return super.name;
  39.    }
  40.  
  41.    public void setValue(String var1) {
  42.       if (super.readOnly) {
  43.          throw new DOMExceptionImpl((short)7, (String)null);
  44.       } else {
  45.          super.firstChild = null;
  46.          super.lastChild = null;
  47.          super.syncChildren = false;
  48.          if (var1 != null) {
  49.             ((NodeImpl)this).appendChild(super.ownerDocument.createTextNode(var1));
  50.          }
  51.  
  52.          this.specified = true;
  53.          ((NodeImpl)this).changed();
  54.       }
  55.    }
  56.  
  57.    public String getValue() {
  58.       StringBuffer var1 = new StringBuffer();
  59.  
  60.       for(NodeImpl var2 = (NodeImpl)((NodeImpl)this).getFirstChild(); var2 != null; var2 = var2.nextSibling) {
  61.          var1.append(var2.getNodeValue());
  62.       }
  63.  
  64.       return var1.toString();
  65.    }
  66.  
  67.    public boolean getSpecified() {
  68.       if (super.syncData) {
  69.          ((NodeImpl)this).synchronizeData();
  70.       }
  71.  
  72.       return this.specified;
  73.    }
  74.  
  75.    /** @deprecated */
  76.    public Element getElement() {
  77.       return (Element)super.parentNode;
  78.    }
  79.  
  80.    public Element getOwnerElement() {
  81.       return (Element)super.parentNode;
  82.    }
  83.  
  84.    public void setSpecified(boolean var1) {
  85.       if (super.syncData) {
  86.          ((NodeImpl)this).synchronizeData();
  87.       }
  88.  
  89.       this.specified = var1;
  90.    }
  91.  
  92.    public String toString() {
  93.       return this.getName() + "=" + "\"" + this.getValue() + "\"";
  94.    }
  95. }
  96.