Interface MutableNodeInfo
- All Superinterfaces:
Item
,NodeInfo
,PullEvent
,Source
,ValueRepresentation
- All Known Implementing Classes:
AbsentExtensionElement
,DataElement
,DocumentImpl
,ElementImpl
,ExtensionInstruction
,LiteralResultElement
,NodeImpl
,Orphan
,SaxonAssign
,SaxonBreak
,SaxonCallTemplate
,SaxonCollation
,SaxonContinue
,SaxonDoctype
,SaxonEntityRef
,SaxonFinally
,SaxonImportQuery
,SaxonIterate
,SaxonScript
,SaxonWhile
,SQLClose
,SQLColumn
,SQLConnect
,SQLDelete
,SQLInsert
,SQLQuery
,SQLUpdate
,StyleElement
,XSLAnalyzeString
,XSLApplyImports
,XSLApplyTemplates
,XSLAttribute
,XSLAttributeSet
,XSLCallTemplate
,XSLCharacterMap
,XSLChoose
,XSLComment
,XSLCopy
,XSLCopyOf
,XSLDecimalFormat
,XSLDocument
,XSLElement
,XSLFallback
,XSLForEach
,XSLForEachGroup
,XSLFunction
,XSLGeneralIncorporate
,XSLGeneralVariable
,XSLIf
,XSLImport
,XSLImportSchema
,XSLInclude
,XSLKey
,XSLMatchingSubstring
,XSLMessage
,XSLNamespace
,XSLNamespaceAlias
,XSLNextMatch
,XSLNumber
,XSLOtherwise
,XSLOutput
,XSLOutputCharacter
,XSLParam
,XSLPerformSort
,XSLPreserveSpace
,XSLProcessingInstruction
,XSLResultDocument
,XSLSequence
,XSLSort
,XSLStringConstructor
,XSLStylesheet
,XSLTemplate
,XSLText
,XSLValueOf
,XSLVariable
,XSLVariableDeclaration
,XSLWhen
,XSLWithParam
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNamespace
(int nscode, boolean inherit) Add a namespace binding (that is, a namespace node) to this element.void
delete()
Delete this node (that is, detach it from its parent).void
insertChildren
(NodeInfo[] source, boolean atStart, boolean inherit) Insert copies of a sequence of nodes as children of this node.void
insertSiblings
(NodeInfo[] source, boolean before, boolean inherit) Insert copies of a sequence of nodes as siblings of this node.Get a Builder suitable for building nodes that can be attached to this document.void
putAttribute
(int nameCode, int typeCode, CharSequence value, int properties) Add an attribute to this element node.void
removeAttribute
(int nameCode) Remove an attribute from this element nodevoid
Remove type information from this node (and its ancestors, recursively).void
rename
(int newNameCode) Rename this node.void
Replace this node with a given sequence of nodesvoid
replaceStringValue
(CharSequence stringValue) Replace the string-value of this node.void
setTypeAnnotation
(int typeCode) Set the type annotation on a node.Methods inherited from interface net.sf.saxon.om.Item
getStringValueCS, getTypedValue
Methods inherited from interface net.sf.saxon.om.NodeInfo
atomize, compareOrder, copy, equals, generateId, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getLineNumber, getLocalPart, getNameCode, getNamePool, getNodeKind, getParent, getPrefix, getRoot, getStringValue, getSystemId, getTypeAnnotation, getURI, hasChildNodes, hashCode, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis
Methods inherited from interface javax.xml.transform.Source
isEmpty, setSystemId
-
Method Details
-
setTypeAnnotation
void setTypeAnnotation(int typeCode) Set the type annotation on a node. This must only be called when the caller has verified (by validation) that the node is a valid instance of the specified type. The call is ignored if the node is not an element or attribute node.- Parameters:
typeCode
- the type annotation (possibly including high bits set to indicate the isID, isIDREF, and isNilled properties)
-
insertChildren
Insert copies of a sequence of nodes as children of this node.This method takes no action unless the target node is a document node or element node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes will be copied to form the new children. Adjacent text nodes will be merged, and zero-length text nodes removed.
- Parameters:
source
- the nodes to be insertedatStart
- true if the new nodes are to be inserted before existing children; false if they areinherit
- true if the insert nodes are to inherit the namespaces of their new parent; false if such namespaces are to be undeclared
-
insertSiblings
Insert copies of a sequence of nodes as siblings of this node.This method takes no action unless the target node is an element, text node, comment, or processing instruction, and one that has a parent node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes must use the same data model implementation as the tree into which they will be inserted.
- Parameters:
source
- the nodes to be insertedbefore
- true if the new nodes are to be inserted before the target node; false if they areinherit
- true if the insert nodes are to inherit the namespaces of their new parent; false if such namespaces are to be undeclared
-
removeAttribute
void removeAttribute(int nameCode) Remove an attribute from this element nodeIf this node is not an element, or if it has no attribute with the specified name, this method takes no action.
The attribute node itself is not modified in any way.
- Parameters:
nameCode
- the name of the attribute to be removed
-
putAttribute
Add an attribute to this element node.If this node is not an element, or if the supplied node is not an attribute, the method takes no action. If the element already has an attribute with this name, the existing attribute is replaced.
- Parameters:
nameCode
- the name of the new attributetypeCode
- the type annotation of the new attributevalue
- the string value of the new attributeproperties
- properties including IS_ID and IS_IDREF properties
-
delete
void delete()Delete this node (that is, detach it from its parent).If this node has preceding and following siblings that are both text nodes, the two text nodes will be joined into a single text node (the identity of this node with respect to its predecessors is undefined).
-
replace
Replace this node with a given sequence of nodes- Parameters:
replacement
- the replacement nodesinherit
- true if the replacement nodes are to inherit the namespaces of their new parent; false if such namespaces are to be undeclared- Throws:
IllegalArgumentException
- if any of the replacement nodes is of the wrong kind. When replacing a child node, the replacement nodes must all be elements, text, comment, or PI nodes; when replacing an attribute, the replacement nodes must all be attributes.
-
replaceStringValue
Replace the string-value of this node. If applied to an element or document node, this causes all existing children to be deleted, and replaced with a new text node whose string value is the value supplied. The caller is responsible for checking that the value is valid, for example that comments do not contain a double hyphen; the implementation is not required to check for such conditions.- Parameters:
stringValue
- the new string value
-
rename
void rename(int newNameCode) Rename this node.This call has no effect if applied to a nameless node, such as a text node or comment.
If necessary, a new namespace binding will be added to the target element, or to the element parent of the target attribute
- Parameters:
newNameCode
- the namecode of the new name in the name pool- Throws:
IllegalArgumentException
- if the new name code is not present in the name pool, or if it has a (prefix, uri) pair in which the prefix is the same as that of an existing in-scope namespace binding and the uri is different from that namespace binding.
-
addNamespace
void addNamespace(int nscode, boolean inherit) Add a namespace binding (that is, a namespace node) to this element. This call has no effect if applied to a node other than an element.- Parameters:
nscode
- The namespace code representing the (prefix, uri) pair of the namespace binding to be added. If the target element already has a namespace binding with this (prefix, uri) pair, the call has no effect. If the target element currently has a namespace binding with this prefix and a different URI, an exception is raised.inherit
- If true, the new namespace binding will be inherited by any children of the target element that do not already have a namespace binding for the specified prefix, recursively. If false, the new namespace binding will not be inherited.- Throws:
IllegalArgumentException
- if the namespace code is not present in the namepool, or if the target element already has a namespace binding for this prefix
-
removeTypeAnnotation
void removeTypeAnnotation()Remove type information from this node (and its ancestors, recursively). This method implements the upd:removeType() primitive defined in the XQuery Update specification. (Note: the caller is responsible for updating the set of nodes marked for revalidation) -
newBuilder
Builder newBuilder()Get a Builder suitable for building nodes that can be attached to this document.- Returns:
- a new Builder that constructs nodes using the same object model implementation as this one, suitable for attachment to this tree
-