本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.moveXml方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.moveXml方法的具体用法?Java XmlCursor.moveXml怎么用?Java XmlCursor.moveXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlCursor
的用法示例。
在下文中一共展示了XmlCursor.moveXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveSrcToDest
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param srcCurs
* @param destCurs
* @param fDontMoveIfSame
* @return
*/
private boolean moveSrcToDest (XmlCursor srcCurs, XmlCursor destCurs, boolean fDontMoveIfSame)
{
boolean fMovedSomething = true;
TokenType tt;
do
{
if (fDontMoveIfSame && srcCurs.isInSameDocument(destCurs) && (srcCurs.comparePosition(destCurs) == 0))
{
// If the source and destination are pointing at the same place then there's nothing to move.
fMovedSomething = false;
break;
}
// todo ***TLL*** Use replaceContents (when added) and eliminate children removes (see above todo).
if (destCurs.currentTokenType().isStartdoc())
{
destCurs.toNextToken();
}
// todo ***TLL*** Can Eric support notion of copy instead of me copying then moving???
XmlCursor copyCurs = copy(srcCurs);
copyCurs.moveXml(destCurs);
copyCurs.dispose();
tt = srcCurs.currentTokenType();
} while (!tt.isStart() && !tt.isEnd() && !tt.isEnddoc());
return fMovedSomething;
}
示例2: removeToken
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param curs
*/
protected void removeToken (XmlCursor curs)
{
XmlObject xo = XmlObject.Factory.newInstance();
// Don't delete anything move to another document so it gets orphaned nicely.
XmlCursor tmpCurs = xo.newCursor();
tmpCurs.toFirstContentToken();
curs.moveXml(tmpCurs);
tmpCurs.dispose();
}