当前位置: 首页>>代码示例>>Java>>正文


Java XmlCursor.push方法代码示例

本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.push方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.push方法的具体用法?Java XmlCursor.push怎么用?Java XmlCursor.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xmlbeans.XmlCursor的用法示例。


在下文中一共展示了XmlCursor.push方法的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();
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:17,代码来源:NamespaceHelper.java

示例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();
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:18,代码来源:NamespaceHelper.java

示例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();
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:18,代码来源:AttributeTypeImpl.java

示例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 );
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:21,代码来源:XML.java

示例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();
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:35,代码来源:NamespaceHelper.java

示例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();
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:39,代码来源:NamespaceHelper.java

示例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;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:32,代码来源:NamespaceHelper.java


注:本文中的org.apache.xmlbeans.XmlCursor.push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。