|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.idom.impl.AbstractItem
org.zkoss.idom.Attribute
public class Attribute
The iDOM attribute.
Design decision: Attribute is also a item. The reason is it simplifies the use of XPath. An XPath might return either elements or attributes, so...
Element,
Serialized Form| Field Summary | |
|---|---|
protected java.lang.String |
_lname
The local name. |
protected Namespace |
_ns
The namespace. |
protected Item |
_owner
The owner item. |
protected java.lang.String |
_value
The value. |
| Fields inherited from interface org.w3c.dom.Node |
|---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
| Fields inherited from interface org.zkoss.idom.Item |
|---|
FIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVE |
| Constructor Summary | |
|---|---|
protected |
Attribute()
Constructor. |
|
Attribute(Namespace ns,
java.lang.String lname,
java.lang.String value)
Constructor. |
|
Attribute(java.lang.String lname,
java.lang.String value)
Constructor. |
|
Attribute(java.lang.String nsURI,
java.lang.String tname,
java.lang.String value)
Constructor. |
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones this object (a deep cloning not including contents contained in Textual nodes). |
Item |
detach()
Detach the attribute from its owner, if any. |
Document |
getDocument()
Gets the document that owns this attribute. |
java.lang.String |
getLocalName()
Gets the local name of this item. |
java.lang.String |
getName()
Gets the name of the item. |
Namespace |
getNamespace()
Gets the namespace. |
java.lang.String |
getNamespaceURI()
|
short |
getNodeType()
|
Item |
getOwner()
Gets the item that owns this attribute. |
org.w3c.dom.Document |
getOwnerDocument()
|
org.w3c.dom.Element |
getOwnerElement()
|
java.lang.String |
getPrefix()
|
org.w3c.dom.TypeInfo |
getSchemaTypeInfo()
|
boolean |
getSpecified()
|
java.lang.String |
getTagName()
Gets the tag name of this item. |
java.lang.String |
getText()
Gets the text of this item, or null if it is neither Textual
nor Element. |
java.lang.String |
getValue()
Gets the value of this attribute. |
boolean |
isId()
|
void |
setLocalName(java.lang.String lname)
Sets the local name of this attribute. |
void |
setName(java.lang.String tname)
Sets the name of the item. |
void |
setNamespace(Namespace ns)
Sets the namespace. |
void |
setNamespace(java.lang.String prefix,
java.lang.String nsURI)
Sets the namespace. |
void |
setOwner(Item owner)
Sets the item that owns this attribute. |
void |
setParent(Item parent)
|
void |
setPrefix(java.lang.String prefix)
Sets the namespace prefix of this attribute. |
void |
setTagName(java.lang.String tname)
Sets the tag name. |
void |
setText(java.lang.String text)
Sets the text of this item. |
void |
setValue(java.lang.String value)
Sets the value of this attribute. |
java.lang.String |
toString()
|
| Methods inherited from class org.zkoss.idom.impl.AbstractItem |
|---|
appendChild, cloneNode, compareDocumentPosition, equals, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocator, getNextSibling, getNodeName, getNodeValue, getParent, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, match, normalize, removeChild, replaceChild, setLocator, setNodeValue, setParent, setTextContent, setUserData |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeValue, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setTextContent, setUserData |
| Field Detail |
|---|
protected Namespace _ns
protected Item _owner
protected java.lang.String _lname
protected java.lang.String _value
| Constructor Detail |
|---|
public Attribute(java.lang.String nsURI,
java.lang.String tname,
java.lang.String value)
Note: According to W3/DOM, the namespace of attributes must have a prefix if the uri is not empty.
nsURI - the namespace URItname - the tag name
public Attribute(Namespace ns,
java.lang.String lname,
java.lang.String value)
ns - the namespacelname - the local name
public Attribute(java.lang.String lname,
java.lang.String value)
protected Attribute()
| Method Detail |
|---|
public final java.lang.String getValue()
getValue in interface org.w3c.dom.Attrpublic final void setValue(java.lang.String value)
setValue in interface org.w3c.dom.Attrvalue - the new value; null is considered as emptypublic final Item getOwner()
public final void setOwner(Item owner)
DO NOT call this method. It is used internally. For user's point of view, the owner item is maintained automatically, so user never needs to update it.
public final void setNamespace(java.lang.String prefix,
java.lang.String nsURI)
public final void setNamespace(Namespace ns)
According W3C/DOM, unlike element, an attribute doesn't allow a namespace that has an URI but without a prefix.
setNamespace in interface Namespaceablepublic final Namespace getNamespace()
Namespaceable
getNamespace in interface Namespaceablepublic final java.lang.String getTagName()
NamespaceableTo get the local name (the name without prefix), Namespaceable.getLocalName could be used.
getTagName in interface Namespaceablepublic final void setTagName(java.lang.String tname)
Changing a name improperly might cause replicated attribute names which won't be detected by this method.
setTagName in interface Namespaceablepublic final java.lang.String getLocalName()
NamespaceableTo get the tag name (the name with prefix), Namespaceable.getTagName could be used.
getLocalName in interface org.w3c.dom.NodegetLocalName in interface NamespaceablegetLocalName in class AbstractItempublic final void setLocalName(java.lang.String lname)
Changing a name improperly might cause replicated attribute names which won't be detected by this method.
setLocalName in interface Namespaceablepublic final java.lang.String getName()
Item
getName in interface org.w3c.dom.AttrgetName in interface ItemNamespaceable.getTagName()public final void setName(java.lang.String tname)
Item
setName in interface ItemsetName in class AbstractItemNamespaceable.setTagName(java.lang.String)public final java.lang.String getText()
ItemTextual
nor Element.
For Element, the text is the concatenation of all its textual
children, including Text, CDATA, and Binary.
Besides String-type value, some item, e.g., Binary, allows any type of objects. Caller could test whether a item implements the Binable interface, and use Binable.getValue instead. For binable vertices, getText is actually getValue().toString().
The returned value is neither trimmed nor normalized.
getText in interface ItemgetText in class AbstractItempublic final void setText(java.lang.String text)
Item
setText in interface ItemsetText in class AbstractItempublic final Document getDocument()
getDocument in interface ItemgetDocument in class AbstractItempublic Item detach()
detach in interface Itemdetach in class AbstractItempublic void setParent(Item parent)
public final short getNodeType()
getNodeType in interface org.w3c.dom.Nodepublic final org.w3c.dom.Document getOwnerDocument()
getOwnerDocument in interface org.w3c.dom.NodegetOwnerDocument in class AbstractItempublic final java.lang.String getNamespaceURI()
getNamespaceURI in interface org.w3c.dom.NodegetNamespaceURI in class AbstractItempublic final java.lang.String getPrefix()
getPrefix in interface org.w3c.dom.NodegetPrefix in class AbstractItempublic final void setPrefix(java.lang.String prefix)
Changing a prefix improperly might cause replicated attribute names which won't be detected by this method.
setPrefix in interface org.w3c.dom.NodesetPrefix in class AbstractItempublic org.w3c.dom.TypeInfo getSchemaTypeInfo()
getSchemaTypeInfo in interface org.w3c.dom.Attrpublic boolean isId()
isId in interface org.w3c.dom.Attrpublic final boolean getSpecified()
getSpecified in interface org.w3c.dom.Attrpublic final org.w3c.dom.Element getOwnerElement()
getOwnerElement in interface org.w3c.dom.Attrpublic final java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object clone()
AbstractItem
clone in interface Itemclone in class AbstractItem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||