org.inria.ns.reflex.xml.dom
Class DOMElement

java.lang.Object
  extended by org.inria.ns.reflex.xml.dom.DOMElement
All Implemented Interfaces:
Renamable, Unwrappable, Element, Node

public class DOMElement
extends Object
implements Node, Element, Renamable, Unwrappable

A wrapper for a DOM Element that can be renamed. Usefull to prevent losing the handler of an element after renaming it.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
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.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
DOMElement(Element element)
          Wrap an element : changes to this element are reflected on the wrapped element.
 
Method Summary
 Node appendChild(Node newChild)
           
 Node cloneNode(boolean deep)
           
 short compareDocumentPosition(Node other)
           
 boolean equals(Object obj)
           
 String getAttribute(String name)
           
 Attr getAttributeNode(String name)
           
 Attr getAttributeNodeNS(String namespaceURI, String localName)
           
 String getAttributeNS(String namespaceURI, String localName)
           
 NamedNodeMap getAttributes()
           
 String getBaseURI()
           
 NodeList getChildNodes()
           
 NodeList getElementsByTagName(String name)
           
 NodeList getElementsByTagNameNS(String namespaceURI, String localName)
           
 Object getFeature(String feature, String version)
           
 Node getFirstChild()
           
 Node getLastChild()
           
 String getLocalName()
           
 String getNamespaceURI()
           
 Node getNextSibling()
           
 String getNodeName()
           
 short getNodeType()
           
 String getNodeValue()
           
 Document getOwnerDocument()
           
 Node getParentNode()
           
 String getPrefix()
           
 Node getPreviousSibling()
           
 TypeInfo getSchemaTypeInfo()
           
 String getTagName()
           
 String getTextContent()
           
 Object getUserData(String key)
           
 boolean hasAttribute(String name)
           
 boolean hasAttributeNS(String namespaceURI, String localName)
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 int hashCode()
           
 Node insertBefore(Node newChild, Node refChild)
           
 boolean isDefaultNamespace(String namespaceURI)
           
 boolean isEqualNode(Node arg)
           
 boolean isSameNode(Node other)
           
 boolean isSupported(String feature, String version)
           
 String lookupNamespaceURI(String prefix)
           
 String lookupPrefix(String namespaceURI)
           
 void normalize()
           
 void removeAttribute(String name)
           
 Attr removeAttributeNode(Attr oldAttr)
           
 void removeAttributeNS(String namespaceURI, String localName)
           
 Node removeChild(Node oldChild)
           
 void rename(QName newName)
          Rename this node.
 Node replaceChild(Node newChild, Node oldChild)
           
 void setAttribute(String name, String value)
           
 Attr setAttributeNode(Attr newAttr)
           
 Attr setAttributeNodeNS(Attr newAttr)
           
 void setAttributeNS(String namespaceURI, String qualifiedName, String value)
           
 void setIdAttribute(String arg0, boolean arg1)
           
 void setIdAttributeNode(Attr arg0, boolean arg1)
           
 void setIdAttributeNS(String arg0, String arg1, boolean arg2)
           
 void setNodeValue(String nodeValue)
           
 void setPrefix(String prefix)
           
 void setTextContent(String textContent)
           
 Object setUserData(String key, Object data, UserDataHandler handler)
           
 String toString()
           
 Object unwrap()
          Return the wapped element.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DOMElement

public DOMElement(Element element)
Wrap an element : changes to this element are reflected on the wrapped element.

Parameters:
element - The element to wrap.
Method Detail

rename

public void rename(QName newName)
Rename this node.

Specified by:
rename in interface Renamable
Parameters:
newName - The new name of this node.
See Also:
Renamable.rename(org.inria.ns.reflex.xml.QName)

unwrap

public Object unwrap()
Return the wapped element.

Specified by:
unwrap in interface Unwrappable
Returns:
The wrapped element.
See Also:
Element, Unwrappable.unwrap()

appendChild

public Node appendChild(Node newChild)
                 throws DOMException
Specified by:
appendChild in interface Node
Parameters:
newChild -
Returns:
Throws:
DOMException

cloneNode

public Node cloneNode(boolean deep)
Specified by:
cloneNode in interface Node
Parameters:
deep -
Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getAttribute

public String getAttribute(String name)
Specified by:
getAttribute in interface Element
Parameters:
name -
Returns:

getAttributeNode

