| java.lang.Object org.zkoss.idom.impl.AbstractItem org.zkoss.idom.impl.AbstractGroup org.zkoss.idom.Element
Inner Class :protected class AttrMap implements NamedNodeMap | |
Method Summary | |
final public boolean | addDeclaredNamespace(Namespace ns) Adds a namespace to the namespace declaration. | public void | clearModified(boolean includingDescendant) Clear the modification flag. | public Item | clone(boolean preserveModified) | final public String | getAttribute(String tname) | final public int | getAttributeIndex(int indexFrom, String namespace, String name, int mode) | final public int | getAttributeIndex(int indexFrom, String tname) | final public Attribute | getAttributeItem(String namespace, String name, int mode) | final public Attribute | getAttributeItem(String tname) | final public List | getAttributeItems() | final public String | getAttributeNS(String nsURI, String lname) | final public Attr | getAttributeNode(String tname) | final public Attr | getAttributeNodeNS(String nsURI, String lname) | final public String | getAttributeValue(String namespace, String name, int mode) | final public String | getAttributeValue(String tname) | final public List | getAttributes(String namespace, String name, int mode) | final public NamedNodeMap | getAttributes() | final public Object | getContent() Gets the content of this element.
The content of an element is the first Binary or Text child of
the element. | final public Object | getContent(String path) Returns the content of the child element with the giving path, or
null if the content is null or the child element doesn't exist.
Note that there might be more than one child with the same path
in an idom tree; this method simply picks the first one that matchs and
returns its content. | final public Collection | getDeclaredNamespaces() Returns namespace declared on this element.
It is not a "live" representation. | final public NodeList | getElementsByTagName(String tname) | final public NodeList | getElementsByTagNameNS(String nsURI, String lname) | final public String | getLocalName() | final public String | getName() Gets the tag name of the element -- the name with prefix. | final public Namespace | getNamespace(String prefix) Returns the Namespace in scope on this element for the given
prefix (this involves searching up the tree, so the results depend
on the current location of the element), or null if not found.
If prefix is empty, it searches for the "default" namespace
in scope. | final public Namespace | getNamespace() | final public String | getNamespaceURI() | final public short | getNodeType() | final public String | getNodeValue() Always null. | final public String | getPrefix() | public TypeInfo | getSchemaTypeInfo() | final public String | getTagName() | final public String | getText() Returns the catenation of
Textual children; never null.
Note: both <tag/> and <tag></tag> returns an
empty string. | final public String | getText(boolean trim) Returns the catenation of
Textual children; never null. | final public boolean | hasAttribute(String tname) | final public boolean | hasAttributeNS(String nsURI, String lname) | final public boolean | hasAttributes() | final public boolean | hasContent(String path) Tests whether the child element with the giving path exists. | final public boolean | isAttributeModificationAware() | final public boolean | isRootElement() Tests whether this element is the root element of
the owning document. | protected List | newAttrArray() Creates an empty list of attributes. | final public void | removeAttribute(String tname) | final public void | removeAttributeNS(String nsURI, String lname) | final public Attr | removeAttributeNode(Attr oldAttr) | final public Object | removeContent(String path) Removes the content of the child element with the giving path,
and the child element itself if no other child.
Unlike
Element.setContent(String,Object) with null,
the child element identified by path will be detached if it has no
other child (but the content). | final public Attribute | setAttribute(Attribute attr) | final public void | setAttribute(String tname, String value) | final public void | setAttributeModificationAware(boolean aware) | final public void | setAttributeNS(String nsURI, String tname, String value) | final public Attr | setAttributeNode(Attr newAttr) | final public Attr | setAttributeNodeNS(Attr newAttr) | final public Attribute | setAttributeValue(String tname, String value) | final public Object | setContent(Object obj) Sets the content of this element.
All existent Binary or Text children of this element are removed
first. | final public Object | setContent(String path, Object obj) Sets the content of the child element with the giving path.
Note that there might be more than one child with the same path
in an idom tree; this method simply pick one that matchs and set
its content (see
Element.setContent(Object) ).
The content of an element is a special feature of iDOM.
Like a Map, it is designed to let developers use names (in a path-like
format) to access objects. | public void | setIdAttribute(String name, boolean isId) | public void | setIdAttributeNS(String namespaceURI, String localName, boolean isId) | public void | setIdAttributeNode(Attr idAttr, boolean isId) | final public void | setLocalName(String lname) | final public void | setName(String tname) Sets the tag name of the element. | final public void | setNamespace(Namespace ns) Sets the namespace. | final public void | setNamespace(String prefix, String nsURI) Sets the namespace. | final public void | setPrefix(String prefix) | final public void | setTagName(String tname) | final public String | toString() |
_addNamespaces | protected Map _addNamespaces(Code) | | Additional namespaces. May be null
|
_attrModAware | boolean _attrModAware(Code) | | Whether it is aware of the attribute modification.
|
_attrs | protected List _attrs(Code) | | The attributes. May be null.
|
Element | public Element(String nsURI, String tname)(Code) | | Constructor.
Parameters: nsURI - the namespace URI Parameters: tname - the tag name |
Element | public Element(Namespace ns, String lname)(Code) | | Constructor.
Parameters: ns - the namespace; if null, the default namespace is assumed(not necessary Namespace.NO_NAMESPACE). Parameters: lname - the local name |
Element | protected Element()(Code) | | Constructor.
Unlike other constructors, it doesn't set the modification flag.
|
addDeclaredNamespace | final public boolean addDeclaredNamespace(Namespace ns)(Code) | | Adds a namespace to the namespace declaration.
true if the namespace is added exception: DOMException - if the name space with the same prefixalready exists but with different URI |
clearModified | public void clearModified(boolean includingDescendant)(Code) | | Clear the modification flag.
Note: if both includingDescendant and
Element.isAttributeModificationAware are true, attributes'
modified flags are cleaned.
|
clone | public Item clone(boolean preserveModified)(Code) | | |
getAttributeIndex | final public int getAttributeIndex(int indexFrom, String namespace, String name, int mode)(Code) | | |
getAttributeIndex | final public int getAttributeIndex(int indexFrom, String tname)(Code) | | |
getAttributeItems | final public List getAttributeItems()(Code) | | |
getContent | final public Object getContent()(Code) | | Gets the content of this element.
The content of an element is the first Binary or Text child of
the element. Each element can has zero or one content.
Note:
Element.getText returns the catenation of all Text
children, not just the first one.
the content of this element; null if no such child See Also: Element.getContent(String) |
getContent | final public Object getContent(String path)(Code) | | Returns the content of the child element with the giving path, or
null if the content is null or the child element doesn't exist.
Note that there might be more than one child with the same path
in an idom tree; this method simply picks the first one that matchs and
returns its content. To access certain one, you might use [n] to
[@attr = value] specify which one to access.
To know whether the child element exists or conent is null,
use
Element.hasContent .
The content of an element is a special feature of iDOM.
Like a Map, it is designed to let developers use names (in a path-like
format) to access objects. See
Element.setContent(String,Object) .
Like Unix path, the giving name could use '/' to catenate a series
of child elements.
An empty path denotes this element itself. Leading, ending
and consecutive '/' will be ignored.
Example:
Object o = element.getContent("abc/def");
String s = Objects.toString(element.getContent("ab/cd"));
element.setContent("t:ab/cd/f:ef", new Integer(10));
TODO: support [n] and [@attr = value]
Parameters: path - a path; e.g., "b", "a/b", "t:a/t:b" See Also: Element.getContent() |
getDeclaredNamespaces | final public Collection getDeclaredNamespaces()(Code) | | Returns namespace declared on this element.
It is not a "live" representation. Also, it is read-only.
Note: Namespace.equals compares namespace's URI. However,
the distinction here is the prefix, because it is mainly for
getNamespace(prefix).
the namespace declarations. |
getName | final public String getName()(Code) | | Gets the tag name of the element -- the name with prefix.
To get the local name, use getLocalName.
|
getNamespace | final public Namespace getNamespace(String prefix)(Code) | | Returns the Namespace in scope on this element for the given
prefix (this involves searching up the tree, so the results depend
on the current location of the element), or null if not found.
If prefix is empty, it searches for the "default" namespace
in scope. Thus, to search for attribute's namespace, caller
have to skip this one and use NO_NAMESPACE.
(due XML, an attribute without prefix is NO_NAMESPACE)
Parameters: prefix - namespace prefix to look up; null for empty |
getNodeType | final public short getNodeType()(Code) | | |
getNodeValue | final public String getNodeValue()(Code) | | Always null. Unlike other nodes, it is not the same as getText.
|
getText | final public String getText()(Code) | | Returns the catenation of
Textual children; never null.
Note: both <tag/> and <tag></tag> returns an
empty string. To tell the difference, check the number of children.
See Also: Element.getText(boolean) |
getText | final public String getText(boolean trim)(Code) | | Returns the catenation of
Textual children; never null.
Parameters: trim - whether to trim before returning See Also: Element.getText() |
hasAttribute | final public boolean hasAttribute(String tname)(Code) | | |
hasAttributes | final public boolean hasAttributes()(Code) | | |
hasContent | final public boolean hasContent(String path)(Code) | | Tests whether the child element with the giving path exists. Note that
there might be more than one child with the same path in an idom tree;
this method simply tell you that "yes", at least on such path exist.
To get the content, use
Element.getContent(String) .
|
isAttributeModificationAware | final public boolean isAttributeModificationAware()(Code) | | |
isRootElement | final public boolean isRootElement()(Code) | | Tests whether this element is the root element of
the owning document.
Note: false is returned if it doesn't has any parent.
|
newAttrArray | protected List newAttrArray()(Code) | | Creates an empty list of attributes.
|
removeAttribute | final public void removeAttribute(String tname)(Code) | | |
removeAttributeNode | final public Attr removeAttributeNode(Attr oldAttr)(Code) | | |
removeContent | final public Object removeContent(String path)(Code) | | Removes the content of the child element with the giving path,
and the child element itself if no other child.
Unlike
Element.setContent(String,Object) with null,
the child element identified by path will be detached if it has no
other child (but the content). So does its parent
excluding this element. Thus, removeContent(path)
could undo setContent(path, v).
the previous content See Also: Element.setContent(String,Object) |
setAttributeModificationAware | final public void setAttributeModificationAware(boolean aware)(Code) | | |
setAttributeNode | final public Attr setAttributeNode(Attr newAttr)(Code) | | |
setAttributeNodeNS | final public Attr setAttributeNodeNS(Attr newAttr)(Code) | | |
setContent | final public Object setContent(Object obj)(Code) | | Sets the content of this element.
All existent Binary or Text children of this element are removed
first. If the object is a String, a Text item is created to hold
it. Otherwise, a Binary item is created to hold it.
Non-Binary/Text children are preserved.
If obj is a
Item or an array/collection of
Item ,
this method will add them as child vertices rather than
being the content.
Moreever, if the first item of the array/collection is
Item ,
it is assumed to be all valid component to being has valid vertices.
If not, an exception is thrown.
Thus, getContent might not return the object being set by setContent.
Parameters: obj - the object to set; null is OK the previous content See Also: Element.getContent() |
setContent | final public Object setContent(String path, Object obj)(Code) | | Sets the content of the child element with the giving path.
Note that there might be more than one child with the same path
in an idom tree; this method simply pick one that matchs and set
its content (see
Element.setContent(Object) ).
The content of an element is a special feature of iDOM.
Like a Map, it is designed to let developers use names (in a path-like
format) to access objects. See
Element.getContent(String) .
Like Unix path, the giving name could use '/' to catenate a series
of child elements.
An empty path denotes this element itself. Leading, ending
and consecutive '/' will be ignored.
If any element in the path is not found, it will be created
automatically.
Parameters: path - a path; e.g., "b", "a/b", "t:a/t:b" Parameters: obj - the object to set; null is acceptable the previous content See Also: Element.setContent(Object) See Also: Element.removeContent See Also: Element.hasContent |
setLocalName | final public void setLocalName(String lname)(Code) | | |
setName | final public void setName(String tname)(Code) | | Sets the tag name of the element.
It will affect the local name and the namespace's prefix.
|
setNamespace | final public void setNamespace(Namespace ns)(Code) | | Sets the namespace.
If ns is null, the default namespace is assumed (not necessary
Namespace.NO_NAMESPACE .
According W3C/DOM, unlike element, an attribute doesn't allow
a namespace that has an URI but without a prefix.
|
setNamespace | final public void setNamespace(String prefix, String nsURI)(Code) | | Sets the namespace.
|
Methods inherited from org.zkoss.idom.impl.AbstractGroup | final public boolean anyElement()(Code)(Java Doc) final public Node appendChild(Node newChild)(Code)(Java Doc) public void clearModified(boolean includingDescendant)(Code)(Java Doc) public Item clone(boolean preserveModified)(Code)(Java Doc) final public int coalesce(boolean recursive)(Code)(Java Doc) final public List detachChildren()(Code)(Java Doc) final public NodeList getChildNodes()(Code)(Java Doc) final public List getChildren()(Code)(Java Doc) final public Element getElement(String namespace, String name, int mode)(Code)(Java Doc) final public Element getElement(String tname)(Code)(Java Doc) final public int getElementIndex(int indexFrom, String namespace, String name, int mode)(Code)(Java Doc) final public int getElementIndex(int indexFrom, String tname)(Code)(Java Doc) final public Set getElementNames()(Code)(Java Doc) final public String getElementValue(String namespace, String name, int mode, boolean trim)(Code)(Java Doc) final public String getElementValue(String tname, boolean trim)(Code)(Java Doc) final public List getElements()(Code)(Java Doc) final public List getElements(String namespace, String name, int mode)(Code)(Java Doc) final public List getElements(String tname)(Code)(Java Doc) final public Node getFirstChild()(Code)(Java Doc) final public Node getLastChild()(Code)(Java Doc) final public boolean hasChildNodes()(Code)(Java Doc) final public Node insertBefore(Node newChild, Node refChild)(Code)(Java Doc) protected List newChildren()(Code)(Java Doc) final public Node removeChild(Node oldChild)(Code)(Java Doc) final public Node replaceChild(Node newChild, Node oldChild)(Code)(Java Doc)
|
Fields inherited from org.zkoss.idom.impl.AbstractItem | protected transient boolean _modified(Code)(Java Doc)
|
Methods inherited from org.zkoss.idom.impl.AbstractItem | public Node appendChild(Node newChild)(Code)(Java Doc) final protected void checkWritable()(Code)(Java Doc) public void clearModified(boolean includingDescendant)(Code)(Java Doc) public Item clone(boolean preserveModified)(Code)(Java Doc) public Object clone()(Code)(Java Doc) final public Node cloneNode(boolean deep)(Code)(Java Doc) public short compareDocumentPosition(Node other) throws DOMException(Code)(Java Doc) public Item detach()(Code)(Java Doc) final public boolean equals(Object o)(Code)(Java Doc) public NamedNodeMap getAttributes()(Code)(Java Doc) public String getBaseURI()(Code)(Java Doc) public NodeList getChildNodes()(Code)(Java Doc) public Document getDocument()(Code)(Java Doc) public Object getFeature(String feature, String version)(Code)(Java Doc) public Node getFirstChild()(Code)(Java Doc) public Node getLastChild()(Code)(Java Doc) public String getLocalName()(Code)(Java Doc) final public Locator getLocator()(Code)(Java Doc) public String getNamespaceURI()(Code)(Java Doc) final public Node getNextSibling()(Code)(Java Doc) public String getNodeName()(Code)(Java Doc) public String getNodeValue()(Code)(Java Doc) public org.w3c.dom.Document getOwnerDocument()(Code)(Java Doc) final public Group getParent()(Code)(Java Doc) final public Node getParentNode()(Code)(Java Doc) public String getPrefix()(Code)(Java Doc) final public Node getPreviousSibling()(Code)(Java Doc) public String getText()(Code)(Java Doc) public String getTextContent() throws DOMException(Code)(Java Doc) public Object getUserData(String key)(Code)(Java Doc) public boolean hasAttributes()(Code)(Java Doc) public boolean hasChildNodes()(Code)(Java Doc) final public int hashCode()(Code)(Java Doc) public Node insertBefore(Node newChild, Node refChild)(Code)(Java Doc) public boolean isDefaultNamespace(String namespaceURI)(Code)(Java Doc) public boolean isEqualNode(Node arg)(Code)(Java Doc) public boolean isModified()(Code)(Java Doc) public boolean isReadonly()(Code)(Java Doc) public boolean isSameNode(Node other)(Code)(Java Doc) final public boolean isSupported(String feature, String version)(Code)(Java Doc) public String lookupNamespaceURI(String prefix)(Code)(Java Doc) public String lookupPrefix(String namespaceURI)(Code)(Java Doc) protected static boolean match(Namespaceable vtx, String namespace, String name, Pattern ptn, int mode)(Code)(Java Doc) final public void normalize()(Code)(Java Doc) public Node removeChild(Node oldChild)(Code)(Java Doc) public Node replaceChild(Node newChild, Node oldChild)(Code)(Java Doc) final public void setLocator(Locator loc)(Code)(Java Doc) public void setModified()(Code)(Java Doc) public void setName(String name)(Code)(Java Doc) public void setNodeValue(String nodeValue)(Code)(Java Doc) public void setParent(Group parent)(Code)(Java Doc) public void setPrefix(String prefix)(Code)(Java Doc) public void setReadonly(boolean readonly)(Code)(Java Doc) public void setText(String text)(Code)(Java Doc) public void setTextContent(String textContent) throws DOMException(Code)(Java Doc) public Object setUserData(String key, Object data, UserDataHandler handler)(Code)(Java Doc)
|
|
|