本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.ROOTNODE属性的典型用法代码示例。如果您正苦于以下问题:Java DTMDefaultBase.ROOTNODE属性的具体用法?Java DTMDefaultBase.ROOTNODE怎么用?Java DTMDefaultBase.ROOTNODE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase
的用法示例。
在下文中一共展示了DTMDefaultBase.ROOTNODE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStartNode
/**
* Set start to END should 'close' the iterator,
* i.e. subsequent call to next() should return END.
*
* @param node Sets the root of the iteration.
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
public DTMAxisIterator setStartNode(int node) {
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE) {
node = getDocument();
}
if (_isRestartable) {
_startNode = node;
_currentNode = (node == DTM.NULL) ? DTM.NULL : NOTPROCESSED;
return resetPosition();
}
return this;
}
示例2: setStartNode
/**
* Setting start to END should 'close' the iterator,
* i.e. subsequent call to next() should return END.
* <p>
* If the iterator is not restartable, this has no effect.
* %REVIEW% Should it return/throw something in that case,
* or set current node to END, to indicate request-not-honored?
*
* @param node Sets the root of the iteration.
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
public DTMAxisIterator setStartNode(int node)
{
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable) {
_startNode = node;
_currentNode = (node == DTM.NULL) ? DTM.NULL
: _firstch2(makeNodeIdentity(node));
return resetPosition();
}
return this;
}
示例3: setStartNode
/**
* Set the start node for this iterator
* @param node The start node
* @return A reference to this node iterator
*/
public DTMAxisIterator setStartNode(int node) {
if (_isRestartable) {
// KeyIndex iterators are always relative to the root node, so there
// is never any point in re-reading the iterator (and we SHOULD NOT).
boolean sourceIsKeyIndex = _source instanceof KeyIndex;
if (sourceIsKeyIndex
&& _startNode == DTMDefaultBase.ROOTNODE) {
return this;
}
if (node != _startNode) {
_source.setStartNode(_startNode = node);
_nodes.clear();
while ((node = _source.next()) != END) {
_nodes.add(node);
}
// Nodes produced by KeyIndex are known to be in document order.
// Take advantage of it.
if (!sourceIsKeyIndex) {
_nodes.sort();
}
_nodesSize = _nodes.cardinality();
_current = 0;
_lastNext = END;
resetPosition();
}
}
return this;
}
示例4: SAXImpl
/**
* Construct a SAXImpl object using the given block size.
*/
public SAXImpl(XSLTCDTMManager mgr, Source source,
int dtmIdentity, DTMWSFilter whiteSpaceFilter,
XMLStringFactory xstringfactory,
boolean doIndexing, int blocksize,
boolean buildIdIndex,
boolean newNameTable)
{
super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory,
doIndexing, blocksize, false, buildIdIndex, newNameTable);
_dtmManager = mgr;
_size = blocksize;
// Use a smaller size for the space stack if the blocksize is small
_xmlSpaceStack = new int[blocksize <= 64 ? 4 : 64];
/* From DOMBuilder */
_xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;
// If the input source is DOMSource, set the _document field and
// create the node2Ids table.
if (source instanceof DOMSource) {
_hasDOMSource = true;
DOMSource domsrc = (DOMSource)source;
Node node = domsrc.getNode();
if (node instanceof Document) {
_document = (Document)node;
}
else {
_document = node.getOwnerDocument();
}
_node2Ids = new Hashtable();
}
}
示例5: setStartNode
public DTMAxisIterator setStartNode(int node) {
_startNode = DTMDefaultBase.ROOTNODE;
if (_isRestartable) {
_source.setStartNode(_startNode);
resetPosition();
}
return this;
}
示例6: SAXImpl
/**
* Construct a SAXImpl object using the given block size.
*/
public SAXImpl(XSLTCDTMManager mgr, Source source,
int dtmIdentity, DTMWSFilter whiteSpaceFilter,
XMLStringFactory xstringfactory,
boolean doIndexing, int blocksize,
boolean buildIdIndex,
boolean newNameTable)
{
super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory,
doIndexing, blocksize, false, buildIdIndex, newNameTable);
_dtmManager = mgr;
_size = blocksize;
// Use a smaller size for the space stack if the blocksize is small
_xmlSpaceStack = new int[blocksize <= 64 ? 4 : 64];
/* From DOMBuilder */
_xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;
// If the input source is DOMSource, set the _document field and
// create the node2Ids table.
if (source instanceof DOMSource) {
_hasDOMSource = true;
DOMSource domsrc = (DOMSource)source;
Node node = domsrc.getNode();
if (node instanceof Document) {
_document = (Document)node;
}
else {
_document = node.getOwnerDocument();
}
_node2Ids = new HashMap<>();
}
}
示例7: next
/**
* Get the next node in the iteration.
*
* @return The next node handle in the iteration, or END.
*/
public int next()
{
final int startNode = _startNode;
if (_startNode == NULL) {
return NULL;
}
int node = _currentNode;
int expType;
final int nodeType = _nodeType;
if (nodeType != DTM.ELEMENT_NODE)
{
do
{
node++;
expType = _exptype2(node);
if (NULL == expType || _parent2(node) < startNode && startNode != node) {
_currentNode = NULL;
return END;
}
}
while (expType != nodeType);
}
// %OPT% If the start node is root (e.g. in the case of //node),
// we can save the isDescendant() check, because all nodes are
// descendants of root.
else if (startNode == DTMDefaultBase.ROOTNODE)
{
do
{
node++;
expType = _exptype2(node);
if (NULL == expType) {
_currentNode = NULL;
return END;
}
} while (expType < DTM.NTYPES
|| m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE);
}
else
{
do
{
node++;
expType = _exptype2(node);
if (NULL == expType || _parent2(node) < startNode && startNode != node) {
_currentNode = NULL;
return END;
}
}
while (expType < DTM.NTYPES
|| m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE);
}
_currentNode = node;
return returnNode(makeNodeHandle(node));
}