public Attr getAttributeNode(String name)
Specified by:
getAttributeNode in interface Element
Parameters:
name -
Returns:

getAttributeNodeNS

public Attr getAttributeNodeNS(String namespaceURI,
                               String localName)
Specified by:
getAttributeNodeNS in interface Element
Parameters:
namespaceURI -
localName -
Returns:

getAttributeNS

public String getAttributeNS(String namespaceURI,
                             String localName)
Specified by:
getAttributeNS in interface Element
Parameters:
namespaceURI -
localName -
Returns:

getAttributes

public NamedNodeMap getAttributes()
Specified by:
getAttributes in interface Node
Returns:

getChildNodes

public NodeList getChildNodes()
Specified by:
getChildNodes in interface Node
Returns:

getElementsByTagName

public NodeList getElementsByTagName(String name)
Specified by:
getElementsByTagName in interface Element
Parameters:
name -
Returns:

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(String namespaceURI,
                                       String localName)
Specified by:
getElementsByTagNameNS in interface Element
Parameters:
namespaceURI -
localName -
Returns:

getFirstChild

public Node getFirstChild()
Specified by:
getFirstChild in interface Node
Returns:

getLastChild

public Node getLastChild()
Specified by:
getLastChild in interface Node
Returns:

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node
Returns:

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node
Returns:

getNextSibling

public Node getNextSibling()
Specified by:
getNextSibling in interface Node
Returns:

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node
Returns:

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node
Returns:

getNodeValue

public String getNodeValue()
                    throws DOMException
Specified by:
getNodeValue in interface Node
Returns:
Throws:
DOMException

getOwnerDocument

public Document getOwnerDocument()
Specified by:
getOwnerDocument in interface Node
Returns:

getParentNode

public Node getParentNode()
Specified by:
getParentNode in interface Node
Returns:

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface Node
Returns:

getPreviousSibling

public Node getPreviousSibling()
Specified by:
getPreviousSibling in interface Node
Returns:

getTagName

public String getTagName()
Specified by:
getTagName in interface Element
Returns:

hasAttribute

public boolean hasAttribute(String name)
Specified by:
hasAttribute in interface Element
Parameters:
name -
Returns:

hasAttributeNS

public boolean hasAttributeNS(String namespaceURI,
                              String localName)
Specified by:
hasAttributeNS in interface Element
Parameters:
namespaceURI -
localName -
Returns:

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface Node
Returns:

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

insertBefore

public Node insertBefore(Node newChild,
                         Node refChild)
                  throws DOMException
Specified by:
insertBefore in interface Node
Parameters:
newChild -
refChild -
Returns:
Throws:
DOMException

isSupported

public boolean isSupported(String feature,
                           String version)
Specified by:
isSupported in interface Node
Parameters:
feature -
version -
Returns:

normalize

public void normalize()
Specified by:
normalize in interface Node

removeAttribute

public void removeAttribute(String name)
                     throws DOMException
Specified by:
removeAttribute in interface Element
Parameters:
name -
Throws:
DOMException

removeAttributeNode

public Attr removeAttributeNode(Attr oldAttr)
                         throws DOMException
Specified by:
removeAttributeNode in interface Element
Parameters:
oldAttr -
Returns:
Throws:
DOMException

removeAttributeNS

public void removeAttributeNS(String namespaceURI,
                              String localName)
                       throws DOMException
Specified by:
removeAttributeNS in interface Element
Parameters:
namespaceURI -
localName -
Throws:
DOMException

removeChild

public Node removeChild(Node oldChild)
                 throws DOMException
Specified by:
removeChild in interface Node
Parameters:
oldChild -
Returns:
Throws:
DOMException

replaceChild

public Node replaceChild(Node newChild,
                         Node oldChild)
                  throws DOMException
Specified by:
replaceChild in interface Node
Parameters:
newChild -
oldChild -
Returns:
Throws:
DOMException

setAttribute

public void setAttribute(String name,
                         String value)
                  throws DOMException
Specified by:
setAttribute in interface Element
Parameters:
name -
value -
Throws:
DOMException

setAttributeNode

public Attr setAttributeNode(Attr newAttr)
                      throws DOMException
Specified by:
setAttributeNode in interface Element
Parameters:
newAttr -
Returns:
Throws:
DOMException

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr newAttr)
                        throws DOMException
Specified by:
setAttributeNodeNS in interface Element
Parameters:
newAttr -
Returns:
Throws:
DOMException

