EAF 7.4 Util

org.enhydra.xml
Class SearchElement

java.lang.Object
  extended by org.enhydra.xml.NodeImpl
      extended by org.enhydra.xml.ElementImpl
          extended by org.enhydra.xml.HashMapElement
              extended by org.enhydra.xml.SearchElement
All Implemented Interfaces:
org.w3c.dom.Element, org.w3c.dom.Node, org.w3c.dom.NodeList
Direct Known Subclasses:
XMLConfig

public class SearchElement
extends HashMapElement

Version:
1.0
Author:
Tweety A class representing a node in a meta-data tree, which implements the

Namespaces are ignored in this implementation. The terms "tag name" and "node name" are always considered to be synonymous.


Field Summary
static java.lang.String ATTR_SEPARATOR
           
static java.lang.String EQUAL_SEPARATOR
           
static java.lang.String TAG_SEPARATOR
           
 
Fields inherited from class org.enhydra.xml.HashMapElement
children
 
Fields inherited from class org.enhydra.xml.ElementImpl
attributes, MASK_NAME, MASK_NAME_START
 
Fields inherited from class org.enhydra.xml.NodeImpl
firstChild, lastChild, nextSibling, nodeName, nodeValue, numChildren, ownerDocument, parent, previousSibling, type
 
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
 
Constructor Summary
SearchElement()
          Constructs an empty SearchElement.
SearchElement(org.w3c.dom.Document ownerDoc, java.lang.String name)
          Constructs an SearchElement with a given document owner and node name.
SearchElement(org.w3c.dom.Node node)
          Constructs an SearchElement with a given Node.
SearchElement(SearchElement node)
          Constructs an SearchElement with a given SearchElement.
 
Method Summary
 org.w3c.dom.Element getFirstSubElementByTagName(java.lang.String namePath)
          Returns the first Element in the subtree of this node, with the given tag name.
 org.w3c.dom.Element getFirstSubElementsByCondition(java.lang.String condition)
          Returns the first Element in the subtree of this node, that satisfy the given condition.
 org.w3c.dom.NodeList getSubElementsByAttrValue(java.lang.String attrPath, java.lang.String attrValue)
          Returns a list of Elements in the subtree of this node, which contain attribute with the given name and value.
 org.w3c.dom.NodeList getSubElementsByCondition(java.lang.String condition)
          Returns a list of Elements in the subtree of this node, that satisfy the given condition.
 org.w3c.dom.NodeList getSubElementsByTagName(java.lang.String namePath)
          Returns a list of elements in the subtree of this node, with the given tag name.
 org.w3c.dom.NodeList getSubElementsByTagText(java.lang.String tagPath, java.lang.String tagValue)
          Returns a list of Elements in the subtree of this node, with the given tag name and value.
 java.lang.String getText(java.lang.String namePath)
          Return the text of the Element found on the given path.
protected  org.w3c.dom.Node newElementInstance(org.w3c.dom.Node node)
          Returns new SearchElement instance from a given Node.
static org.w3c.dom.Element newInstance(org.w3c.dom.Document document)
          Creates new instance of SearchElement from a given document as a Document.
 void setAttr(java.lang.String namePath, java.lang.String value)
          Sets the value of an attribute found on the given path.
 void setText(java.lang.String namePath, java.lang.String text)
          Sets the given text to the Element found on the given path.
 
Methods inherited from class org.enhydra.xml.HashMapElement
cloneNode, getChildrenByTagName, getElementsByTagName, getFirstChildByTagName, getNextSameNameNode, getText, hasElementChildNodes, insertBefore, removeChild, replaceChild, setText
 
Methods inherited from class org.enhydra.xml.ElementImpl
beginToString, compareDocumentPosition, endToString, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getElementsByTagNameNS, getFeature, getNamespaceURI, getSchemaTypeInfo, getTagName, getTextContent, getUserData, hasAttribute, hasAttributeNS, hasAttributes, isDefaultNamespace, isEqualNode, isSameNode, isValidName, lookupNamespaceURI, lookupPrefix, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setTextContent, setUserData
 
Methods inherited from class org.enhydra.xml.NodeImpl
appendChild, getChildNodes, getFirstChild, getLastChild, getLength, getLocalName, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasChildNodes, initNodeImplChildren, isSupported, item, newCommentInstance, newDefaultInstance, newTextInstance, normalize, setNodeValue, setPrefix, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getChildNodes, getFirstChild, getLastChild, getLocalName, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasChildNodes, isSupported, normalize, setNodeValue, setPrefix
 

Field Detail

TAG_SEPARATOR

public static java.lang.String TAG_SEPARATOR

ATTR_SEPARATOR

public static java.lang.String ATTR_SEPARATOR

EQUAL_SEPARATOR

public static java.lang.String EQUAL_SEPARATOR
Constructor Detail

SearchElement

public SearchElement()
Constructs an empty SearchElement.


SearchElement

public SearchElement(org.w3c.dom.Document ownerDoc,
                     java.lang.String name)
Constructs an SearchElement with a given document owner and node name.

Parameters:
ownerDoc - the document owner of the node, as a Document.
name - the name of the node, as a String.

SearchElement

public SearchElement(org.w3c.dom.Node node)
Constructs an SearchElement with a given Node.

Parameters:
node - Node.

SearchElement

public SearchElement(SearchElement node)
Constructs an SearchElement with a given SearchElement.

Parameters:
node - SearchElement.
Method Detail

newElementInstance

protected org.w3c.dom.Node newElementInstance(org.w3c.dom.Node node)
Returns new SearchElement instance from a given Node.

Overrides:
newElementInstance in class HashMapElement
Parameters:
node - Node.
Returns:
new instance of the HashMapElement class.

newInstance

public static org.w3c.dom.Element newInstance(org.w3c.dom.Document document)
Creates new instance of SearchElement from a given document as a Document.

Parameters:
document - document.
Returns:
new SearchElement node as a root of the Document.

getSubElementsByTagName

public org.w3c.dom.NodeList getSubElementsByTagName(java.lang.String namePath)
Returns a list of elements in the subtree of this node, with the given tag name.

Parameters:
namePath - relative path to the Element (through children).
Returns:
list of elements in the subtree of this node, with the given tag name.

getSubElementsByAttrValue

public org.w3c.dom.NodeList getSubElementsByAttrValue(java.lang.String attrPath,
                                                      java.lang.String attrValue)
Returns a list of Elements in the subtree of this node, which contain attribute with the given name and value.

Parameters:
attrPath - relative path to the attribute name.
attrValue - attribute value.
Returns:
list of Elements in the subtree of this node, which contain attribute with the given name and value.

getSubElementsByTagText

public org.w3c.dom.NodeList getSubElementsByTagText(java.lang.String tagPath,
                                                    java.lang.String tagValue)
Returns a list of Elements in the subtree of this node, with the given tag name and value.

Parameters:
tagPath - relative path to the tag name.
tagValue - Element value.
Returns:
list of Elements in the subtree of this node, with the given tag name and value.

getSubElementsByCondition

public org.w3c.dom.NodeList getSubElementsByCondition(java.lang.String condition)
Returns a list of Elements in the subtree of this node, that satisfy the given condition.

Parameters:
condition - condition.
Returns:
list of Elements in the subtree of this node, that satisfy the given condition.

getFirstSubElementsByCondition

public org.w3c.dom.Element getFirstSubElementsByCondition(java.lang.String condition)
Returns the first Element in the subtree of this node, that satisfy the given condition.

Parameters:
condition - condition.
Returns:
the first Element in the subtree of this node, that satisfy the given condition.

getFirstSubElementByTagName

public org.w3c.dom.Element getFirstSubElementByTagName(java.lang.String namePath)
Returns the first Element in the subtree of this node, with the given tag name.

Parameters:
namePath - relative path to the Element.
Returns:
the first Element in the subtree of this node, with the given tag name.

getText

public java.lang.String getText(java.lang.String namePath)
Return the text of the Element found on the given path.

Parameters:
namePath - relative path to the Element node.
Returns:
text of the Element found on the given path.

setText

public void setText(java.lang.String namePath,
                    java.lang.String text)
Sets the given text to the Element found on the given path.

Parameters:
namePath - relative path to the Element node.
text - new text.

setAttr

public void setAttr(java.lang.String namePath,
                    java.lang.String value)
Sets the value of an attribute found on the given path.

Parameters:
namePath - relative path to the attribute.
text - new value.

EAF 7.4 Util