electric.xml
Class Element

java.lang.Object
  extended byelectric.xml.Node
      extended byelectric.xml.Child
          extended byelectric.xml.Parent
              extended byelectric.xml.Element
All Implemented Interfaces:
java.lang.Cloneable, org.w3c.dom.Element, IDOMConstants, INamed, INamespaceContext, IQNamed, IXMLConstants, org.w3c.dom.Node, java.io.Serializable
Direct Known Subclasses:
HTML, WML

public class Element
extends Parent
implements IQNamed, INamespaceContext, org.w3c.dom.Element

Element represents an XML element, and includes methods for manipulating attributes and child nodes. Some of the accessors support a useful subset of XPath.

Author:
webMethods
See Also:
Serialized Form

Field Summary
 
Fields inherited from class electric.xml.Parent
children
 
Fields inherited from class electric.xml.Child
parent
 
Fields inherited from class electric.xml.Node
list, next, prev
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface electric.xml.IXMLConstants
ATTLIST_START, ATTLIST_STOP, CDATA, CDATA_START, CDATA_STOP, CLOSE_TAG, COLON, COMMENT_START, COMMENT_STOP, DOCTYPE_START, DOCTYPE_STOP, ELEMENTDECL_START, ELEMENTDECL_STOP, ENCODING, ENTITYDECL_START, ENTITYDECL_STOP, ID, ID_CASE, INSTRUCTION_START, INSTRUCTION_STOP, NEGATIVE_INFINITY, NOT_A_NUMBER, NOTATIONDECL_START, NOTATIONDECL_STOP, NULL, OPEN_TAG, POSITIVE_INFINITY, PUBLIC, SPECIALS, STANDALONE, SUBSTITUTES, SYSTEM, UNDEFINED, VERSION, XML, XML_NAMESPACE, XMLDECL_START, XMLDECL_STOP, XMLNS, XMLNS_NAMESPACE
 
Fields inherited from interface electric.xml.IDOMConstants
CDATA_SECTION_NAME, COMMENT_NAME, CORE, DOCUMENT_FRAGMENT_NAME, DOCUMENT_NAME, HIERARCHY_REQUEST_ERR, TEXT_NAME
 
Constructor Summary
Element()
          Construct an Element with name set to "UNDEFINED" and no parent.
Element(Element element)
          Construct a copy of the specified Element.
Element(java.lang.String name)
          Construct an Element with the specified name and no parent.
Element(java.lang.String prefix, java.lang.String name, java.lang.String namespace)
          Construct an Element with the specified prefix, name and namespace.
 