setAttributeNS

public void setAttributeNS(String namespaceURI,
                           String qualifiedName,
                           String value)
                    throws DOMException
Specified by:
setAttributeNS in interface Element
Parameters:
namespaceURI -
qualifiedName -
value -
Throws:
DOMException

setNodeValue

public void setNodeValue(String nodeValue)
                  throws DOMException
Specified by:
setNodeValue in interface Node
Parameters:
nodeValue -
Throws:
DOMException

setPrefix

public void setPrefix(String prefix)
               throws DOMException
Specified by:
setPrefix in interface Node
Parameters:
prefix -
Throws:
DOMException

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

compareDocumentPosition

public short compareDocumentPosition(Node other)
                              throws DOMException
Specified by:
compareDocumentPosition in interface Node
Parameters:
other -
Returns:
Throws:
DOMException
See Also:
Node.compareDocumentPosition(org.w3c.dom.Node)

getBaseURI

public String getBaseURI()
Specified by:
getBaseURI in interface Node
Returns:
See Also:
Node.getBaseURI()

getFeature

public Object getFeature(String feature,
                         String version)
Specified by:
getFeature in interface Node
Parameters:
feature -
version -
Returns:
See Also:
Node.getFeature(java.lang.String, java.lang.String)

getSchemaTypeInfo

public TypeInfo getSchemaTypeInfo()
Specified by:
getSchemaTypeInfo in interface Element
Returns:
See Also:
Element.getSchemaTypeInfo()

getTextContent

public String getTextContent()
                      throws DOMException
Specified by:
getTextContent in interface Node
Returns:
Throws:
DOMException
See Also:
Node.getTextContent()

getUserData

public Object getUserData(String key)
Specified by:
getUserData in interface Node
Parameters:
key -
Returns:
See Also:
Node.getUserData(java.lang.String)

isDefaultNamespace

public boolean isDefaultNamespace(String namespaceURI)
Specified by:
isDefaultNamespace in interface Node
Parameters:
namespaceURI -
Returns:
See Also:
Node.isDefaultNamespace(java.lang.String)

isEqualNode

public boolean isEqualNode(Node arg)
Specified by:
isEqualNode in interface Node
Parameters:
arg -
Returns:
See Also:
Node.isEqualNode(org.w3c.dom.Node)

isSameNode

public boolean isSameNode(Node other)
Specified by:
isSameNode in interface Node
Parameters:
other -
Returns:
See Also:
Node.isSameNode(org.w3c.dom.Node)

lookupNamespaceURI

public String lookupNamespaceURI(String prefix)
Specified by:
lookupNamespaceURI in interface Node
Parameters:
prefix -
Returns:
See Also:
Node.lookupNamespaceURI(java.lang.String)

lookupPrefix

public String lookupPrefix(String namespaceURI)
Specified by:
lookupPrefix in interface Node
Parameters:
namespaceURI -
Returns:
See Also:
Node.lookupPrefix(java.lang.String)

setIdAttribute

public void setIdAttribute(String arg0,
                           boolean arg1)
                    throws DOMException
Specified by:
setIdAttribute in interface Element
Parameters:
arg0 -
arg1 -
Throws:
DOMException
See Also:
Element.setIdAttribute(java.lang.String, boolean)

setIdAttributeNode

public void setIdAttributeNode(Attr arg0,
                               boolean arg1)
                        throws DOMException
Specified by:
setIdAttributeNode in interface Element
Parameters:
arg0 -
arg1 -
Throws:
DOMException
See Also:
Element.setIdAttributeNode(org.w3c.dom.Attr, boolean)

setIdAttributeNS

public void setIdAttributeNS(String arg0,
                             String arg1,
                             boolean arg2)
                      throws DOMException
Specified by:
setIdAttributeNS in interface Element
Parameters:
arg0 -
arg1 -
arg2 -
Throws:
DOMException
See Also:
Element.setIdAttributeNS(java.lang.String, java.lang.String, boolean)

setTextContent

public void setTextContent(String textContent)
                    throws DOMException
Specified by:
setTextContent in interface Node
Parameters:
textContent -
Throws:
DOMException
See Also:
Node.setTextContent(java.lang.String)

setUserData

public Object setUserData(String key,
                          Object data,
                          UserDataHandler handler)
Specified by:
setUserData in interface Node
Parameters:
key -
data -
handler -
Returns:
See Also:
Node.setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler)