/[classpath]/classpath/gnu/xml/dom/html2/DomHTMLElement.java
ViewVC logotype

Diff of /classpath/gnu/xml/dom/html2/DomHTMLElement.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dog, Wed Mar 9 21:59:33 2005 UTC revision 1.2 by dog, Sat Mar 12 19:53:26 2005 UTC
# Line 101  public abstract class DomHTMLElement Line 101  public abstract class DomHTMLElement
101    protected boolean getBooleanHTMLAttribute(String name)    protected boolean getBooleanHTMLAttribute(String name)
102    {    {
103      String value = getHTMLAttribute(name);      String value = getHTMLAttribute(name);
104      return "true".equals(value);      return value != null;
105    }    }
106    
107    /**    /**
# Line 119  public abstract class DomHTMLElement Line 119  public abstract class DomHTMLElement
119          String attrName = attr.getLocalName();          String attrName = attr.getLocalName();
120          if (attrName.equalsIgnoreCase(name))          if (attrName.equalsIgnoreCase(name))
121            {            {
122              attr.setNodeValue(value);              if (value != null)
123                  {
124                    attr.setNodeValue(value);
125                  }
126                else
127                  {
128                    attrs.removeNamedItem(attr.getNodeName());
129                  }
130              return;              return;
131            }            }
132        }        }
133      // Create a new attribute      if (value != null)
134      DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument();        {
135      // XXX namespace URI for attribute?          // Create a new attribute
136      attr = doc.createAttribute(name);          DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument();
137      attr.setNodeValue(value);          // XXX namespace URI for attribute?
138            attr = doc.createAttribute(name);
139            attr.setNodeValue(value);
140          }
141    }    }
142    
143    protected void setIntHTMLAttribute(String name, int value)    protected void setIntHTMLAttribute(String name, int value)
# Line 137  public abstract class DomHTMLElement Line 147  public abstract class DomHTMLElement
147    
148    protected void setBooleanHTMLAttribute(String name, boolean value)    protected void setBooleanHTMLAttribute(String name, boolean value)
149    {    {
150      setHTMLAttribute(name, value ? "true" : "false");      setHTMLAttribute(name, value ? name : null);
151      }
152    
153      /**
154       * Returns the first parent element with the specified name.
155       */
156      protected Node getParentElement(String name)
157      {
158        for (Node parent = getParentNode(); parent != null;
159             parent = parent.getParentNode())
160          {
161            if (name.equalsIgnoreCase(parent.getLocalName()))
162              {
163                return parent;
164              }
165          }
166        return null;
167    }    }
168    
169    public String getId()    public String getId()

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26