electric.xml
Class Attribute

java.lang.Object
  extended byelectric.xml.Node
      extended byelectric.xml.Attribute
All Implemented Interfaces:
org.w3c.dom.Attr, IDOMConstants, INamed, IQNamed, IXMLConstants, org.w3c.dom.Node, java.io.Serializable

public final class Attribute
extends Node
implements IQNamed, org.w3c.dom.Attr

Attribute represents an XML attribute. Once constructed, you can change its value but not its name. When you add an Attribute to an Element, the attribute's name is automatically resolved. If you add/remove an Attribute that declares a namespace, the Element's namespaces are automatically updated.

Author:
webMethods
See Also:
Serialized Form

Field Summary
 
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
Attribute()
           
Attribute(Attribute attribute)
          Construct a copy of the specified attribute.
Attribute(java.lang.String name, java.lang.String value)
          Construct an Attribute with the specified name and value.
Attribute(java.lang.String prefix, java.lang.String name, java.lang.String value)
          Construct an Attribute with the specified namespace prefix, name and value.
 
Method Summary
 java.lang.Object clone()
          Return a clone of this Attribute.
 org.w3c.dom.Node cloneNode(boolean deep)
          Return a clone of this attribute.
 boolean equals(java.lang.Object object)
          Return true if the object is an Attribute with the same name and value as myself.
 Element getElement()
          Return the element that I'm an attribute of.
 java.lang.String getLocalName()
          Return my local name.
 java.lang.String getName()
          Return my name.
 java.lang.String getNamespace()
          Return my namespace, or null if there is none.
 java.lang.String getNamespaceURI()
          Return the namespace URI of this node, or null if it is unspecified.
 java.lang.String getNodeName()
          Return the name of this attribute.
 short getNodeType()
          Return ATTRIBUTE_NODE.
 java.lang.String getNodeValue()
          Return the value of this attribute.
 org.w3c.dom.Document getOwnerDocument()
          Return the Element node this attribute is attached to or null if this attribute is not in use.
 org.w3c.dom.Element getOwnerElement()
          Return the Element node this attribute is attached to or null if this attribute is not in use.
 java.lang.String getPrefix()
          Return my prefix, or null if there is none.
 java.lang.String getQName()
          Return my qualified name.
static char getQuoteCharacter()
           
 boolean getRaw()
          Return my raw mode.
 boolean getSpecified()
          If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false
 java.lang.String getValue()
          Return my value.
 int hashCode()
          Return my hash code.
 boolean hasName(java.lang.String namespace, java.lang.String name)
          Return true if my namespace and name match the specified values.
 void initialize()
           
 void initialize(java.lang.String prefix, java.lang.String name, java.lang.String value)
           
 boolean isNamespace()
          Return true if I am a namespace declaration.
 void read(NodeReader reader)
           
 void setNodeValue(java.lang.String nodeValue)
          Set the value of this attribute.
 void setPrefix(java.lang.String prefix)
          Set the namespace prefix of this attribute.
static void setQuoteCharacter(char quoteCharacter)
           
 void setRaw(boolean flag)
          Set my raw mode.
 void setValue(java.lang.String value)
          Set my value.
 int size()
           
 java.lang.String toString()
          Return my description.
 void write(NodeWriter writer)
          Write myself to the specified writer.
 
Methods inherited from class electric.xml.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNextSiblingNode, getNode, getNode, getNodes, getParentNode, getPreviousSibling, getPreviousSiblingNode, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, remove, removeChild, replaceChild, setNextSiblingNode, setPreviousSiblingNode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getParentNode, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild
 

Constructor Detail

Attribute

public Attribute()

Attribute

public Attribute(java.lang.String name,
                 java.lang.String value)
Construct an Attribute with the specified name and value.

Parameters:
name - The name.
value - The value.

Attribute

public Attribute(java.lang.String prefix,
                 java.lang.String name,
                 java.lang.String value)
Construct an Attribute with the specified namespace prefix, name and value.

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

Attribute

public Attribute(Attribute attribute)
Construct a copy of the specified attribute.

Parameters:
attribute - The Attribute to copy.
Method Detail

equals

public boolean equals(java.lang.Object object)
Return true if the object is an Attribute with the same name and value as myself.

Parameters:
object - The object to compare.

hashCode

public int hashCode()
Return my hash code.


toString

public java.lang.String toString()
Return my description.


clone

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


getLocalName

public java.lang.String getLocalName()
Return my local name.

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

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 prefix, or null if there is none.

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

getNamespace

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

Specified by:
getNamespace in interface IQNamed

isNamespace

public boolean isNamespace()
Return true if I am a namespace declaration.


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.

getValue

public java.lang.String getValue()
Return my value.

Specified by:
getValue in interface org.w3c.dom.Attr

setValue

public void setValue(java.lang.String value)
Set my value.

Specified by:
setValue in interface org.w3c.dom.Attr
Parameters:
value - The new value.

initialize

public void initialize(java.lang.String prefix,
                       java.lang.String name,
                       java.lang.String value)
Parameters:
prefix -
name -
value -

initialize

public void initialize()

getElement

public Element getElement()
Return the element that I'm an attribute of.


setRaw

public void setRaw(boolean flag)
Set my raw mode. If true, subsitutions are disabled when I am written.

Parameters:
flag - The new raw value.

getRaw

public boolean getRaw()
Return my raw mode.


size

public int size()
Overrides:
size in class Node

read

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

write

public void write(NodeWriter writer)
           throws java.io.IOException
Write myself to the specified writer.

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

getNodeType

public short getNodeType()
Return ATTRIBUTE_NODE.

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

getNodeName

public java.lang.String getNodeName()
Return the name of this attribute.

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

getNodeValue

public java.lang.String getNodeValue()
Return the value of this attribute.

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

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
Set the value of this attribute.

Specified by:
setNodeValue in interface org.w3c.dom.Node
Overrides:
setNodeValue in class Node
Parameters:
nodeValue - The new value.

setPrefix

public void setPrefix(java.lang.String prefix)
Set the namespace prefix of this attribute.

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

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Return a clone of this attribute.

Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in class Node
Parameters:
deep - If true, return a deep clone.

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Return the Element node this attribute is attached to or null if this attribute is not in use.

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

getNamespaceURI

public java.lang.String getNamespaceURI()
Return the namespace URI of this node, or null if it is unspecified.

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

getOwnerElement

public org.w3c.dom.Element getOwnerElement()
Return the Element node this attribute is attached to or null if this attribute is not in use.

Specified by:
getOwnerElement in interface org.w3c.dom.Attr

getSpecified

public boolean getSpecified()
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false

Specified by:
getSpecified in interface org.w3c.dom.Attr

getQuoteCharacter

public static char getQuoteCharacter()

setQuoteCharacter

public static void setQuoteCharacter(char quoteCharacter)
Parameters:
quoteCharacter -


copyright© 2001-2004 by webMethods All Rights Reserved.