Package net.sf.saxon.style
Class XSLStylesheet
- java.lang.Object
-
- net.sf.saxon.tree.NodeImpl
-
- net.sf.saxon.tree.ElementImpl
-
- net.sf.saxon.style.StyleElement
-
- net.sf.saxon.style.XSLStylesheet
-
- All Implemented Interfaces:
java.io.Serializable
,javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,LocationProvider
,SaxonLocator
,PullEvent
,Container
,FingerprintedNode
,Item
,MutableNodeInfo
,NamespaceResolver
,NodeInfo
,SiblingCountingNode
,ValueRepresentation
,InstructionInfo
,org.xml.sax.Locator
public class XSLStylesheet extends StyleElement
An xsl:stylesheet or xsl:transform element in the stylesheet.
Note this element represents a stylesheet module, not necessarily the whole stylesheet. However, much of the functionality (and the fields) are relevant only to the top-level module.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANNOTATION_PRESERVE
static int
ANNOTATION_STRIP
protected java.lang.Object
children
protected int
sequence
-
Fields inherited from class net.sf.saxon.style.StyleElement
defaultCollationName, defaultXPathNamespace, extensionNamespaces, REPORT_ALWAYS, REPORT_IF_INSTANTIATED, REPORT_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE, reportingCircumstances, staticContext, validationError, version
-
Fields inherited from class net.sf.saxon.tree.ElementImpl
attributeList, nameCode, namespaceList, typeCode
-
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
Constructors Constructor Description XSLStylesheet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(NodeImpl node, int index)
Add a child node to this node.protected void
addImportedSchema(java.lang.String targetNamespace)
int
allocateGlobalSlot(StructuredQName qName)
Allocate a slot number for a global variable or parametervoid
allocatePatternSlots(int n)
Ensure there is enough space for local variables or parameters when evaluating the match pattern of template rulesint
allocateUniqueParameterNumber(StructuredQName qName)
Allocate a unique number to a local parameter name.boolean
allowsAllBuiltInTypes()
Determine whether the use of non-primitive built-in types has been enabled for this stylesheet (This is relevant only for Saxon-B: such types are always permitted in Saxon-SA)void
compact(int size)
Compact the space used by this nodeExpression
compile(Executable exec)
Dummy compile() method to satisfy the interfaceExecutable
compileStylesheet()
Compile the stylesheet to create an executable.protected void
declareJavaClass(java.lang.String uri, java.lang.Class theClass)
Declare a URI that maps to a Java class containing extension functionsprotected void
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery functionprotected AxisIterator
enumerateChildren(NodeTest test)
Get an enumeration of the children of this nodeprotected StringCollator
findCollation(java.lang.String name)
Find a named collation.java.util.Properties
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.XSLCharacterMap
getCharacterMap(StructuredQName name)
Get a character map, identified by the fingerprint of its name.CollationMap
getCollationMap()
Get the collation mapDecimalFormatManager
getDecimalFormatManager()
Get the DecimalFormatManager which handles decimal-format definitionsjava.lang.String
getDefaultCollationName()
Get the name of the default collationint
getDefaultValidation()
Get the value of the default validation attributeExecutable
getExecutable()
Get the run-time Executable objectNodeInfo
getFirstChild()
Get the first child node of the elementFunctionLibrary
getFunctionLibrary()
Get the function library.XSLVariableDeclaration
getGlobalVariable(StructuredQName qName)
Get the global variable or parameter with a given name (taking precedence rules into account)protected java.util.HashSet
getImportedSchemaTable()
XSLStylesheet
getImporter()
Get the StyleSheet that included or imported this one.int
getInputTypeAnnotations()
Get the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules.int
getInputTypeAnnotationsAttribute()
Get the value of the input-type-annotations attribute, for this module alone.KeyManager
getKeyManager()
Get the KeyManager which handles key definitionsNodeInfo
getLastChild()
Get the last child node of the elementLocationMap
getLocationMap()
Get the locationMap objectint
getMinImportPrecedence()
Get the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this oneprotected int
getNamespaceAlias(short uriCode)
Get the declared namespace alias for a given namespace URI code if there is one.protected NodeImpl
getNthChild(int n)
Get the nth child node of the element (numbering from 0)int
getNumberOfChildren()
Determine how many children the node hasint
getPrecedence()
Get the import precedence of this stylesheetPreparedStylesheet
getPreparedStylesheet()
Get the owning PreparedStylesheet objectRuleManager
getRuleManager()
Get the RuleManager which handles template rulesprotected 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.protected Mode
getStripperRules()
Get the rules determining which nodes are to be stripped from the treejava.util.List
getTopLevel()
Get the top level elements in this stylesheet, after applying include/importboolean
hasChildNodes()
Determine if the node has any children.protected boolean
hasNamespaceAliases()
void
insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
Insert copies of a sequence of nodes as children of this node.protected void
insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
Insert children before or after a given existing childprotected boolean
isAliasResultNamespace(short uriCode)
Determine if a namespace is included in the result-prefix of a namespace-aliasprotected boolean
isImportedSchema(java.lang.String targetNamespace)
Get an imported schema with a given namespaceprotected boolean
mayContainParam()
Determine whether this type of element is allowed to contain an xsl:param elementvoid
prepareAttributes()
Prepare the attributes on the stylesheet elementvoid
preprocess()
Preprocess does all the processing possible before the source document is available.void
processAllAttributes()
Process the attributes of every node in the stylesheetprotected void
removeChild(NodeImpl child)
Remove a given childprotected void
replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
Replace child at a given index by new childrenvoid
setCollation(java.lang.String name, StringCollator collation)
Register a named collation (actually a StringCollator)void
setImporter(XSLStylesheet importer)
Set the StyleSheet that included or imported this one.void
setInputTypeAnnotations(int annotations)
Set the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules.void
setMinImportPrecedence(int precedence)
Set the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this onevoid
setNeedsDynamicOutputProperties(boolean b)
Set that this stylesheet needs dynamic output propertiesvoid
setPrecedence(int prec)
Set the import precedence of this stylesheetvoid
setPreparedStylesheet(PreparedStylesheet sheet)
Create link to the owning PreparedStylesheet objectvoid
setWasIncluded()
Indicate that this stylesheet was included (by its "importer") using an xsl:include statement as distinct from xsl:importvoid
spliceIncludes()
Process xsl:include and xsl:import elements.boolean
stripsWhitespace()
Determine whether this stylesheet does any whitespace strippingprotected void
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children.void
validate()
Validate this element-
Methods inherited from class net.sf.saxon.style.StyleElement
allocateLocationId, allocatePatternSlots, allocateSlots, backwardsCompatibleModeIsEnabled, bindVariable, checkEmpty, checkSortComesFirst, checkTopLevel, checkUnknownAttribute, checkWithinTemplate, compileError, compileError, compileError, compileSequenceConstructor, compileWarning, definesExcludedNamespace, definesExtensionElement, fallbackProcessing, fixupReferences, forwardsCompatibleModeIsEnabled, getAllStylesheetFunctions, getAttributeSets, getAttributeValue, getColumnNumber, getCommonChildItemType, getConstructType, getContainingSlotManager, getContainingStylesheet, getDefaultXPathNamespace, getHostLanguage, getLastChildInstruction, getLineNumber, getLocationProvider, getNamespaceResolver, getObjectName, getPrincipalStylesheet, getProperties, getProperty, getReturnedItemType, getSchemaType, getStaticContext, getStylesheetFunction, getSystemId, getTypeAnnotation, getVersion, getWithParamInstructions, isExcludedNamespace, isExplaining, isExtensionNamespace, isInstruction, isPermittedChild, issueWarning, issueWarning, isTopLevel, makeAttributeValueTemplate, makeExpression, makeExpressionVisitor, makeNamespaceContext, makePattern, makeQName, makeSequenceType, makeSortKeys, makeTraceInstruction, markTailCalls, mayContainFallback, mayContainSequenceConstructor, postValidate, processAttributes, processDefaultCollationAttribute, processDefaultXPathNamespaceAttribute, processExcludedNamespaces, processExtensionElementAttribute, processVersionAttribute, replaceSubExpression, reportAbsence, setObjectName, setValidationError, substituteFor, typeCheck, typeCheck, undeclaredNamespaceError, validateChildren, validateSubtree
-
Methods inherited from class net.sf.saxon.tree.ElementImpl
addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getDocumentRoot, getInScopeNamespaceCodes, getLineNumber, getNameCode, getNodeKind, getPrefixForURI, getRoot, getSystemId, getTypeAnnotation, getURICodeForPrefix, getURICodeForPrefixCode, getURIForPrefix, initialise, isNilled, iteratePrefixes, putAttribute, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setLineAndColumn, setLocation, setNameCode, setNamespaceDeclarations, setSystemId, setTypeAnnotation
-
Methods inherited from class net.sf.saxon.tree.NodeImpl
atomize, compareOrder, equals, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getSiblingPosition, getTypedValue, getURI, insertSiblings, isId, isIdref, isSameNodeInfo, iterateAxis, iterateAxis, newBuilder, replace
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.InstructionInfo
getLineNumber, getSystemId
-
-
-
-
Field Detail
-
ANNOTATION_STRIP
public static final int ANNOTATION_STRIP
- See Also:
- Constant Field Values
-
ANNOTATION_PRESERVE
public static final int ANNOTATION_PRESERVE
- See Also:
- Constant Field Values
-
children
protected java.lang.Object children
-
sequence
protected int sequence
-
-
Method Detail
-
setPreparedStylesheet
public void setPreparedStylesheet(PreparedStylesheet sheet)
Create link to the owning PreparedStylesheet object- Parameters:
sheet
- the PreparedStylesheet
-
getPreparedStylesheet
public PreparedStylesheet getPreparedStylesheet()
Get the owning PreparedStylesheet object- Overrides:
getPreparedStylesheet
in classStyleElement
- Returns:
- the PreparedStylesheet to which this stylesheet element belongs. Exceptionally (with early errors in a simplified stylesheet module) return null.
-
getExecutable
public Executable getExecutable()
Get the run-time Executable object- Specified by:
getExecutable
in interfaceContainer
- Overrides:
getExecutable
in classStyleElement
- Returns:
- the executable
-
mayContainParam
protected boolean mayContainParam()
Description copied from class:StyleElement
Determine whether this type of element is allowed to contain an xsl:param element- Overrides:
mayContainParam
in classStyleElement
- Returns:
- true if this element is allowed to contain an xsl:param
-
getFunctionLibrary
public FunctionLibrary getFunctionLibrary()
Get the function library. Available only on the principal stylesheet module- Returns:
- the function library
-
getLocationMap
public LocationMap getLocationMap()
Get the locationMap object- Returns:
- the LocationMap
-
getRuleManager
public RuleManager getRuleManager()
Get the RuleManager which handles template rules- Returns:
- the template rule manager
-
getStripperRules
protected Mode getStripperRules()
Get the rules determining which nodes are to be stripped from the tree- Returns:
- the Mode object holding the whitespace stripping rules. The stripping rules defined in xsl:strip-space are managed in the same way as template rules, hence the use of a special Mode object
-
stripsWhitespace
public boolean stripsWhitespace()
Determine whether this stylesheet does any whitespace stripping- Returns:
- true if this stylesheet strips whitespace from source documents
-
getKeyManager
public KeyManager getKeyManager()
Get the KeyManager which handles key definitions- Returns:
- the key manager
-
getDecimalFormatManager
public DecimalFormatManager getDecimalFormatManager()
Get the DecimalFormatManager which handles decimal-format definitions- Returns:
- the DecimalFormatManager for this stylesheet
-
getCollationMap
public CollationMap getCollationMap()
Get the collation map- Returns:
- the CollationMap
-
setCollation
public void setCollation(java.lang.String name, StringCollator collation)
Register a named collation (actually a StringCollator)- Parameters:
name
- the name of the collationcollation
- the StringCollator that implements this collation
-
findCollation
protected StringCollator findCollation(java.lang.String name)
Find a named collation. Note this method should only be used at compile-time, before declarations have been pre-processed. After that time, use getCollation().- Parameters:
name
- identifies the name of the collation required; null indicates that the default collation is required- Returns:
- null if the collation is not found
-
getDefaultCollationName
public java.lang.String getDefaultCollationName()
Get the name of the default collation- Overrides:
getDefaultCollationName
in classStyleElement
- Returns:
- the name of the default collation
-
getCharacterMap
public XSLCharacterMap getCharacterMap(StructuredQName name)
Get a character map, identified by the fingerprint of its name. Search backwards through the stylesheet.- Parameters:
name
- The character map name being sought- Returns:
- the identified character map, or null if not found
-
setPrecedence
public void setPrecedence(int prec)
Set the import precedence of this stylesheet- Parameters:
prec
- the import precedence. Higher numbers indicate higher precedence, but the actual number has no significance
-
getPrecedence
public int getPrecedence()
Get the import precedence of this stylesheet- Overrides:
getPrecedence
in classStyleElement
- Returns:
- the import precedence. The actual numeric value is arbitrary, but a higher number indicates a higher precedence.
-
getMinImportPrecedence
public int getMinImportPrecedence()
Get the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one- Returns:
- the minimum precedence of imported stylesheet modules
-
setMinImportPrecedence
public void setMinImportPrecedence(int precedence)
Set the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one- Parameters:
precedence
- the precedence of the first stylesheet module that this one imports
-
setImporter
public void setImporter(XSLStylesheet importer)
Set the StyleSheet that included or imported this one.- Parameters:
importer
- the stylesheet module that included or imported this module
-
getImporter
public XSLStylesheet getImporter()
Get the StyleSheet that included or imported this one.- Returns:
- null if this is the principal stylesheet
-
setWasIncluded
public void setWasIncluded()
Indicate that this stylesheet was included (by its "importer") using an xsl:include statement as distinct from xsl:import
-
getTopLevel
public java.util.List getTopLevel()
Get the top level elements in this stylesheet, after applying include/import- Returns:
- a list of top-level elements in this stylesheet module or in those modules that it includes or imports
-
allocateGlobalSlot
public int allocateGlobalSlot(StructuredQName qName)
Allocate a slot number for a global variable or parameter- Parameters:
qName
- the name of the variable or parameter- Returns:
- int the allocated slot number
-
allocatePatternSlots
public void allocatePatternSlots(int n)
Ensure there is enough space for local variables or parameters when evaluating the match pattern of template rules- Parameters:
n
- the number of slots to be allocated
-
prepareAttributes
public void prepareAttributes() throws XPathException
Prepare the attributes on the stylesheet element- Specified by:
prepareAttributes
in classStyleElement
- Throws:
XPathException
-
getDefaultValidation
public int getDefaultValidation()
Get the value of the default validation attribute- Returns:
- the value of the default-validation attribute, as a constant such
as
Validation.STRIP
-
getInputTypeAnnotationsAttribute
public int getInputTypeAnnotationsAttribute() throws XPathException
Get the value of the input-type-annotations attribute, for this module alone. The value is an or-ed combination of the two bitsANNOTATION_STRIP
andANNOTATION_PRESERVE
- Returns:
- the value if the input-type-annotations attribute in this stylesheet module
- Throws:
XPathException
-
getInputTypeAnnotations
public int getInputTypeAnnotations()
Get the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules. The value is an or-ed combination of the two bitsANNOTATION_STRIP
andANNOTATION_PRESERVE
- Returns:
- the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules
-
setInputTypeAnnotations
public void setInputTypeAnnotations(int annotations) throws XPathException
Set the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules. The value is an or-ed combination of the two bitsANNOTATION_STRIP
andANNOTATION_PRESERVE
- Parameters:
annotations
- the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules.- Throws:
XPathException
-
allowsAllBuiltInTypes
public boolean allowsAllBuiltInTypes()
Determine whether the use of non-primitive built-in types has been enabled for this stylesheet (This is relevant only for Saxon-B: such types are always permitted in Saxon-SA)- Returns:
- true if all built-in types can be used
-
getNamespaceAlias
protected int getNamespaceAlias(short uriCode)
Get the declared namespace alias for a given namespace URI code if there is one. If there is more than one, we get the last.- Parameters:
uriCode
- The code of the uri used in the stylesheet.- Returns:
- The namespace code to be used (prefix in top half, uri in bottom half): return -1 if no alias is defined
-
isAliasResultNamespace
protected boolean isAliasResultNamespace(short uriCode)
Determine if a namespace is included in the result-prefix of a namespace-alias- Parameters:
uriCode
- the namepool code of the URI- Returns:
- true if an xsl:namespace-alias has been defined for this namespace URI
-
validate
public void validate() throws XPathException
Validate this element- Overrides:
validate
in classStyleElement
- Throws:
XPathException
-
preprocess
public void preprocess() throws XPathException
Preprocess does all the processing possible before the source document is available. It is done once per stylesheet, so the stylesheet can be reused for multiple source documents. The method is called only on the XSLStylesheet element representing the principal stylesheet module- Throws:
XPathException
-
spliceIncludes
public void spliceIncludes() throws XPathException
Process xsl:include and xsl:import elements.- Throws:
XPathException
-
hasNamespaceAliases
protected boolean hasNamespaceAliases()
-
processAllAttributes
public void processAllAttributes() throws XPathException
Process the attributes of every node in the stylesheet- Overrides:
processAllAttributes
in classStyleElement
- Throws:
XPathException
- in the event of a static error being detected
-
getGlobalVariable
public XSLVariableDeclaration getGlobalVariable(StructuredQName qName)
Get the global variable or parameter with a given name (taking precedence rules into account)- Parameters:
qName
- name of the global variable or parameter- Returns:
- the variable declaration
-
setNeedsDynamicOutputProperties
public void setNeedsDynamicOutputProperties(boolean b)
Set that this stylesheet needs dynamic output properties- Parameters:
b
- true if this stylesheet needs dynamic output properties
-
gatherOutputProperties
public java.util.Properties gatherOutputProperties(StructuredQName formatQName) throws XPathException
Create an output properties object representing the xsl:output elements in the stylesheet.- Parameters:
formatQName
- The name of the output format required. If set to null, gathers information for the unnamed output format- Returns:
- the Properties object containing the details of the specified output format
- Throws:
XPathException
- if a named output format does not exist in the stylesheet
-
declareXQueryFunction
protected void declareXQueryFunction(XQueryFunction function) throws XPathException
Declare an imported XQuery function- Parameters:
function
- the imported function- Throws:
XPathException
-
declareJavaClass
protected void declareJavaClass(java.lang.String uri, java.lang.Class theClass)
Declare a URI that maps to a Java class containing extension functions- Parameters:
uri
- the namespace uri used in the function namestheClass
- the Java class containing methods accessible using this URI
-
isImportedSchema
protected boolean isImportedSchema(java.lang.String targetNamespace)
Get an imported schema with a given namespace- Parameters:
targetNamespace
- The target namespace of the required schema. Supply an empty string for the default namespace- Returns:
- the required Schema, or null if no such schema has been imported
-
addImportedSchema
protected void addImportedSchema(java.lang.String targetNamespace)
-
getImportedSchemaTable
protected java.util.HashSet getImportedSchemaTable()
-
compileStylesheet
public Executable compileStylesheet() throws XPathException
Compile the stylesheet to create an executable.- Returns:
- the Executable representing the compiled stylesheet
- Throws:
XPathException
-
compile
public Expression compile(Executable exec)
Dummy compile() method to satisfy the interface- Specified by:
compile
in classStyleElement
- Parameters:
exec
- the Executable- Returns:
- either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.
-
allocateUniqueParameterNumber
public int allocateUniqueParameterNumber(StructuredQName qName)
Allocate a unique number to a local parameter name. This should only be called on the principal stylesheet module.- Parameters:
qName
- the local parameter name- Returns:
- an integer that uniquely identifies this parameter name within the stylesheet
-
getSequenceNumber
protected final long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and document nodes) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position. For nodes added by XQUery Update, the sequence number is -1L- Overrides:
getSequenceNumber
in classNodeImpl
- Returns:
- the sequence number if there is one, or -1L otherwise.
-
hasChildNodes
public final boolean hasChildNodes()
Determine if the node has any children.- Specified by:
hasChildNodes
in interfaceNodeInfo
- Overrides:
hasChildNodes
in classNodeImpl
- Returns:
true
if the node has any children,false
if the node has no children.
-
getNumberOfChildren
public int getNumberOfChildren()
Determine how many children the node has- Returns:
- the number of children of this parent node
-
enumerateChildren
protected final AxisIterator enumerateChildren(NodeTest test)
Get an enumeration of the children of this node- Parameters:
test
- A NodeTest to be satisfied by the child nodes, or null if all child node are to be returned- Returns:
- an iterator over the children of this node
-
getFirstChild
public final NodeInfo getFirstChild()
Get the first child node of the element- Overrides:
getFirstChild
in classNodeImpl
- Returns:
- the first child node of the required type, or null if there are no children
-
getLastChild
public final NodeInfo getLastChild()
Get the last child node of the element- Overrides:
getLastChild
in classNodeImpl
- Returns:
- the last child of the element, or null if there are no children
-
getNthChild
protected final NodeImpl getNthChild(int n)
Get the nth child node of the element (numbering from 0)- Parameters:
n
- identifies the required child- Returns:
- the last child of the element, or null if there is no n'th child
-
removeChild
protected void removeChild(NodeImpl child)
Remove a given child- Parameters:
child
- the child to be removed
-
getStringValue
public 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.- Returns:
- the accumulated character content of the element, including descendant elements.
- See Also:
Item.getStringValueCS()
-
getStringValueCS
public java.lang.CharSequence getStringValueCS()
Description copied from class:NodeImpl
Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String.- Specified by:
getStringValueCS
in interfaceItem
- Specified by:
getStringValueCS
in interfaceValueRepresentation
- Overrides:
getStringValueCS
in classNodeImpl
- Returns:
- the string value of the item
- See Also:
Item.getStringValue()
-
useChildrenArray
protected void useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children. For system use only.- Parameters:
array
- the array to be used
-
addChild
public void addChild(NodeImpl node, int index)
Add a child node to this node. For system use only. Note: normalizing adjacent text nodes is the responsibility of the caller.- Parameters:
node
- the node to be added as a child of this nodeindex
- the position where the child is to be added
-
insertChildren
public void insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
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.
- Specified by:
insertChildren
in interfaceMutableNodeInfo
- Overrides:
insertChildren
in classNodeImpl
- 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 inserted nodes are to inherit the namespaces that are in-scope for their new parent; false if such namespaces should be undeclared on the children
-
insertChildrenAt
protected void insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
Insert children before or after a given existing child- Parameters:
source
- the children to be insertedindex
- the position before which they are to be inserted: 0 indicates insertion before the first child, 1 insertion before the second child, and so on.inherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their new parent; false if such namespaces should be undeclared on the children
-
replaceChildrenAt
protected void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
Replace child at a given index by new children- Parameters:
source
- the children to be insertedindex
- the position at which they are to be inserted: 0 indicates replacement of the first child, replacement of the second child, and so on. The effect is undefined if index is out of rangeinherit
- set to true if the new child elements are to inherit the in-scope namespaces of their new parent- Throws:
java.lang.IllegalArgumentException
- if any of the replacement nodes is not an element, text, comment, or processing instruction node
-
compact
public void compact(int size)
Compact the space used by this node- Parameters:
size
- the number of actual children
-
-