本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.pop方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.pop方法的具体用法?Java XmlCursor.pop怎么用?Java XmlCursor.pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlCursor
的用法示例。
在下文中一共展示了XmlCursor.pop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNamespaces
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static void getNamespaces(XmlCursor cursor, Map prefixToURI)
{
cursor.push();
while(cursor.toNextToken().isAnyAttr())
{
if(cursor.isNamespace())
{
javax.xml.namespace.QName name = cursor.getName();
String prefix = name.getLocalPart();
String uri = name.getNamespaceURI();
prefixToURI.put(prefix, uri);
}
}
cursor.pop();
}
示例2: removeNamespace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static void removeNamespace(XmlCursor cursor, String prefix)
{
cursor.push();
while(cursor.toNextToken().isAnyAttr())
{
if(cursor.isNamespace())
{
javax.xml.namespace.QName name = cursor.getName();
if(name.getLocalPart().equals(prefix))
{
cursor.removeXml();
break;
}
}
}
cursor.pop();
}
示例3: AttributeTypeImpl
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public AttributeTypeImpl(AttributeType attributeType) {
this.attributeType = attributeType;
final XmlCursor xmlCursor = attributeType.newCursor();
sampleAttributeElementLineNumber = (XmlLineNumber) xmlCursor.getBookmark(XmlLineNumber.class);
xmlCursor.push();
xmlCursor.toChild("TAG");
tagElementLineNumber = (XmlLineNumber) xmlCursor.getBookmark(XmlLineNumber.class);
xmlCursor.pop();
xmlCursor.push();
xmlCursor.toChild("VALUE");
valueElementLineNumber = (XmlLineNumber) xmlCursor.getBookmark(XmlLineNumber.class);
xmlCursor.pop();
if (xmlCursor.toChild("UNITS")) {
unitsElementLineNumber = (XmlLineNumber) xmlCursor.getBookmark(XmlLineNumber.class);
}
xmlCursor.dispose();
}
示例4: dumpNode
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param cursor
* @param opts
* @return
*/
private static String dumpNode(XmlCursor cursor, XmlOptions opts)
{
if (cursor.isText())
return cursor.getChars();
if (cursor.isFinish())
return "";
cursor.push();
boolean wanRawText = cursor.isStartdoc() && !cursor.toFirstChild();
cursor.pop();
return wanRawText ? cursor.getTextValue() : cursor.xmlText( opts );
}
示例5: update
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* Updates the internal state of this NamespaceHelper with the
* namespace information of the element pointed to by the cursor.
*/
private void update(XmlCursor cursor, ObjArray declarations)
{
// Process the Namespace declarations
cursor.push();
while(cursor.toNextToken().isAnyAttr())
{
if(cursor.isNamespace())
{
javax.xml.namespace.QName name = cursor.getName();
String prefix = name.getLocalPart();
String uri = name.getNamespaceURI();
declareNamespace(prefix, uri, declarations);
}
}
cursor.pop();
// Process the element
processName(cursor, declarations);
// Process the attributes
cursor.push();
boolean hasNext = cursor.toFirstAttribute();
while(hasNext)
{
processName(cursor, declarations);
hasNext = cursor.toNextAttribute();
}
cursor.pop();
}
示例6: namespaceDeclarations
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* @return List of Namespace objects that are declared in the container pointed to by the cursor.
*/
public static Object[] namespaceDeclarations(XMLLibImpl lib, XmlCursor cursor)
{
ObjArray declarations = new ObjArray();
NamespaceHelper helper = new NamespaceHelper(lib);
cursor.push();
int depth = 0;
while(cursor.hasPrevToken())
{
if(cursor.isContainer())
{
cursor.push();
depth++;
}
cursor.toParent();
}
for(int i = 0; i < depth - 1; i++)
{
cursor.pop();
helper.update(cursor, null);
}
if(depth > 0)
{
cursor.pop();
helper.update(cursor, declarations);
}
cursor.pop();
return declarations.toArray();
}
示例7: getAllNamespaces
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* @return Prefix to URI map of all namespaces in scope at the cursor.
*/
public static Map getAllNamespaces(XMLLibImpl lib, XmlCursor cursor)
{
NamespaceHelper helper = new NamespaceHelper(lib);
cursor.push();
int depth = 0;
while(cursor.hasPrevToken())
{
if(cursor.isContainer())
{
cursor.push();
depth++;
}
cursor.toParent();
}
for(int i = 0; i < depth; i++)
{
cursor.pop();
helper.update(cursor, null);
}
cursor.pop();
return helper.prefixToURI;
}