Method Summary
protected  void addNamespacePrefixes(java.lang.String namespace, java.util.Vector prefixes, java.util.Vector matches)
          Add all the prefixes that map to a particular namespace value in my context to the specified vector.
 Element addText(java.lang.String text)
          Add a Text node with the specified text.
 Element addText(Text text)
          Add a Text node with the specified text.
 java.lang.Object clone()
          Return a clone of this Element.
 java.lang.String getAttribute(java.lang.String name)
          Return my first Attribute node with the specified name, or null if I have none.
 org.w3c.dom.Attr getAttributeNode(java.lang.String name)
           
 org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 Attribute getAttributeObject(IXPath xpath)
          Return my first Attribute node with the specified xpath, or null if I have none.
 Attribute getAttributeObject(java.lang.String name)
          Return my first Attribute node with the specified name, or null if I have none.
 Attribute getAttributeObject(java.lang.String namespace, java.lang.String name)
          Return my first Attribute node with the specified namespace and name, or null if I have none.
 Attributes getAttributeObjects()
          Return an enumeration over my Attributes.
 org.w3c.dom.NamedNodeMap getAttributes()
          Return a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise
 Attributes getAttributes(IXPath xpath)
          Return my Attribute nodes with the specified xpath.
 java.lang.String getAttributeValue(IXPath xpath)
          Return the value of my first Attribute node with the specified xpath, or null if I have none.
 java.lang.String getAttributeValue(java.lang.String name)
          Return the value of my first Attribute node with the specified name, or null if I have none.
 java.lang.String getAttributeValue(java.lang.String namespace, java.lang.String name)
          Return the value of my first Attribute node with the specified namespace and name, or null if I have none.
 boolean getBoolean()
          Return the element text converted to a boolean.
 boolean getBoolean(java.lang.String name)
          Return the element text of the named child converted to a boolean.
 boolean getBoolean(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a boolean.
 byte getByte()
          Return the element text converted to a byte.
 byte getByte(java.lang.String name)
          Return the element text of the named child converted to a byte.
 byte getByte(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a byte.
 char getChar()
          Return the element text converted to a char.
 char getChar(java.lang.String name)
          Return the element text of the named child converted to a char.
 char getChar(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a char.
 java.lang.String getDefaultNamespace()
          Return the value of the default namespace, or null if there is none.
 double getDouble()
          Return the element text converted to a double.
 double getDouble(java.lang.String name)
          Return the element text of the named child converted to a double.
 double getDouble(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a double.
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 Element getElementWithId(java.lang.String value)
          Return the element whose "id" attribute is equal to the specified value, or null if none exists.
 float getFloat()
          Return the element text converted to a float.
 float getFloat(java.lang.String name)
          Return the element text of the named child converted to a float.
 float getFloat(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a float.
 java.util.Hashtable getIds()
           
 int getInt()
          Return the element text converted to an int.
 int getInt(java.lang.String name)
          Return the element text of the named child converted to an int.
 int getInt(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to an int.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 long getLong()
          Return the element text converted to a long.
 long getLong(java.lang.String name)
          Return the element text of the named child converted to a long.
 long getLong(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a long.
 java.lang.String getName()
          Return my name.
 java.lang.String getNamespace()
          Return my namespace, or null if there is none.
 java.lang.String getNamespace(java.lang.String prefix)
          Return the value of the namespace with the specified prefix, or null if there is none.
 java.lang.String getNamespacePrefix(java.lang.String namespace)
          Return a prefix that maps to a particular namespace value, searching from the current element up through its parents.
 java.lang.String[] getNamespacePrefixes(java.lang.String namespace)
          Return an array of all the prefixes that map to a particular namespace value, searching from the current element up through its parents.
 java.util.Dictionary getNamespaces()
          Return namespaces declared directly on this element as a Dictionary of prefix -> value.
 java.lang.String getNamespaceURI()
          Return the namespace URI of this node, or null if it is unspecified.
 java.lang.String getNodeName()
          If there is a prefix, return prefix:name, otherwise return name.
 short getNodeType()
          Return ELEMENT_NODE.
 Element getParentElement()
          Return my parent element.
static java.lang.String[] getParts(java.lang.String qualifiedName)
           
 java.lang.String getPrefix()
          Return my namespace prefix, or null if there is none.
 java.lang.String getPrefix(java.lang.String namespace)
           
 java.lang.String getPrefix(java.lang.String namespace, java.lang.String preferredPrefix)
           
 java.lang.String getPrefixedQName(java.lang.String namespace, java.lang.String name)
          returns a prefixed qname (like xsd:string) given a namespace and a name, where the prefix is within the context of this element.
 java.lang.String getQName()
          Return my qualified name.
 java.lang.String getQName(java.lang.String string)
          Return the fully qualified version of the specified name, with any prefix expanded to the full namespace value.
 Element getRoot()
          Return the root of my parent, or null if I have no parent.
 short getShort()
          Return the element text converted to a short.
 short getShort(java.lang.String name)
          Return the element text of the named child converted to a short.
 short getShort(java.lang.String namespace, java.lang.String name)
          Return the element text of the named child converted to a short.
 java.lang.String getString()
          Return the trimmed string of my first Text node, or null if I have none.
 java.lang.String getString(java.lang.String name)
          Return the trimmed string of my first Text node whose element has the specified name, or null if I have none.
 java.lang.String getString(java.lang.String namespace, java.lang.String name)
          Return the trimmed string of my first Text node whose element has the specified namespace and name, or null if I have none.
 java.lang.String getTagName()
           
 Text getText()
          Return my first Text node, or null if I have none.
 Text getText(IXPath xpath)
          Return my first Text node whose element has the specified xpath, or null if I have none.
 Text getText(java.lang.String name)
          Return my first Text node whose element has the specified name, or null if I have none.
 Text getText(java.lang.String namespace, java.lang.String name)
          Return my first Text node whose element has the specified namespace and name, or null if I have none.
 java.lang.String getTextString()
          Return the string of my first Text node, or null if I have none.
 java.lang.String getTextString(IXPath xpath)
          Return the string of my first Text node whose element has the specified xpath, or null if I have none.
 java.lang.String getTextString(java.lang.String name)
          Return the string of my first Text node whose element has the specified name, or null if I have none.
 java.lang.String getTextString(java.lang.String namespace, java.lang.String name)
          Return the string of my first Text node whose element has the specified namespace and name, or null if I have none.
 java.lang.String getTrimTextString()
          Return the trimmed string of my first Text node, or null if I have none.
 java.lang.String getTrimTextString(IXPath xpath)
          Return the trimmed string of my first Text node whose element has the specified xpath, or null if I have none.
 java.lang.String getTrimTextString(java.lang.String name)
          Return the trimmed string of my first Text node whose element has the specified name, or null if I have none.
 java.lang.String getTrimTextString(java.lang.String namespace, java.lang.String name)
          Return the trimmed string of my first Text node whose element has the specified namespace and name, or null if I have none.
 boolean hasAttribute(java.lang.String name)
           
 boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 boolean hasAttributes()
          Return true if I have one or more Attributes.
 boolean hasName(java.lang.String name)
          Return true if my name match the specified value.
 boolean hasName(java.lang.String namespace, java.lang.String name)
          Return true if my namespace and name match the specified values.
 boolean hasText()
          Return true if I have at least one Text node.
 Element insertText(java.lang.String text)
          Insert a Text node with the specified text.
 Element insertText(Text text)
          Insert a Text node with the specified text.
 void read(NodeReader reader)
           
 void readAttributes(NodeReader reader)
          Parse my attributes from the specified NodeReader.
 void readChildren(NodeReader reader)
          Parse my children from the specified NodeReader.
 Attribute removeAttribute(IXPath xpath)
          Remove and return the attribute with the specified xpath, or return null if none was found.
 void removeAttribute(java.lang.String name)
          Remove the attribute with the specified name if one exists.
 Attribute removeAttribute(java.lang.String namespace, java.lang.String name)
          Remove and return the attribute with the specified namespace and name, or return null if none was found.
 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
           
 void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 Attributes removeAttributes(IXPath xpath)
          Remove and return the attributes with the specified xpath.
 boolean removeNamespace(java.lang.String prefix)
          Remove the namespace with the specified prefix.
 Element setAttribute(Attribute attribute)
          Add the specified attribute, overwriting any previous value if present.
 void setAttribute(java.lang.String name, java.lang.String value)
          Add an attribute with the specified name and value, overwriting any previous value if present.
 Element setAttribute(java.lang.String prefix, java.lang.String name, java.lang.String value)
          Add an attribute with the specified namespace prefix, name and value, overwriting any previous value if present.
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
           
 org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
           
 void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
           
 void setBoolean(boolean value)
          Set the element text to the specified value as a string.
 void setBoolean(java.lang.String name, boolean value)
          Set the element text to the specified value as a string.
 void setBoolean(java.lang.String prefix, java.lang.String name, boolean value)
          Set the element text to the specified value as a string.
 void setByte(byte value)
          Set the element text to the specified value as a string.
 void setByte(java.lang.String name, byte value)
          Set the element text to the specified value as a string.
 void setByte(java.lang.String prefix, java.lang.String name, byte value)
          Set the element text to the specified value as a string.
 void setChar(char value)
          Set the element text to the specified value as a string.
 void setChar(java.lang.String name, char value)
          Set the element text to the specified value as a string.
 void setChar(java.lang.String prefix, java.lang.String name, char value)
          Set the element text to the specified value as a string.
 void setDouble(double value)
          Set the element text to the specified value as a string.
 void setDouble(java.lang.String name, double value)
          Set the element text to the specified value as a string.
 void setDouble(java.lang.String prefix, java.lang.String name, double value)
          Set the element text to the specified value as a string.
 void setFloat(float value)
          Set the element text to the specified value as a string.
 void setFloat(java.lang.String name, float value)
          Set the element text to the specified value as a string.
 void setFloat(java.lang.String prefix, java.lang.String name, float value)
          Set the element text to the specified value as a string.
 void setInt(int value)
          Set the element text to the specified value as a string.
 void setInt(java.lang.String name, int value)
          Set the element text to the specified value as a string.
 void setInt(java.lang.String prefix, java.lang.String name, int value)
          Set the element text to the specified value as a string.
 void setLong(long value)
          Set the element text to the specified value as a string.
 void setLong(java.lang.String name, long value)
          Set the element text to the specified value as a string.
 void setLong(java.lang.String prefix, java.lang.String name, long value)
          Set the element text to the specified value as a string.
 Element setName(java.lang.String name)
          Set my name.
 Element setName(java.lang.String prefix, java.lang.String name)
          Set my name.
 void setName(java.lang.String prefix, java.lang.String name, java.lang.String namespace)
           
 void setNamespace(java.lang.String prefix, java.lang.String value)
          Add a new namespace with the specified prefix and value, overwriting any previous value if present.
 Element setNextSibling(Element element)
          Set my next sibling to the specified element.
 Element setNextSibling(java.lang.String name)
          Set my next sibling to a new Element with the specified name.
 Element setNextSibling(java.lang.String prefix, java.lang.String name)
          Set my next sibling to a new Element with the specified namespace prefix and name.
 void setPrefix(java.lang.String prefix)
          Set my namespace prefix to the specified value.
 Element setPreviousSibling(Element element)
          Set my previous sibling to the specified element.
 Element setPreviousSibling(java.lang.String name)
          Set my previous sibling to a new Element with the specified name.
 Element setPreviousSibling(java.lang.String prefix, java.lang.String name)
          Set my previous sibling to a new Element with the specified name.
 void setShort(short value)
          Set the element text to the specified value as a string.
 void setShort(java.lang.String name, short value)
          Set the element text to the specified value as a string.
 void setShort(java.lang.String prefix, java.lang.String name, short value)
          Set the element text to the specified value as a string.
 void setString(java.lang.String value)
          If text is not null, set my first Text node to have the specified text, adding one if necessary.
 void setString(java.lang.String name, java.lang.String value)
          Apply setString( value ) to the named child, creating the child if necessary.
 void setString(java.lang.String prefix, java.lang.String name, java.lang.String value)
          Apply setString( value ) to the named child, creating the child if necessary.
 Element setText(java.lang.String text)
          If text is not null, set my first Text node to have the specified text, adding one if necessary.
 void setText(java.lang.String name, java.lang.String text)
          Apply setText( text ) to the named child, creating the child if necessary.
 void setText(java.lang.String prefix, java.lang.String name, java.lang.String text)
          Apply setText( text ) to the named child, creating the child if necessary.
 Element setText(Text text)
          If text is not null, set my first Text node to have the specified text, adding one if necessary.
 int size()
           
 void write(NodeWriter writer)
          Write myself to the specified writer starting at the specified indent level.
 void writeChildren(NodeWriter writer)
          Write my children to the specified writer starting at the specified indent level.
 
Methods inherited from class electric.xml.Parent
addChild, addComment, addElement, addElement, addElement, addElement, appendChild, getChildNodes, getChildren, getElement, getElement, getElement, getElementAt, getElements, getElements, getElements, getElements, getFirstChild, getFirstElement, getLastChild, hasChildNodes, hasChildren, hasElement, hasElements, insertBefore, insertChild, insertComment, insertElement, insertElement, insertElement, insertElement, needElement, needElement, removeChild, removeChildren, removeElement, removeElement, removeElement, removeElementAt, removeElements, removeElements, removeElements, removeElements, replaceChild, setElement, setElement, setElementAt
 
Methods inherited from class electric.xml.Child
cloneNode, getByteArray, getByteArray, getByteArray, getBytes, getBytes, getBytes, getDocument, getNextSiblingChild, getOwnerDocument, getParent, getParentNode, getPreviousSiblingChild, replaceWith, setNextSiblingChild, setParent, setPreviousSiblingChild, toString, toString, write, write, write
 
Methods inherited from class electric.xml.Node
getNextSibling, getNextSiblingNode, getNode, getNode, getNodes, getNodeValue, getPreviousSibling, getPreviousSiblingNode, isSupported, normalize, remove, setNextSiblingNode, setNodeValue, setPreviousSiblingNode
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue
 

Constructor Detail

Element

public Element()
Construct an Element with name set to "UNDEFINED" and no parent.


Element

public Element(java.lang.String name)
Construct an Element with the specified name and no parent.

Parameters:
name - The name.

Element

public Element(java.lang.String prefix,
               java.lang.String name,
               java.lang.String namespace)
Construct an Element with the specified prefix, name and namespace. Care should be taken when using this constructor, because the validity of the prefix cannot be checked since the Element is not part of a valid XML document.

Parameters:
name - The prefix.
namespace - The namespace.

Element

public Element(Element element)
Construct a copy of the specified Element.

Parameters:
element - The Element to copy.
Method Detail

clone

public java.lang.Object clone()
Return a clone of this Element.

Specified by:
clone in class Child

getRoot

public Element getRoot()
Return the root of my parent, or null if I have no parent.

Overrides:
getRoot in class Child

getParentElement

public Element getParentElement()
Return my parent element.


getName

public java.lang.String getName()
Return my name.

Specified by:
getName in interface INamed

getQName

public java.lang.String getQName()
Return my qualified name.


getPrefix

public java.lang.String getPrefix()
Return my namespace prefix, or null if there is none.

Specified by:
getPrefix in interface org.w3c.dom.Node
Overrides:
getPrefix in class Node

getPrefix

public java.lang.String getPrefix(java.lang.String namespace)
Parameters:
namespace -

getPrefix

public java.lang.String getPrefix(java.lang.String namespace,
                                  java.lang.String preferredPrefix)
Parameters:
namespace -
preferredPrefix -

getPrefixedQName

public java.lang.String getPrefixedQName(java.lang.String namespace,
                                         java.lang.String name)
returns a prefixed qname (like xsd:string) given a namespace and a name, where the prefix is within the context of this element. (Useful for things like xsi:type or soapenc:arrayType or qname references within schema.)

Parameters:
namespace -
name -

getNamespace

public java.lang.String getNamespace()
Return my namespace, or null if there is none.

Specified by:
getNamespace in interface IQNamed

setName

public Element setName(java.lang.String name)
Set my name.

Parameters:
name - The new name value.
Returns:
Myself, to allow cascading.

setName

public Element setName(java.lang.String prefix,
                       java.lang.String name)
                throws NamespaceException
Set my name.

Parameters:
prefix - The namespace prefix.
name - The new name value.
Returns:
Myself, to allow cascading.
Throws:
NamespaceException - If a namespace prefix could not be resolved.

setName

public void setName(java.lang.String prefix,
                    java.lang.String name,
                    java.lang.String namespace)
Parameters:
prefix -
name -
namespace -

getQName

public java.lang.String getQName(java.lang.String string)
                          throws NamespaceException
Return the fully qualified version of the specified name, with any prefix expanded to the full namespace value.

Parameters:
string - The original name.
Throws:
NamespaceException

hasName

public boolean hasName(java.lang.String namespace,
                       java.lang.String name)
Return true if my namespace and name match the specified values.

Parameters:
namespace - The namespace.
name - The name.

hasName

public boolean hasName(java.lang.String name)
Return true if my name match the specified value.

Parameters:
name - The name.

hasText

public boolean hasText()
Return true if I have at least one Text node.


getText

public Text getText()
Return my first Text node, or null if I have none.


getText

public Text getText(java.lang.String name)
Return my first Text node whose element has the specified name, or null if I have none.

Parameters:
name - The name.

getText

public Text getText(java.lang.String namespace,
                    java.lang.String name)
Return my first Text node whose element has the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

getText

public Text getText(IXPath xpath)
Return my first Text node whose element has the specified xpath, or null if I have none.

Parameters:
xpath - The XPath.

getTextString

public java.lang.String getTextString()
Return the string of my first Text node, or null if I have none.


getTextString

public java.lang.String getTextString(java.lang.String name)
Return the string of my first Text node whose element has the specified name, or null if I have none.

Parameters:
name - The name.

getTextString

public java.lang.String getTextString(java.lang.String namespace,
                                      java.lang.String name)
Return the string of my first Text node whose element has the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

getTextString

public java.lang.String getTextString(IXPath xpath)
Return the string of my first Text node whose element has the specified xpath, or null if I have none.

Parameters:
xpath - The XPath.

getTrimTextString

public java.lang.String getTrimTextString()
Return the trimmed string of my first Text node, or null if I have none.


getTrimTextString

public java.lang.String getTrimTextString(java.lang.String name)
Return the trimmed string of my first Text node whose element has the specified name, or null if I have none.

Parameters:
name - The name.

getTrimTextString

public java.lang.String getTrimTextString(java.lang.String namespace,
                                          java.lang.String name)
Return the trimmed string of my first Text node whose element has the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

getTrimTextString

public java.lang.String getTrimTextString(IXPath xpath)
Return the trimmed string of my first Text node whose element has the specified xpath, or null if I have none.

Parameters:
xpath - The XPath.

setText

public Element setText(java.lang.String text)
If text is not null, set my first Text node to have the specified text, adding one if necessary. If text is null, remove my first Text node if I have one.

Parameters:
text - The text.
Returns:
Myself, to allow cascading.

setText

public void setText(java.lang.String name,
                    java.lang.String text)
Apply setText( text ) to the named child, creating the child if necessary.

Parameters:
name - The child element name.
text - The text.

setText

public void setText(java.lang.String prefix,
                    java.lang.String name,
                    java.lang.String text)
Apply setText( text ) to the named child, creating the child if necessary.

Parameters:
prefix - The namespace prefix.
name - The child element name.
text - The text.

setText

public Element setText(Text text)
If text is not null, set my first Text node to have the specified text, adding one if necessary. If text is null, remove my first Text node if I have one.

Parameters:
text - The Text.
Returns:
Myself, to allow cascading.

addText

public Element addText(java.lang.String text)
Add a Text node with the specified text.

Parameters:
text - The text.
Returns:
Myself, to allow cascading.

addText

public Element addText(Text text)
Add a Text node with the specified text.

Parameters:
text - The Text.
Returns:
Myself, to allow cascading.

insertText

public Element insertText(java.lang.String text)
Insert a Text node with the specified text.

Parameters:
text - The text.
Returns:
Myself, to allow cascading.

insertText

public Element insertText(Text text)
Insert a Text node with the specified text.

Parameters:
text - The Text.
Returns:
Myself, to allow cascading.

getString

public java.lang.String getString()
Return the trimmed string of my first Text node, or null if I have none.


getString

public java.lang.String getString(java.lang.String name)
Return the trimmed string of my first Text node whose element has the specified name, or null if I have none.

Parameters:
name - The name.

getString

public java.lang.String getString(java.lang.String namespace,
                                  java.lang.String name)
Return the trimmed string of my first Text node whose element has the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

setString

public void setString(java.lang.String value)
If text is not null, set my first Text node to have the specified text, adding one if necessary. If text is null, remove my first Text node if I have one.

Parameters:
value - The value.

setString

public void setString(java.lang.String name,
                      java.lang.String value)
Apply setString( value ) to the named child, creating the child if necessary.

Parameters:
name - The name of the child.
value - The text for the child.

setString

public void setString(java.lang.String prefix,
                      java.lang.String name,
                      java.lang.String value)
Apply setString( value ) to the named child, creating the child if necessary.

Parameters:
prefix - The prefix of the child.
name - The name of the child.
value - The text for the child.

getBoolean

public boolean getBoolean()
                   throws java.lang.NumberFormatException
Return the element text converted to a boolean.

Throws:
java.lang.NumberFormatException - If an error occurs.

getBoolean

public boolean getBoolean(java.lang.String name)
                   throws java.lang.NumberFormatException
Return the element text of the named child converted to a boolean.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getBoolean

public boolean getBoolean(java.lang.String namespace,
                          java.lang.String name)
                   throws java.lang.NumberFormatException
Return the element text of the named child converted to a boolean.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setBoolean

public void setBoolean(boolean value)
Set the element text to the specified value as a string.

Parameters:
value -

setBoolean

public void setBoolean(java.lang.String name,
                       boolean value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setBoolean

public void setBoolean(java.lang.String prefix,
                       java.lang.String name,
                       boolean value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getByte

public byte getByte()
             throws java.lang.NumberFormatException
Return the element text converted to a byte.

Throws:
java.lang.NumberFormatException - If an error occurs.

getByte

public byte getByte(java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a byte.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getByte

public byte getByte(java.lang.String namespace,
                    java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a byte.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setByte

public void setByte(byte value)
Set the element text to the specified value as a string.

Parameters:
value -

setByte

public void setByte(java.lang.String name,
                    byte value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setByte

public void setByte(java.lang.String prefix,
                    java.lang.String name,
                    byte value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getChar

public char getChar()
             throws java.lang.NumberFormatException
Return the element text converted to a char.

Throws:
java.lang.NumberFormatException - If an error occurs.

getChar

public char getChar(java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a char.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getChar

public char getChar(java.lang.String namespace,
                    java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a char.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setChar

public void setChar(char value)
Set the element text to the specified value as a string.

Parameters:
value -

setChar

public void setChar(java.lang.String name,
                    char value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setChar

public void setChar(java.lang.String prefix,
                    java.lang.String name,
                    char value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getShort

public short getShort()
               throws java.lang.NumberFormatException
Return the element text converted to a short.

Throws:
java.lang.NumberFormatException - If an error occurs.

getShort

public short getShort(java.lang.String name)
               throws java.lang.NumberFormatException
Return the element text of the named child converted to a short.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getShort

public short getShort(java.lang.String namespace,
                      java.lang.String name)
               throws java.lang.NumberFormatException
Return the element text of the named child converted to a short.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setShort

public void setShort(short value)
Set the element text to the specified value as a string.

Parameters:
value -

setShort

public void setShort(java.lang.String name,
                     short value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setShort

public void setShort(java.lang.String prefix,
                     java.lang.String name,
                     short value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getInt

public int getInt()
           throws java.lang.NumberFormatException
Return the element text converted to an int.

Throws:
java.lang.NumberFormatException - If an error occurs.

getInt

public int getInt(java.lang.String name)
           throws java.lang.NumberFormatException
Return the element text of the named child converted to an int.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getInt

public int getInt(java.lang.String namespace,
                  java.lang.String name)
           throws java.lang.NumberFormatException
Return the element text of the named child converted to an int.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setInt

public void setInt(int value)
Set the element text to the specified value as a string.

Parameters:
value -

setInt

public void setInt(java.lang.String name,
                   int value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setInt

public void setInt(java.lang.String prefix,
                   java.lang.String name,
                   int value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getLong

public long getLong()
             throws java.lang.NumberFormatException
Return the element text converted to a long.

Throws:
java.lang.NumberFormatException - If an error occurs.

getLong

public long getLong(java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a long.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getLong

public long getLong(java.lang.String namespace,
                    java.lang.String name)
             throws java.lang.NumberFormatException
Return the element text of the named child converted to a long.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setLong

public void setLong(long value)
Set the element text to the specified value as a string.

Parameters:
value -

setLong

public void setLong(java.lang.String name,
                    long value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setLong

public void setLong(java.lang.String prefix,
                    java.lang.String name,
                    long value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getFloat

public float getFloat()
               throws java.lang.NumberFormatException
Return the element text converted to a float.

Throws:
java.lang.NumberFormatException - If an error occurs.

getFloat

public float getFloat(java.lang.String name)
               throws java.lang.NumberFormatException
Return the element text of the named child converted to a float.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getFloat

public float getFloat(java.lang.String namespace,
                      java.lang.String name)
               throws java.lang.NumberFormatException
Return the element text of the named child converted to a float.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setFloat

public void setFloat(float value)
Set the element text to the specified value as a string.

Parameters:
value -

setFloat

public void setFloat(java.lang.String name,
                     float value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setFloat

public void setFloat(java.lang.String prefix,
                     java.lang.String name,
                     float value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

getDouble

public double getDouble()
                 throws java.lang.NumberFormatException
Return the element text converted to a double.

Throws:
java.lang.NumberFormatException - If an error occurs.

getDouble

public double getDouble(java.lang.String name)
                 throws java.lang.NumberFormatException
Return the element text of the named child converted to a double.

Parameters:
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

getDouble

public double getDouble(java.lang.String namespace,
                        java.lang.String name)
                 throws java.lang.NumberFormatException
Return the element text of the named child converted to a double.

Parameters:
namespace - The namespace.
name - The name.
Throws:
java.lang.NumberFormatException - If an error occurs.

setDouble

public void setDouble(double value)
Set the element text to the specified value as a string.

Parameters:
value -

setDouble

public void setDouble(java.lang.String name,
                      double value)
Set the element text to the specified value as a string.

Parameters:
name - The child element name.
value -

setDouble

public void setDouble(java.lang.String prefix,
                      java.lang.String name,
                      double value)
Set the element text to the specified value as a string.

Parameters:
prefix - The namespace prefix.
name - The child element name.
value -

hasAttributes

public boolean hasAttributes()
Return true if I have one or more Attributes.

Specified by:
hasAttributes in interface org.w3c.dom.Node
Overrides:
hasAttributes in class Node

getAttributeObjects

public Attributes getAttributeObjects()
Return an enumeration over my Attributes.


getAttributeObject

public Attribute getAttributeObject(java.lang.String name)
Return my first Attribute node with the specified name, or null if I have none.

Parameters:
name - The name.

getAttributeObject

public Attribute getAttributeObject(java.lang.String namespace,
                                    java.lang.String name)
Return my first Attribute node with the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

getAttributeObject

public Attribute getAttributeObject(IXPath xpath)
Return my first Attribute node with the specified xpath, or null if I have none.

Parameters:
xpath - The XPath.

getAttributes

public Attributes getAttributes(IXPath xpath)
Return my Attribute nodes with the specified xpath.

Parameters:
xpath - The XPath.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Return the value of my first Attribute node with the specified name, or null if I have none.

Parameters:
name - The name.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String namespace,
                                          java.lang.String name)
Return the value of my first Attribute node with the specified namespace and name, or null if I have none.

Parameters:
namespace - The namespace.
name - The name.

getAttributeValue

public java.lang.String getAttributeValue(IXPath xpath)
Return the value of my first Attribute node with the specified xpath, or null if I have none.

Parameters:
xpath - The XPath.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Add an attribute with the specified name and value, overwriting any previous value if present.

Specified by:
setAttribute in interface org.w3c.dom.Element
Parameters:
name - The name.
value - The value.

setAttribute

public Element setAttribute(java.lang.String prefix,
                            java.lang.String name,
                            java.lang.String value)
Add an attribute with the specified namespace prefix, name and value, overwriting any previous value if present.

Parameters:
prefix - The namespace prefix.
name - The name.
value - The value.
Returns:
Myself, to allow cascading.

setAttribute

public Element setAttribute(Attribute attribute)
                     throws NamespaceException
Add the specified attribute, overwriting any previous value if present.

Parameters:
attribute - The attribute.
Returns:
Myself, to allow cascading.
Throws:
NamespaceException - If the attribute name could not be resolved.

removeAttribute

public void removeAttribute(java.lang.String name)
Remove the attribute with the specified name if one exists.

Specified by:
removeAttribute in interface org.w3c.dom.Element
Parameters:
name - The name.

removeAttribute

public Attribute removeAttribute(java.lang.String namespace,
                                 java.lang.String name)
Remove and return the attribute with the specified namespace and name, or return null if none was found.

Parameters:
namespace - The namespace.
name - The name.

removeAttribute

public Attribute removeAttribute(IXPath xpath)
Remove and return the attribute with the specified xpath, or return null if none was found.

Parameters:
xpath - The XPath.

removeAttributes

public Attributes removeAttributes(IXPath xpath)
Remove and return the attributes with the specified xpath.

Parameters:
xpath - The XPath.

setNextSibling

public Element setNextSibling(java.lang.String name)
Set my next sibling to a new Element with the specified name.

Parameters:
name - The name.
Returns:
The new Element.

setNextSibling

public Element setNextSibling(java.lang.String prefix,
                              java.lang.String name)
Set my next sibling to a new Element with the specified namespace prefix and name.

Parameters:
prefix - The namespace prefix.
name - The name.
Returns:
The new Element.

setNextSibling

public Element setNextSibling(Element element)
Set my next sibling to the specified element.

Parameters:
element - The element.
Returns:
The element.

setPreviousSibling

public Element setPreviousSibling(java.lang.String name)
Set my previous sibling to a new Element with the specified name.

Parameters:
name - The name.
Returns:
The new Element.

setPreviousSibling

public Element setPreviousSibling(java.lang.String prefix,
                                  java.lang.String name)
Set my previous sibling to a new Element with the specified name.

Parameters:
prefix - The namespace prefix.
name - The name.
Returns:
The new Element.

setPreviousSibling

public Element setPreviousSibling(Element element)
Set my previous sibling to the specified element.

Parameters:
element - The element.
Returns:
The element.

getNamespaces

public java.util.Dictionary getNamespaces()
Return namespaces declared directly on this element as a Dictionary of prefix -> value. This call will not return namespaces inherited from a parent.


getNamespace

public java.lang.String getNamespace(java.lang.String prefix)
Return the value of the namespace with the specified prefix, or null if there is none. If the prefix is the empty string "", return the default namespace. This operation searches up the element hierarchy starting at this element.

Specified by:
getNamespace in interface INamespaceContext
Overrides:
getNamespace in class Parent
Parameters:
prefix - The prefix.

getDefaultNamespace

public java.lang.String getDefaultNamespace()
Return the value of the default namespace, or null if there is none. This operation searches up the element hierarchy starting at this element.


getNamespacePrefix

public java.lang.String getNamespacePrefix(java.lang.String namespace)
Return a prefix that maps to a particular namespace value, searching from the current element up through its parents. Return null if none is found.

Overrides:
getNamespacePrefix in class Parent
Parameters:
namespace - The namespace to match.

getNamespacePrefixes

public java.lang.String[] getNamespacePrefixes(java.lang.String namespace)
Return an array of all the prefixes that map to a particular namespace value, searching from the current element up through its parents.

Parameters:
namespace - The namespace to match.

addNamespacePrefixes

protected void addNamespacePrefixes(java.lang.String namespace,
                                    java.util.Vector prefixes,
                                    java.util.Vector matches)
Add all the prefixes that map to a particular namespace value in my context to the specified vector.

Overrides:
addNamespacePrefixes in class Parent
Parameters:
namespace - The namespace to match
prefixes - All the prefixes so far.
matches - All the prefixes that matched.

setNamespace

public void setNamespace(java.lang.String prefix,
                         java.lang.String value)
                  throws NamespaceException
Add a new namespace with the specified prefix and value, overwriting any previous value if present. To add a default namespace, set the prefix to an empty string. This operation automatically sets a corresponding xmlns attribute.

Specified by:
setNamespace in interface INamespaceContext
Parameters:
prefix - The prefix
value - The value
Throws:
NamespaceException

removeNamespace

public boolean removeNamespace(java.lang.String prefix)
Remove the namespace with the specified prefix. To remove a default namespace, set the prefix to an empty string.

Parameters:
prefix - The namespace to remove.

getElementWithId

public Element getElementWithId(java.lang.String value)
Return the element whose "id" attribute is equal to the specified value, or null if none exists.

Overrides:
getElementWithId in class Parent
Parameters:
value -

getIds

public java.util.Hashtable getIds()

size

public int size()
Overrides:
size in class Parent

read

public void read(NodeReader reader)
          throws java.io.IOException,
                 NamespaceException
Overrides:
read in class Node
Parameters:
reader -
Throws:
java.io.IOException
NamespaceException

readAttributes

public void readAttributes(NodeReader reader)
                    throws java.io.IOException,
                           NamespaceException
Parse my attributes from the specified NodeReader.

Parameters:
reader - The NodeReader.
Throws:
java.io.IOException - If an I/O exception occurs during parsing.
NamespaceException - If a name could not be resolved.

readChildren

public void readChildren(NodeReader reader)
                  throws java.io.IOException,
                         NamespaceException
Parse my children from the specified NodeReader.

Parameters:
reader - The NodeReader.
Throws:
java.io.IOException - If an I/O exception occurs.
NamespaceException - If a name could not be resolved.

write

public void write(NodeWriter writer)
           throws java.io.IOException
Write myself to the specified writer starting at the specified indent level. If the indent level is -1, no indentation will occur, otherwise the indent level increases by two at each child node.

Overrides:
write in class Node
Parameters:
writer - The nodeWriter.
Throws:
java.io.IOException - If an I/O exception occurs.

writeChildren

public void writeChildren(NodeWriter writer)
                   throws java.io.IOException
Write my children to the specified writer starting at the specified indent level. If the indent level is -1, no indentation will occur, otherwise the indent level increases by two at each child node.

Parameters:
writer - The nodeWriter.
Throws:
java.io.IOException - If an I/O exception occurs.

getNodeType

public short getNodeType()
Return ELEMENT_NODE.

Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in class Node

getNodeName

public java.lang.String getNodeName()
If there is a prefix, return prefix:name, otherwise return name.

Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class Node

setPrefix

public void setPrefix(java.lang.String prefix)
Set my namespace prefix to the specified value.

Specified by:
setPrefix in interface org.w3c.dom.Node
Overrides:
setPrefix in class Node
Parameters:
prefix - The new namespace prefix.

getTagName

public java.lang.String getTagName()
Specified by:
getTagName in interface org.w3c.dom.Element

getLocalName

public java.lang.String getLocalName()
Description copied from class: Node
Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

Specified by:
getLocalName in interface org.w3c.dom.Node
Overrides:
getLocalName in class Node

getNamespaceURI

public java.lang.String getNamespaceURI()
Description copied from class: Node
Return the namespace URI of this node, or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. Per the Namespaces in XML Specification an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

Specified by:
getNamespaceURI in interface org.w3c.dom.Node
Overrides:
getNamespaceURI in class Node

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Description copied from class: Node
Return a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise

Specified by:
getAttributes in interface org.w3c.dom.Node
Overrides:
getAttributes in class Node

hasAttribute

public boolean hasAttribute(java.lang.String name)
Specified by:
hasAttribute in interface org.w3c.dom.Element
Parameters:
name -

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Return my first Attribute node with the specified name, or null if I have none.

Specified by:
getAttribute in interface org.w3c.dom.Element
Parameters:
name - The name.

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
Specified by:
getAttributeNode in interface org.w3c.dom.Element
Parameters:
name -

getAttributeNodeNS

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                           java.lang.String localName)
Specified by:
getAttributeNodeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
localName -

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
Specified by:
hasAttributeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
localName -

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
Specified by:
getAttributeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
localName -

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
Specified by:
getElementsByTagName in interface org.w3c.dom.Element
Parameters:
name -

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)
Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
localName -

removeAttributeNS

public void removeAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
Specified by:
removeAttributeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
localName -

removeAttributeNode

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
Specified by:
removeAttributeNode in interface org.w3c.dom.Element
Parameters:
oldAttr -

setAttributeNodeNS

public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
Specified by:
setAttributeNodeNS in interface org.w3c.dom.Element
Parameters:
newAttr -

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
Specified by:
setAttributeNode in interface org.w3c.dom.Element
Parameters:
newAttr -

setAttributeNS

public void setAttributeNS(java.lang.String namespaceURI,
                           java.lang.String qualifiedName,
                           java.lang.String value)
Specified by:
setAttributeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI -
qualifiedName -
value -

getParts

public static java.lang.String[] getParts(java.lang.String qualifiedName)
Parameters:
qualifiedName -


copyright© 2001-2004 by webMethods All Rights Reserved.