Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo.svg
Class DefaultElement

    java.lang.Object
      com.nwoods.jgo.svg.AbstractNode
          com.nwoods.jgo.svg.DefaultElement

All Implemented Interfaces:
  DomElement, DomNode

public class DefaultElement
extends AbstractNode
implements DomElement

A wrapper class for org.w3c.dom.Element. By implementing the interface DomElement, this class allows the com.nwoods.jgo package to provide methods that manipulate org.w3c.dom.Element objects while not requiring the org.w3c.dom.Element class to be present in order to build com.nwoods.jgo. JGo applications that support serialization to and from SVG XML files require this class.

Constructor Summary
`DefaultElement(org.w3c.dom.Element element)` Create a new DefaultElement

Method Summary
`java.lang.String` | `getAttribute(java.lang.String name)` Retrieves an attribute value by name.
`org.w3c.dom.Element` | `getElement()` Return the org.w3c.dom.Element associated with this DefaultElement
`java.lang.String` | `getLocalName()` Get the local name of the element.
`java.lang.String` | `getNamespaceURI()` Get the NamespaceURI of the element.
`java.lang.String` | `getPrefix()` Get the prefix of the element.
`java.lang.String` | `getSubAttribute(java.lang.String attribute, java.lang.String subAttribute)` Parses the attribute to return the value following "attribute:" and preceding either ";" or the end of the string.
`java.lang.String` | `getTagName()` Get the tag name of the element.
`void` | `setAttribute(java.lang.String name, java.lang.String value)` Adds a new attribute.

Methods inherited from class com.nwoods.jgo.svg.AbstractNode
`appendChild, elementCast, getFirstChild, getFirstChildElement, getFirstChildText, getNextSibling, getNextSiblingElement, getNextSiblingJGoClassElement, getNextSiblingText, getNode, getParentNode, isElement`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.nwoods.jgo.DomNode
`appendChild, elementCast, getFirstChild, getFirstChildElement, getFirstChildText, getNextSibling, getNextSiblingElement, getNextSiblingJGoClassElement, getNextSiblingText, getParentNode, isElement`

Constructor Detail

### DefaultElement

    public DefaultElement(org.w3c.dom.Element element)

  Create a new DefaultElement

Parameters:
  `element` - a org.w3c.dom.Element object

Method Detail

### getElement

    public org.w3c.dom.Element getElement()

  Return the org.w3c.dom.Element associated with this DefaultElement

  Returns:
    the the org.w3c.dom.Node associated with this DefaultElement

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.String value)

  Description copied from interface: `DomElement`
  Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out.

  Specified by:
    `setAttribute` in interface `DomElement`
  Parameters:
    `name` - the name of the attribute to create or alter.
    `value` - the value to set in string form

### getAttribute

    public java.lang.String getAttribute(java.lang.String name)

  Description copied from interface: `DomElement`
  Retrieves an attribute value by name.

  Specified by:
    `getAttribute` in interface `DomElement`
  Parameters:
    `name` - of the attribute to retrieve.
  Returns:
    the attribute value as a string, or the empty string if that attribute does not have a specified or default value

### getSubAttribute

    public java.lang.String getSubAttribute(java.lang.String attribute,
                                            java.lang.String subAttribute)

  Description copied from interface: `DomElement`
  Parses the attribute to return the value following "attribute:" and preceding either ";" or the end of the string.

  Specified by:
    `getSubAttribute` in interface `DomElement`
  Parameters:
    `attribute` - the attribute string to parse.
    `subAttribute` - the subattribute whose value is to be returned.
  Returns:
    the subattributre value as a string, or the empty string if that subattribute does not have a specified value

### getLocalName

    public java.lang.String getLocalName()

  Description copied from interface: `DomElement`
  Get the local name of the element. The local name of the element is the element name minus any namespace previx or URI.

  Specified by:
    `getLocalName` in interface `DomElement`
  Returns:
    the local name of the element.

### getNamespaceURI

    public java.lang.String getNamespaceURI()

  Description copied from interface: `DomElement`
  Get the NamespaceURI of the element.

  Specified by:
    `getNamespaceURI` in interface `DomElement`
  Returns:
    the namespace URI of the element.

### getPrefix

    public java.lang.String getPrefix()

  Description copied from interface: `DomElement`
  Get the prefix of the element. The prefix is the namespace prefix which precedes the colon in an element name.

  Specified by:
    `getPrefix` in interface `DomElement`
  Returns:
    the tag name of the element or null if no prefix.

### getTagName

    public java.lang.String getTagName()

  Description copied from interface: `DomElement`
  Get the tag name of the element.

  Specified by:
    `getTagName` in interface `DomElement`
  Returns:
    the tag name of the element.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD