本文整理汇总了Java中org.apache.xml.dtm.DTM.getFirstChild方法的典型用法代码示例。如果您正苦于以下问题:Java DTM.getFirstChild方法的具体用法?Java DTM.getFirstChild怎么用?Java DTM.getFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xml.dtm.DTM
的用法示例。
在下文中一共展示了DTM.getFirstChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: outputResultTreeFragment
import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
* Given a result tree fragment, walk the tree and
* output it to the SerializationHandler.
*
* @param obj Result tree fragment object
* @param support XPath context for the result tree fragment
*
* @throws org.xml.sax.SAXException
*/
public static void outputResultTreeFragment(
SerializationHandler handler,
XObject obj,
XPathContext support)
throws org.xml.sax.SAXException
{
int doc = obj.rtf();
DTM dtm = support.getDTM(doc);
if (null != dtm)
{
for (int n = dtm.getFirstChild(doc);
DTM.NULL != n;
n = dtm.getNextSibling(n))
{
handler.flushPending();
// I think. . . . This used to have a (true) arg
// to flush prefixes, will that cause problems ???
if (dtm.getNodeType(n) == DTM.ELEMENT_NODE
&& dtm.getNamespaceURI(n) == null)
handler.startPrefixMapping("", "");
dtm.dispatchToEvents(n, handler);
}
}
}
示例2: asNode
import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
* Return the first node out of the nodeset, if this expression is
* a nodeset expression. This is the default implementation for
* nodesets.
* <p>WARNING: Do not mutate this class from this function!</p>
* @param xctxt The XPath runtime context.
* @return the first node out of the nodeset, or DTM.NULL.
*/
public int asNode(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
int current = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(current);
return dtm.getFirstChild(current);
}
示例3: execute
import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
* 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
{
int whereNode = getArg0AsNode(xctxt);
String fileLocation = null;
if (DTM.NULL != whereNode)
{
DTM dtm = xctxt.getDTM(whereNode);
// %REVIEW%
if (DTM.DOCUMENT_FRAGMENT_NODE == dtm.getNodeType(whereNode))
{
whereNode = dtm.getFirstChild(whereNode);
}
if (DTM.NULL != whereNode)
{
fileLocation = dtm.getDocumentBaseURI();
// int owner = dtm.getDocument();
// fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
}
}
return new XString((null != fileLocation) ? fileLocation : "");
}
示例4: DTMChildIterNodeList
import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
* Public constructor: Create a NodeList to support
* DTMNodeProxy.getChildren().
*
* Unfortunately AxisIterators and DTMIterators don't share an API,
* so I can't use the existing Axis.CHILD iterator. Rather than
* create Yet Another Class, let's set up a special case of this
* one.
*
* @param parentDTM The DTM containing this node
* @param parentHandle DTM node-handle integer
*
*/
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
m_parentDTM=parentDTM;
m_firstChild=parentDTM.getFirstChild(parentHandle);
}