本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.DTM.NULL属性的典型用法代码示例。如果您正苦于以下问题:Java DTM.NULL属性的具体用法?Java DTM.NULL怎么用?Java DTM.NULL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xml.internal.dtm.DTM
的用法示例。
在下文中一共展示了DTM.NULL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLanguage
/**
* Returns a node' defined language for a node (if any)
*/
public String getLanguage(int node)
{
int parent = node;
while (DTM.NULL != parent) {
if (DTM.ELEMENT_NODE == getNodeType(parent)) {
int langAttr = getAttributeNode(parent, "http://www.w3.org/XML/1998/namespace", "lang");
if (DTM.NULL != langAttr) {
return getNodeValue(langAttr);
}
}
parent = getParent(parent);
}
return(null);
}
示例2: putDocumentInCache
/**
* Put the source tree root node in the document cache.
* TODO: This function needs to be a LOT more sophisticated.
*
* @param n The node to cache.
* @param source The Source object to cache.
*/
public void putDocumentInCache(int n, Source source)
{
int cachedNode = getNode(source);
if (DTM.NULL != cachedNode)
{
if (!(cachedNode == n))
throw new RuntimeException(
"Programmer's Error! "
+ "putDocumentInCache found reparse of doc: "
+ source.getSystemId());
return;
}
if (null != source.getSystemId())
{
m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
}
}
示例3: execute
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
DTMIterator nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
double sum = 0.0;
int pos;
while (DTM.NULL != (pos = nodes.nextNode()))
{
DTM dtm = nodes.getDTM(pos);
XMLString s = dtm.getStringValue(pos);
if (null != s)
sum += s.toDouble();
}
nodes.detach();
return new XNumber(sum);
}
示例4: getCurrentNode
/**
* Return the last fetched node. Needed to support the UnionPathIterator.
*
* @return the last fetched node.
* @throws RuntimeException thrown if this NodeSetDTM is not of
* a cached type, and thus doesn't permit indexed access.
*/
public int getCurrentNode()
{
if (!m_cacheNodes)
throw new RuntimeException(
"This NodeSetDTM can not do indexing or counting functions!");
int saved = m_next;
// because nextNode always increments
// But watch out for copy29, where the root iterator didn't
// have nextNode called on it.
int current = (m_next > 0) ? m_next-1 : m_next;
int n = (current < m_firstFree) ? elementAt(current) : DTM.NULL;
m_next = saved; // HACK: I think this is a bit of a hack. -sb
return n;
}
示例5: nextNode
/** @return the next node in the set and advance the position of the
* iterator in the set.
*
* @throws DOMException - INVALID_STATE_ERR Raised if this method is
* called after the detach method was invoked.
* */
public Node nextNode() throws DOMException
{
if(!valid)
throw new DTMDOMException(DOMException.INVALID_STATE_ERR);
int handle=dtm_iter.nextNode();
if (handle==DTM.NULL)
return null;
return dtm_iter.getDTM(handle).getNode(handle);
}
示例6: getStringValueX
public String getStringValueX(final int node)
{
if (_enhancedDOM != null) {
return _enhancedDOM.getStringValueX(node);
}
else {
if (node == DTM.NULL) {
return "";
}
return _dom.getStringValueX(node);
}
}
示例7: getNextNode
/**
* Get the next node via getFirstAttribute && getNextAttribute.
*/
protected int getNextNode()
{
m_lastFetched = (DTM.NULL == m_lastFetched)
? m_cdtm.getFirstAttribute(m_context)
: m_cdtm.getNextAttribute(m_lastFetched);
return m_lastFetched;
}
示例8: item
/**
* Returns the <code>index</code>th item in the collection. If
* <code>index</code> is greater than or equal to the number of nodes in
* the list, this returns <code>null</code>.
* @param index Index into the collection.
* @return The node at the <code>index</code>th position in the
* <code>NodeList</code>, or <code>null</code> if that is not a valid
* index.
*/
public Node item(int index)
{
if (m_iter != null) {
int handle=m_iter.item(index);
if (handle == DTM.NULL) {
return null;
}
return m_iter.getDTM(handle).getNode(handle);
} else {
return null;
}
}
示例9: getPreviousSibling
public int getPreviousSibling(int nodeHandle)
{
return DTM.NULL;
}
示例10: endNode
/**
* End processing of given node
*
*
* @param node Node we just finished processing
*
* @throws org.xml.sax.SAXException
*/
protected void endNode(int node) throws org.xml.sax.SAXException
{
switch (m_dtm.getNodeType(node))
{
case DTM.DOCUMENT_NODE :
this.m_contentHandler.endDocument();
break;
case DTM.ELEMENT_NODE :
String ns = m_dtm.getNamespaceURI(node);
if(null == ns)
ns = "";
this.m_contentHandler.endElement(ns,
m_dtm.getLocalName(node),
m_dtm.getNodeName(node));
for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn;
nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
{
// String prefix = m_dtm.getPrefix(nsn);
String prefix = m_dtm.getNodeNameX(nsn);
this.m_contentHandler.endPrefixMapping(prefix);
}
break;
case DTM.CDATA_SECTION_NODE :
break;
case DTM.ENTITY_REFERENCE_NODE :
{
if (m_contentHandler instanceof LexicalHandler)
{
LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
lh.endEntity(m_dtm.getNodeName(node));
}
}
break;
default :
}
}
示例11: getAttributeNode
/**
* Retrieves an attribute node by by qualified name and namespace URI.
*
* @param nodeHandle int Handle of the node upon which to look up this attribute..
* @param namespaceURI The namespace URI of the attribute to
* retrieve, or null.
* @param name The local name of the attribute to
* retrieve.
* @return The attribute node handle with the specified name (
* <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such
* attribute.
*/
public int getAttributeNode(int nodeHandle, String namespaceURI,
String name)
{
// %OPT% This is probably slower than it needs to be.
if (null == namespaceURI)
namespaceURI = "";
int type = getNodeType(nodeHandle);
if (DTM.ELEMENT_NODE == type)
{
// Assume that attributes immediately follow the element.
int identity = makeNodeIdentity(nodeHandle);
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
// Assume this can not be null.
type = _type(identity);
// %REVIEW%
// Should namespace nodes be retrievable DOM-style as attrs?
// If not we need a separate function... which may be desirable
// architecturally, but which is ugly from a code point of view.
// (If we REALLY insist on it, this code should become a subroutine
// of both -- retrieve the node, then test if the type matches
// what you're looking for.)
if (type == DTM.ATTRIBUTE_NODE || type==DTM.NAMESPACE_NODE)
{
Node node = lookupNode(identity);
String nodeuri = node.getNamespaceURI();
if (null == nodeuri)
nodeuri = "";
String nodelocalname = node.getLocalName();
if (nodeuri.equals(namespaceURI) && name.equals(nodelocalname))
return makeNodeHandle(identity);
}
else // if (DTM.NAMESPACE_NODE != type)
{
break;
}
}
}
return DTM.NULL;
}
示例12: nextNode
/**
* Returns the next node in the set and advances the position of the
* iterator in the set. After a NodeIterator is created, the first call
* to nextNode() returns the first node in the set.
*
* @return The next <code>Node</code> in the set being iterated over, or
* <code>null</code> if there are no more members in that set.
*/
public int nextNode()
{
if(m_foundLast)
{
m_lastFetched = DTM.NULL;
return DTM.NULL;
}
if(DTM.NULL == m_lastFetched)
{
resetProximityPositions();
}
int next;
com.sun.org.apache.xpath.internal.VariableStack vars;
int savedStart;
if (-1 != m_stackFrame)
{
vars = m_execContext.getVarStack();
// These three statements need to be combined into one operation.
savedStart = vars.getStackFrame();
vars.setStackFrame(m_stackFrame);
}
else
{
// Yuck. Just to shut up the compiler!
vars = null;
savedStart = 0;
}
try
{
do
{
next = getNextNode();
if (DTM.NULL != next)
{
if(DTMIterator.FILTER_ACCEPT == acceptNode(next))
break;
else
continue;
}
else
break;
}
while (next != DTM.NULL);
if (DTM.NULL != next)
{
m_pos++;
return next;
}
else
{
m_foundLast = true;
return DTM.NULL;
}
}
finally
{
if (-1 != m_stackFrame)
{
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
}
}
}
示例13: getProximityPosition
/**
* Get the current sub-context position. In order to do the
* reverse axes count, for the moment this re-searches the axes
* up to the predicate. An optimization on this is to cache
* the nodes searched, but, for the moment, this case is probably
* rare enough that the added complexity isn't worth it.
*
* @param predicateIndex The predicate index of the proximity position.
*
* @return The pridicate index, or -1.
*/
protected int getProximityPosition(int predicateIndex)
{
if(!isReverseAxes())
return super.getProximityPosition(predicateIndex);
// A negative predicate index seems to occur with
// (preceding-sibling::*|following-sibling::*)/ancestor::*[position()]/*[position()]
// -sb
if(predicateIndex < 0)
return -1;
if (m_proximityPositions[predicateIndex] <= 0)
{
XPathContext xctxt = getXPathContext();
try
{
OneStepIterator clone = (OneStepIterator) this.clone();
int root = getRoot();
xctxt.pushCurrentNode(root);
clone.setRoot(root, xctxt);
// clone.setPredicateCount(predicateIndex);
clone.m_predCount = predicateIndex;
// Count 'em all
int count = 1;
int next;
while (DTM.NULL != (next = clone.nextNode()))
{
count++;
}
m_proximityPositions[predicateIndex] += count;
}
catch (CloneNotSupportedException cnse)
{
// can't happen
}
finally
{
xctxt.popCurrentNode();
}
}
return m_proximityPositions[predicateIndex];
}
示例14: gotoMark
public void gotoMark() {
m_ancestorsPos = m_markedPos;
_currentNode = m_ancestorsPos>=0 ? m_ancestors[m_ancestorsPos]
: DTM.NULL;
}
示例15: getDocumentURI
public String getDocumentURI(int node) {
if (node == DTM.NULL) {
node = DOM.NULL;
}
return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getDocumentURI(0);
}