|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.tree.NodeImpl
net.sf.saxon.tree.ElementImpl
net.sf.saxon.tree.ElementWithAttributes
public class ElementWithAttributes
A node in the XML parse tree representing an XML element.
This class is an implementation of NodeInfo
Field Summary | |
---|---|
protected AttributeCollection |
attributeList
|
protected int[] |
namespaceList
|
protected int |
sequence
|
Fields inherited from class net.sf.saxon.tree.ElementImpl |
---|
nameCode, root |
Fields inherited from class net.sf.saxon.tree.NodeImpl |
---|
index, NODE_LETTER, parent |
Fields inherited from interface net.sf.saxon.om.NodeInfo |
---|
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
ElementWithAttributes()
|
Method Summary | |
---|---|
void |
addChild(NodeImpl node,
int index)
Add a child node to this node. |
void |
compact(int size)
Compact the space used by this node |
void |
copy(Receiver out,
int whichNamespaces,
boolean copyAnnotations,
int locationId)
Copy this node to a given outputter (supporting xsl:copy-of) |
protected AxisIterator |
enumerateChildren(NodeTest test)
Get an enumeration of the children of this node |
AttributeCollection |
getAttributeList()
Get the attribute list for this element. |
java.lang.String |
getAttributeValue(int fingerprint)
Get the value of a given attribute of this node |
int[] |
getDeclaredNamespaces(int[] buffer)
Get all namespace undeclarations and undeclarations defined on this element. |
NodeInfo |
getFirstChild()
Get the first child node of the element |
int[] |
getInScopeNamespaceCodes()
Get the list of in-scope namespaces for this element as an array of namespace codes. |
NodeInfo |
getLastChild()
Get the last child node of the element |
protected NodeImpl |
getNthChild(int n)
Get the nth child node of the element (numbering from 0) |
java.lang.String |
getPrefixForURI(java.lang.String uri)
Search the NamespaceList for a given URI, returning the corresponding prefix. |
protected long |
getSequenceNumber()
Get the node sequence number (in document order). |
java.lang.String |
getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes. |
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
short |
getURICodeForPrefix(java.lang.String prefix)
Search the NamespaceList for a given prefix, returning the corresponding URI. |
java.lang.String |
getURIForPrefix(java.lang.String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix. |
boolean |
hasChildNodes()
Determine if the node has any children. |
void |
initialise(int nameCode,
AttributeCollectionImpl atts,
NodeInfo parent,
java.lang.String baseURI,
int lineNumber,
int sequenceNumber)
Initialise a new ElementWithAttributes with an element name and attribute list |
java.util.Iterator |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context. |
void |
setNamespaceDeclarations(int[] namespaces,
int namespacesUsed)
Set the namespace declarations for the element |
protected void |
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children. |
Methods inherited from class net.sf.saxon.tree.ElementImpl |
---|
generateId, getBaseURI, getDocumentRoot, getLineNumber, getNameCode, getNodeKind, getRoot, getSystemId, setLineNumber, setNameCode, setSystemId |
Methods inherited from class net.sf.saxon.tree.NodeImpl |
---|
atomize, compareOrder, equals, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AttributeCollection attributeList
protected int[] namespaceList
protected int sequence
Constructor Detail |
---|
public ElementWithAttributes()
Method Detail |
---|
public void initialise(int nameCode, AttributeCollectionImpl atts, NodeInfo parent, java.lang.String baseURI, int lineNumber, int sequenceNumber)
initialise
in class ElementImpl
nameCode
- The element name, with namespaces resolvedatts
- The attribute list, after namespace processingparent
- The parent nodebaseURI
- The base URI of the new elementlineNumber
- The line number of the element in the source documentsequenceNumber
- Integer identifying this element within the documentpublic void setNamespaceDeclarations(int[] namespaces, int namespacesUsed)
namespaces
- the list of namespace codesnamespacesUsed
- the number of entries in the list that are usedpublic java.lang.String getURIForPrefix(java.lang.String prefix, boolean useDefault)
getURIForPrefix
in interface NamespaceResolver
prefix
- the namespace prefix. May be the zero-length string, indicating
that there is no prefix. This indicates either the default namespace or the
null namespace, depending on the value of useDefault.useDefault
- true if the default namespace is to be used when the
prefix is "". If false, the method returns "" when the prefix is "".
public java.util.Iterator iteratePrefixes()
iteratePrefixes
in interface NamespaceResolver
public short getURICodeForPrefix(java.lang.String prefix) throws NamespaceException
prefix
- The prefix to be matched. To find the default namespace, supply ""
NamespaceException
- if the prefix has not been declared on this NamespaceList.public java.lang.String getPrefixForURI(java.lang.String uri)
uri
- The URI to be matched.
public int[] getDeclaredNamespaces(int[] buffer)
getDeclaredNamespaces
in interface NodeInfo
getDeclaredNamespaces
in class ElementImpl
buffer
- If this is non-null, and the result array fits in this buffer, then the result
may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.
For a node other than an element, the method returns null.
public int[] getInScopeNamespaceCodes()
public AttributeCollection getAttributeList()
getAttributeList
in class ElementImpl
public java.lang.String getAttributeValue(int fingerprint)
getAttributeValue
in interface NodeInfo
getAttributeValue
in class NodeImpl
fingerprint
- The fingerprint of the attribute name
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException
copy
in interface NodeInfo
copy
in class ElementImpl
out
- The outputterwhichNamespaces
- indicates which namespaces should be output: all, none, or local
namespaces only (those not declared on the parent element)copyAnnotations
- indicates whether the type annotations
of element and attribute nodes should be copiedlocationId
- If non-zero, identifies the location of the instruction
that requested this copy. If zero, indicates that the location information
for the original node is to be copied; in this case the Receiver must be
a LocationCopier
XPathException
protected final long getSequenceNumber()
getSequenceNumber
in class NodeImpl
public final boolean hasChildNodes()
hasChildNodes
in interface NodeInfo
hasChildNodes
in class NodeImpl
true
if the node has any children,
false
if the node has no children.protected final AxisIterator enumerateChildren(NodeTest test)
test
- A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returned
public final NodeInfo getFirstChild()
getFirstChild
in class NodeImpl
public final NodeInfo getLastChild()
getLastChild
in class NodeImpl
protected final NodeImpl getNthChild(int n)
n
- identifies the required child
public java.lang.String getStringValue()
Item.getStringValueCS()
public java.lang.CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class NodeImpl
Item.getStringValue()
protected void useChildrenArray(NodeImpl[] array)
array
- the array to be usedpublic void addChild(NodeImpl node, int index)
node
- the node to be added as a child of this nodeindex
- the position where the child is to be addedpublic void compact(int size)
size
- the number of actual children
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |