|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.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 |
---|
Fields inherited from class net.sf.saxon.tree.NodeImpl |
---|
NODE_LETTER |
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) |
AttributeCollection |
getAttributeList()
Get the attribute list for this element. |
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 |
String |
getPrefixForURI(String uri)
Search the NamespaceList for a given URI, returning the corresponding prefix. |
String |
getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes. |
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
short |
getURICodeForPrefix(String prefix)
Search the NamespaceList for a given prefix, returning the corresponding URI. |
String |
getURIForPrefix(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,
String baseURI,
int lineNumber,
int sequenceNumber)
Initialise a new ElementWithAttributes with an element name and attribute list |
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 |
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 |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ElementWithAttributes()
Method Detail |
---|
public void initialise(int nameCode, AttributeCollectionImpl atts, NodeInfo parent, 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 String getURIForPrefix(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 Iterator iteratePrefixes()
iteratePrefixes
in interface NamespaceResolver
public short getURICodeForPrefix(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 String getPrefixForURI(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 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
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.public final NodeInfo getFirstChild()
getFirstChild
in class NodeImpl
public final NodeInfo getLastChild()
getLastChild
in class NodeImpl
public String getStringValue()
Item.getStringValueCS()
public CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class NodeImpl
Item.getStringValue()
public 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 |