Class com.ibm.xml.parser.TXElement
java.lang.Object
|
+----com.ibm.xml.parser.Child
|
+----com.ibm.xml.parser.Parent
|
+----com.ibm.xml.parser.TXElement
- Subclasses:
- TreeFactory.TreeElement
- public class TXElement
- extends Parent
- implements Element, Namespace
The TXElement class implements the Element interface as defined by the Document Object Model (DOM),
and implements the namespace interface as defined by the W3C.
By far the vast majority (apart from text) of Node types that authors will
generally encounter when traversing a document will be Element Nodes. An Element
consists of its start tag, any Attributes, any children, and its end tag.
- Version:
- Revision: 37 1.6 src/com/ibm/xml/parser/TXElement.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
- See Also:
- Element, Namespace, Parent, Child
Method Summary
|
void
|
acceptPost(Visitor visitor)
Implements the accept operation of the visitor design pattern when the end of
a TXElement Node is recognized when traversing the document object tree.
|
void
|
acceptPre(Visitor visitor)
Implements the accept operation of the visitor design pattern when the start of
a TXElement Node is recognized when traversing the document object tree.
|
void
|
addTextElement(TXText text)
Adds the specified text Node to the end of this Element.
|
java.util.Enumeration
|
attributeElements()
Returns an enumeration of TXAttribute of the Attributes of this Element.
|
java.lang.Object
|
clone()
Clone this Element Node and its children using the appropriate factories.
|
TXElement
|
cloneWithoutChildren()
Clone this Element Node using the appropriate factory.
|
Child
|
elementAt(int index)
Returns the Child Node at the specified index.
|
java.lang.String
|
getAttribute(java.lang.String name)
Returns an Attribute's value from this Element that matches the specified
Attribute name.
|
TXAttribute[]
|
getAttributeArray()
Returns a TXAttribute array of the Attributes of this Element.
|
Attribute
|
getAttributeNode(java.lang.String name)
Returns an Attribute's value from this Element that matches the specified
Attribute name.
|
NodeIterator
|
getAttributes()
Returns a NodeIterator of the Attributes of this Element;
this iterator is not "live" (see Parent#getChildNodes for details).
|
TXElement
|
getElementNamed(java.lang.String qName)
Returns the first TXElement match through the immediate Child Element Nodes.
|
TXElement
|
getElementNamed(java.lang.String uri,
java.lang.String localName)
Returns the first TXElement match through the immediate child Element Nodes.
|
TXElement
|
getElementNamed(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
Returns the first TXElement match through the immediate child Elemen Nodes.
|
NodeIterator
|
getElementsByTagName(java.lang.String qName)
Returns a NodeIterator of matches through all child Element Nodes.
|
NodeIterator
|
getElementsNamed(java.lang.String qName)
Returns a NodeIterator of all matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
|
NodeIterator
|
getElementsNamed(java.lang.String uri,
java.lang.String localName)
Returns a NodeIterator of matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
|
NodeIterator
|
getElementsNamed(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
Returns a NodeIterator of all matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
|
java.lang.String
|
getLanguage()
Returns the XML language ID (the value of the xml:lang Attribute) in
use for this Element Node.
|
java.lang.String
|
getName()
Returns this Element's name.
|
int
|
getNodeType()
Returns that this object is an Element Node.
|
java.lang.String
|
getNSLocalName()
Returns the local name of the Namespace.
|
java.lang.String
|
getNSName()
Returns the Namespace URI.
|
TXElement
|
getNthElementNamed(int nth,
java.lang.String qName)
Returns the Nth TXElement match through the immediate child Element Nodes.
|
TXElement
|
getNthElementNamed(int nth,
java.lang.String uri,
java.lang.String localName)
Returns the Nth TXElement match through the immediate child Element Nodes.
|
TXElement
|
getNthElementNamed(int nth,
int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
Returns the Nth TXElement match through the immediate child Element Nodes.
|
java.lang.String
|
getTagName()
Returns this Element's name.
|
java.lang.String
|
getText()
Return all text associated with this Node and its children without considering entities.
|
java.lang.String
|
getUniversalName()
If namespace support is enabled and the Element's name contains a prefix name, return a string
of getNSName()+":"+getNSLocalName() ; otherwise, return getNSLocalName() .
|
boolean
|
isEmpty()
Returns whether this Element has any children.
|
boolean
|
isPreserveSpace()
Returns, at the Element level, whether space is to be preserved.
|
void
|
normalize()
Puts all Text Nodes in the sub-tree underneath this Element into a "normal"
form where only markup (e.g., tags, comments, PIs, CDATASections, and entity
references) separates Text Nodes.
|
void
|
removeAttribute(java.lang.String name)
Removes the Attribute that matches the specified name from this Element.
|
void
|
removeAttributeNode(Attribute attribute)
Removes the specified attribute from this Element.
|
TXElement[]
|
searchChildrenAll(java.lang.String qName)
Returns an array of TXElement of matches through the immediate child Element Nodes.
|
TXElement
|
searchDescendants(java.lang.String qName)
Returns the first TXElement match through all child Element Nodes.
|
TXElement
|
searchDescendants(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
Returns the first TXElement match through all child Element Nodes.
|
TXElement[]
|
searchDescendantsAll(java.lang.String qName)
Returns an array of TXElement matches through all child Element Nodes.
|
TXElement[]
|
searchDescendantsAll(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
Returns an array of TXElement matches through all child Element Nodes.
|
void
|
setAttribute(java.lang.String name,
java.lang.String value)
Adds a new Attribute name/value pair to this Element using the appropriate
factory.
|
void
|
setAttribute(TXAttribute attribute)
Adds a new Attribute to this Element using the appropriate
factory.
Deprecated |
void
|
setAttributeNode(Attribute attribute)
Adds a new Attribute to this Element using the appropriate
factory.
|
void
|
setAttributes(AttributeList attributes)
Sets this Element's Attribute list from the specified TXAttributeList
(preferred) or AttributeList.
|
void
|
setNSLocalName(java.lang.String nsLocalName)
Sets the local name of the Namespace.
|
void
|
setNSName(java.lang.String nsURI)
Sets the Namespace URI.
|
void
|
setPreserveSpace(boolean isPreserveSpace)
Sets, at the Element level, whether space is to be preserved.
|
void
|
setTagName(java.lang.String tagName)
Sets this Element's name.
|
int
|
size()
Returns the number of children in this Element.
|
Methods inherited from class com.ibm.xml.parser.Parent
|
addElement, elements, getChildNodes, getChildrenArray, getFirstChild, hasChildNodes, insert, insertAfter, insertBefore, insertFirst, insertLast, removeChild, replaceChild |
Methods inherited from class com.ibm.xml.parser.Child
|
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toXMLString, toXMLString |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TXElement
public TXElement(java.lang.String tagName)
- Constructor.
- Parameters:
tagName
- This Element's tag name (qualified name).
In the example <elementExample id="demo"> ... </elementExample>
,
the tag name is elementExample
.
TXElement
public TXElement(TXDocument document,
java.lang.String prefixName,
java.lang.String nsLocalName)
- Constructor for namespace support.
- Parameters:
document
- The TXDocument providing a namespace to resolve prefix.
prefixName
- A value of the prefix=
attribute of a namespace PI
in document.
nsLocalName
- The Namespace local name.
- See Also:
- NamespacePI, Namespace
clone
public java.lang.Object clone()
- Clone this Element Node and its children using the appropriate factories.
This method is defined by Child.
- Returns:
- Cloned Element Node.
- Overrides:
- clone in class Child
- See Also:
- clone
cloneWithoutChildren
public TXElement cloneWithoutChildren()
- Clone this Element Node using the appropriate factory.
- Returns:
- Cloned Element Node.
getNodeType
public int getNodeType()
- Returns that this object is an Element Node.
This method is defined by DOM.
- Returns:
- Element Node indicator.
getTagName
public java.lang.String getTagName()
- Returns this Element's name.
In the example
<elementExample id="demo"> ... </elementExample>
,
the tag name is elementExample
. If the Element's name has a namespace
prefix, the prefix will still be attached.
This method is defined by DOM.
- Implements:
- getTagName in interface Element
- Returns:
- The string that is this Element's name, or null if no name.
- See Also:
- setTagName, getName
getName
public java.lang.String getName()
- Returns this Element's name.
This method is equivalent to
getTagName()
.
- Implements:
- getName in interface Namespace
- Returns:
- The string that is this Element's name, or null if no name.
- See Also:
- getTagName, setTagName
setTagName
public void setTagName(java.lang.String tagName)
- Sets this Element's name.
In the example
<elementExample id="demo"> ... </elementExample>
,
the tag name is elementExample
.
- Parameters:
tagName
- The string that is this Element's name.
- See Also:
- getTagName
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Returns an Attribute's value from this Element that matches the specified
Attribute name.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- getAttribute in interface Element
- Parameters:
name
- The name to match in this Element's list of Attributes.
- Returns:
- The string value of the matching Attribute; otherwise, null.
- See Also:
- getAttributeNode, setAttribute, setAttributeNode, getLanguage
getAttributeNode
public Attribute getAttributeNode(java.lang.String name)
- Returns an Attribute's value from this Element that matches the specified
Attribute name.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- getAttributeNode in interface Element
- Parameters:
name
- The name to match in this Element's list of Attributes.
- Returns:
- The matching Attribute Node; otherwise, null.
- See Also:
- getAttribute, setAttribute, setAttributeNode
setAttribute
public void setAttribute(java.lang.String name,
java.lang.String value)
- Adds a new Attribute name/value pair to this Element using the appropriate
factory. If an Attribute by that name is already present in this Element,
it's value is changed to be that of value.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- setAttribute in interface Element
- Parameters:
name
- The name of the Attribute to create or update.
value
- The value of the created or updated Attribute.
- See Also:
- getAttribute, getAttributeNode, setAttributeNode
setAttribute
public void setAttribute(TXAttribute attribute)
- Note: setAttribute() is deprecated.Use setAttributeNode()
- Adds a new Attribute to this Element using the appropriate
factory. If an Attribute by that name is already present in this Element,
it's value is changed to be that of the specified attribute's value.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
- Implements:
- setAttribute in interface Element
- Parameters:
attribute
- The Attribute to create or update.
- See Also:
- getAttribute, getAttributeNode, setAttributeNode
setAttributeNode
public void setAttributeNode(Attribute attribute)
- Adds a new Attribute to this Element using the appropriate
factory. If an Attribute by that name is already present in this Element,
it's value is changed to be that of the specified attribute's value.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- setAttributeNode in interface Element
- Parameters:
attribute
- The Attribute to create or update.
- See Also:
- getAttribute, getAttributeNode, setAttribute
removeAttribute
public void removeAttribute(java.lang.String name) throws NoSuchAttributeException
- Removes the Attribute that matches the specified name from this Element.
If the name provided does not exist, the NoSuchAttributeException is thrown.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- removeAttribute in interface Element
- Parameters:
name
- Attribute name to match against.
- Throws:
- NoSuchNodeException - Thrown if no matching Attribute name can be found in this Element.
- See Also:
- removeAttributeNode
removeAttributeNode
public void removeAttributeNode(Attribute attribute) throws NoSuchAttributeException
- Removes the specified attribute from this Element.
If the Attribute provided does not exist, the NoSuchAttributeException is thrown.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- removeAttributeNode in interface Element
- Parameters:
attribute
- Attribute to remove.
- Throws:
- NoSuchNodeException - Thrown if no matching Attribute can be found in this Element.
- See Also:
- removeAttribute
getAttributes
public NodeIterator getAttributes()
- Returns a NodeIterator of the Attributes of this Element;
this iterator is not "live" (see Parent#getChildNodes for details).
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
This method is defined by DOM.
- Implements:
- getAttributes in interface Element
- Returns:
- A NodeIterator of Attributes, or an empty iterator is returned
if no Attributes.
- See Also:
- getAttributeArray, attributeElements, setAttributes, getChildNodes
getAttributeArray
public TXAttribute[] getAttributeArray()
- Returns a TXAttribute array of the Attributes of this Element.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
- Returns:
- A TXAttribute array of Attributes, or a 0-length array if no Attributes.
- See Also:
- getAttributes, attributeElements, setAttributes
attributeElements
public java.util.Enumeration attributeElements()
- Returns an enumeration of TXAttribute of the Attributes of this Element.
Both implicitly-defined (DTD) and explicitly-defined attributes are considered.
- Returns:
- An enumeration of TXAttribute Attributes, or null if no Attributes.
- See Also:
- getAttributes, attributeElements, setAttributes
setAttributes
public void setAttributes(AttributeList attributes) throws NoSuchNodeException
- Sets this Element's Attribute list from the specified TXAttributeList
(preferred) or AttributeList.
- Parameters:
attributes
- The Attributes to set specified in the form of a
TXAttributeList or AttributeList.
- Throws:
- NoSuchNodeException - Thrown if unable to set the specified attributes.
- See Also:
- getAttributes, getAttributeArray, attributeElements
getNSLocalName
public java.lang.String getNSLocalName()
- Returns the local name of the Namespace.
This method is defined by Namespace.
- Implements:
- getNSLocalName in interface Namespace
- Returns:
- The Namespace local name, or null if no local name.
- See Also:
- Namespace, setNSLocalName
setNSLocalName
public void setNSLocalName(java.lang.String nsLocalName)
- Sets the local name of the Namespace.
This method is defined by Namespace.
- Implements:
- setNSLocalName in interface Namespace
- Parameters:
nsLocalName
- The Namespace local name.
- See Also:
- Namespace, getNSLocalName
getNSName
public java.lang.String getNSName()
- Returns the Namespace URI.
This method is defined by Namespace.
- Implements:
- getNSName in interface Namespace
- Returns:
- The Namespace URI, or null if the tag name does not
contain a prefix name or XML4J parser namespace processing is disabled.
- See Also:
- setNSName, setProcessNamespace, Namespace
setNSName
public void setNSName(java.lang.String nsURI)
- Sets the Namespace URI.
This method is defined by Namespace.
- Implements:
- setNSName in interface Namespace
- Parameters:
nsURI
- The Namespace URI, or null if no name.
- See Also:
- getNSName, Namespace
getUniversalName
public java.lang.String getUniversalName()
- If namespace support is enabled and the Element's name contains a prefix name, return a string
of
getNSName()+":"+getNSLocalName()
; otherwise, return getNSLocalName()
.
- Implements:
- getUniversalName in interface Namespace
- Returns:
- The universal name, or null if this Element's name does not
contain a prefix name or XML4J parser namespace processing is disabled.
- See Also:
- getNSName, getNSLocalName, setProcessNamespace, Namespace
isEmpty
public boolean isEmpty()
- Returns whether this Element has any children.
- Returns:
- =true if this Element has any children; otherwise, =false.
- See Also:
- elementAt, size
size
public int size()
- Returns the number of children in this Element.
- Returns:
- The number of children in this Element.
- See Also:
- elementAt, isEmpty
elementAt
public Child elementAt(int index) throws NoSuchNodeException
- Returns the Child Node at the specified index.
- Parameters:
index
- An index into this Element's children.
- Returns:
- The Child Node at the specified index.
- Throws:
- NoSuchNodeException - Thrown if an invalid index is specified.
- See Also:
- isEmpty, size
isPreserveSpace
public boolean isPreserveSpace()
- Returns, at the Element level, whether space is to be preserved.
This value is used, for example, to determine if space is to be preserved
in Text Nodes during printWithFormat() operations.
- Returns:
=true
space is to be preserved;
=false
space is to be ignored.- See Also:
- setPreserveSpace, setPreserveSpace, setIsIgnorableWhitespace, printWithFormat
setPreserveSpace
public void setPreserveSpace(boolean isPreserveSpace)
- Sets, at the Element level, whether space is to be preserved.
This value is used, for example, to determine if space is to be preserved
in children of this Node during printWithFormat() operations.
By default, space is not preserved. The XML4J parser will override this value
if it detects an attribute of xml:namespace="preserve"
.
- Parameters:
isPreserveSpace
- =true
space is to be preserved;
=false
space is to be ignored.
- See Also:
- isPreserveSpace, setPreserveSpace, setIsIgnorableWhitespace, printWithFormat
getText
public java.lang.String getText()
- Return all text associated with this Node and its children without considering entities.
This method is defined by Child.
- Returns:
- Text associated with all children, or "" if no children.
- Overrides:
- getText in class Child
- See Also:
- toXMLString
getLanguage
public java.lang.String getLanguage()
- Returns the XML language ID (the value of the
xml:lang
Attribute) in
use for this Element Node. If this Element Node has no explicitly defined language Attribute,
Parent Nodes will be recursively checked.
- Returns:
- The XML language ID, or null if all Parents have no language ID.
- See Also:
- getAttribute
normalize
public void normalize()
- Puts all Text Nodes in the sub-tree underneath this Element into a "normal"
form where only markup (e.g., tags, comments, PIs, CDATASections, and entity
references) separates Text Nodes. This has the effect of combining Text Nodes
that have been separated due to document manipulation.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLMENTED.
- Implements:
- normalize in interface Element
addTextElement
public void addTextElement(TXText text)
- Adds the specified text Node to the end of this Element. If the last
child of this Element is a Text Node and not a CDATA section, text is
appended to the last child. Otherwise, a new TXText Node is inserted at the end of this
Element.
- Parameters:
text
- Text Node to add to this element.
- See Also:
- addElement(com.ibm.xml.parser.Child)
searchDescendants
public TXElement searchDescendants(java.lang.String qName)
- Returns the first TXElement match through all child Element Nodes.
Searching is done recursively, not just for immediate Child Nodes.
The specified qualified name refers to the Element tag name (see Namespace for details).
- Parameters:
qName
- Qualified name to match against in all subordinate Elements.
- Returns:
- The first matching TXElement Node, or null if no matches.
- See Also:
- getElementNamed, getNthElementNamed, Namespace
searchDescendants
public TXElement searchDescendants(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
- Returns the first TXElement match through all child Element Nodes.
All specified input parameters must match for an element to be judged as matched (see Namespace for details).
Various namespace matching algorithms are supported: qualified name, local name & URI, or URI.
Searching is done recursively, not just for immediate Child Nodes.
- Parameters:
matchType
- Namespace match type: Match.QNAME, Match.NSLOCAL, Match.NS
uri
- When matching a URI, specify the value to match; otherwise, specify null.
qNameOrLocalName
- When matching a qualified name or local name, specify the value to match; otherwise, specify null.
- Returns:
- An array of matched TXElement Nodes, or null if no matches.
- See Also:
- getElementNamed, getNthElementNamed, Namespace
getElementNamed
public TXElement getElementNamed(java.lang.String qName)
- Returns the first TXElement match through the immediate Child Element Nodes.
Only immediate children are searched (i.e. no grandchildren).
The specified qualified name refers to the Element tag name (see Namespace for details).
- Parameters:
qName
- Qualified name to match against in immediate children.
- Returns:
- The first matching TXElement Node, or null if no matches.
- See Also:
- searchDescendants, getNthElementNamed, Namespace
getElementNamed
public TXElement getElementNamed(java.lang.String uri,
java.lang.String localName)
- Returns the first TXElement match through the immediate child Element Nodes.
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
uri
- The Namespace URI to match against in immediate children.
localName
- The Namespace local name to match against in immediate children.
- Returns:
- The first matching TXElement Node, or null if no matches.
- See Also:
- searchDescendants, getNthElementNamed, Namespace
getElementNamed
public TXElement getElementNamed(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
- Returns the first TXElement match through the immediate child Elemen Nodes.
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Various namespace matching algorithms are supported: qualified name, local name & URI, or URI.
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
matchType
- Namespace match type: Match.QNAME, Match.NSLOCAL, Match.NS
uri
- When matching a URI, specify the value to match; otherwise, specify null.
qNameOrLocalName
- When matching a qualified name or local name, specify the value to match; otherwise, specify null.
- Returns:
- An array of matched TXElement Nodes, or null if no matches.
- See Also:
- searchDescendants, getNthElementNamed, Namespace
getNthElementNamed
public TXElement getNthElementNamed(int nth,
java.lang.String qName)
- Returns the Nth TXElement match through the immediate child Element Nodes.
Only immediate children are searched (i.e. no grandchildren).
The specified qualified name refers to the Element tag name (see Namespace for details).
- Example:
<BODY> --- this
<H1>...</H1> --- getNthElementNamed(0, "H1")
<P>...</P> --- getNthElementNamed(0, "P")
<P>...</P> --- getNthElementNamed(1, "P")
<HR/> --- getNthElementNamed(0, "HR");
<P>...</P> --- getNthElementNamed(2, "P")
<HR/> --- getNthElementNamed(1, "HR");
</BODY>
- Parameters:
nth
- 0-based match occurrence.
qName
- Qualified name to match against in immediate children.
- Returns:
- The Nth matching TXElement Node, or null if no matches.
- See Also:
- searchDescendants, getElementNamed, Namespace
getNthElementNamed
public TXElement getNthElementNamed(int nth,
java.lang.String uri,
java.lang.String localName)
- Returns the Nth TXElement match through the immediate child Element Nodes.
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
nth
- 0-based match occurrence.
uri
- The Namespace URI to match against in immediate children.
localName
- The Namespace local name to match against in immediate children.
- Returns:
- The Nth matching TXElement Node, or null if no matches.
- See Also:
- searchDescendants, getElementNamed, Namespace
getNthElementNamed
public TXElement getNthElementNamed(int nth,
int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
- Returns the Nth TXElement match through the immediate child Element Nodes.
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Various namespace matching algorithms are supported: qualified name, local name & URI, or URI.
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
matchType
- Namespace match type: Match.QNAME, Match.NSLOCAL, Match.NS
uri
- When matching a URI, specify the value to match; otherwise, specify null.
qNameOrLocalName
- When matching a qualified name or local name, specify the value to match; otherwise, specify null.
- Returns:
- The Nth matching TXElement Node, or null if no matches.
- See Also:
- searchDescendants, getElementNamed, Namespace
searchChildrenAll
public TXElement[] searchChildrenAll(java.lang.String qName)
- Returns an array of TXElement of matches through the immediate child Element Nodes.
Only immediate children are searched (i.e. no grandchildren).
The specified qualified name refers to the Element tag name (see Namespace for details).
- Parameters:
qName
- Qualified name to match against in immediate children.
- Returns:
- An array of matched TXElement Nodes, or null if no matches.
- See Also:
- getElementsByTagName, searchDescendantsAll, getElementsNamed, Namespace
getElementsByTagName
public NodeIterator getElementsByTagName(java.lang.String qName)
- Returns a NodeIterator of matches through all child Element Nodes.
Searching is done recursively, not just for immediate Child Nodes.
The returned iterator is not "live" (refer to Parent#getChildNodes for details).
The specified qualified name refers to the Element tag name (see Namespace for details).
This method is defined by DOM.
- Implements:
- getElementsByTagName in interface Element
- Parameters:
qName
- Qualified name to match against in all subordinate Elements.
- Returns:
- A NodeIterator of matched Element Nodes (TXElement).
If no matches, an empty iterator is returned.
- See Also:
- searchChildrenAll, searchDescendantsAll, getElementsNamed, getChildNodes, Namespace
searchDescendantsAll
public TXElement[] searchDescendantsAll(java.lang.String qName)
- Returns an array of TXElement matches through all child Element Nodes.
Searching is done recursively, not just for immediate Child Nodes.
The specified qualified name refers to the Element tag name (see Namespace for details).
- Parameters:
qName
- Qualified name to match against in all subordinate Elements.
- Returns:
- An array of matched TXElement Nodes, or null if no matches.
- See Also:
- searchChildrenAll, getElementsByTagName, getElementsNamed, Namespace
searchDescendantsAll
public TXElement[] searchDescendantsAll(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
- Returns an array of TXElement matches through all child Element Nodes.
All specified input parameters must match for an element to be judged as matched (see Namespace for details).
Various namespace matching algorithms are supported: qualified name, local name & URI, or URI.
Searching is done recursively, not just for immediate Child Nodes.
- Parameters:
matchType
- Namespace match type: Match.QNAME, Match.NSLOCAL, Match.NS
uri
- When matching a URI, specify the value to match; otherwise, specify null.
qNameOrLocalName
- When matching a qualified name or local name, specify the value to match; otherwise, specify null.
- Returns:
- An array of matched TXElement Nodes, or null if no matches.
- See Also:
- searchChildrenAll, getElementsByTagName, getElementsNamed, Namespace
getElementsNamed
public NodeIterator getElementsNamed(java.lang.String qName)
- Returns a NodeIterator of all matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
Only immediate children are searched (i.e. no grandchildren).
The specified qualified name refers to the Element tag name (see Namespace for details).
- Parameters:
qName
- Qualified name to match against in immediate children.
- Returns:
- A NodeIterator of matches, or an empty iterator if no matches.
- See Also:
- searchChildrenAll, getElementsByTagName, searchDescendantsAll, getChildNodes, Namespace
getElementsNamed
public NodeIterator getElementsNamed(java.lang.String uri,
java.lang.String localName)
- Returns a NodeIterator of matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
uri
- The Namespace URI to match against in immediate children.
localName
- The Namespace local name to match against in immediate children.
- Returns:
- A TXElement of matches, or an empty iterator if no matches.
- See Also:
- searchChildrenAll, getElementsByTagName, searchDescendantsAll, getChildNodes, Namespace
getElementsNamed
public NodeIterator getElementsNamed(int matchType,
java.lang.String uri,
java.lang.String qNameOrLocalName)
- Returns a NodeIterator of all matches through the immediate child Element Nodes;
this iterator is not "live" (see Parent#getChildNodes for details).
All specified input parameters must match for an Element to be judged as matched (see Namespace for details).
Various namespace matching algorithms are supported: qualified name, local name & URI, or URI.
Only immediate children are searched (i.e. no grandchildren).
- Parameters:
matchType
- Namespace match type: Match.QNAME, Match.NSLOCAL, Match.NS
uri
- When matching a URI, specify the value to match; otherwise, specify null.
qNameOrLocalName
- When matching a qualified name or local name, specify the value to match; otherwise, specify null.
- Returns:
- A NodeIterator of matches, or an empty iterator if no matches.
- See Also:
- searchChildrenAll, getElementsByTagName, searchDescendantsAll, getChildNodes, Namespace
acceptPre
public void acceptPre(Visitor visitor) throws java.lang.Exception
- Implements the accept operation of the visitor design pattern when the start of
a TXElement Node is recognized when traversing the document object tree.
- Parameters:
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)
- Throws:
- java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
- See Also:
- Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException
acceptPost
public void acceptPost(Visitor visitor) throws java.lang.Exception
- Implements the accept operation of the visitor design pattern when the end of
a TXElement Node is recognized when traversing the document object tree.
- Parameters:
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)
- Throws:
- java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
- See Also:
- Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException