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


Java XmlCursor.dispose方法代码示例

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


在下文中一共展示了XmlCursor.dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSample

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public String createSample( SchemaType sType )
{
	XmlObject object = XmlObject.Factory.newInstance();
	XmlCursor cursor = object.newCursor();
	// Skip the document node
	cursor.toNextToken();
	// Using the type and the cursor, call the utility method to get a
	// sample XML payload for that Schema element
	createSampleForType( sType, cursor );
	// Cursor now contains the sample payload
	// Pretty print the result. Note that the cursor is positioned at the
	// end of the doc so we use the original xml object that the cursor was
	// created upon to do the xmlText() against.

	cursor.dispose();

	XmlOptions options = new XmlOptions();
	options.put( XmlOptions.SAVE_PRETTY_PRINT );
	options.put( XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3 );
	options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
	options.setSaveOuter();
	String result = object.xmlText( options );

	return result;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:26,代码来源:SampleXmlUtil.java

示例2: createSampleForType

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static String createSampleForType( SchemaType sType )
{
	XmlObject object = XmlObject.Factory.newInstance();
	XmlCursor cursor = object.newCursor();
	// Skip the document node
	cursor.toNextToken();
	// Using the type and the cursor, call the utility method to get a
	// sample XML payload for that Schema element
	new SampleXmlUtil( false ).createSampleForType( sType, cursor );
	// Cursor now contains the sample payload
	// Pretty print the result. Note that the cursor is positioned at the
	// end of the doc so we use the original xml object that the cursor was
	// created upon to do the xmlText() against.

	cursor.dispose();
	XmlOptions options = new XmlOptions();
	options.put( XmlOptions.SAVE_PRETTY_PRINT );
	options.put( XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3 );
	options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
	options.setSaveOuter();
	String result = object.xmlText( options );

	return result;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:25,代码来源:SampleXmlUtil.java

示例3: escapeAttributeValue

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 * Escapes the reserved characters in a value of an attribute
 *
 * @param value Unescaped text
 * @return The escaped text
 */
public String escapeAttributeValue(Object value)
{
    String text = ScriptRuntime.toString(value);

    if (text.length() == 0) return "";

    XmlObject xo = XmlObject.Factory.newInstance();

    XmlCursor cursor = xo.newCursor();
    cursor.toNextToken();
    cursor.beginElement("a");
    cursor.insertAttributeWithValue("a", text);
    cursor.dispose();

    String elementText = xo.toString();
    int begin = elementText.indexOf('"');
    int end = elementText.lastIndexOf('"');
    return elementText.substring(begin + 1, end);
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:26,代码来源:XMLLibImpl.java

示例4: setLocalName

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @param name
 */
void setLocalName(String localName)
{
    XmlCursor cursor = newCursor();

    try
    {
        if(cursor.isStartdoc())
            cursor.toFirstContentToken();

        if(cursor.isText() || cursor.isComment()) return;


        javax.xml.namespace.QName qname = cursor.getName();
        cursor.setName(new javax.xml.namespace.QName(
            qname.getNamespaceURI(), localName, qname.getPrefix()));
    }
    finally
    {
        cursor.dispose();
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:26,代码来源:XML.java

示例5: tokenType

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @return
 */
XmlCursor.TokenType tokenType()
{
    XmlCursor.TokenType result;

    XmlCursor curs = newCursor();

    if (curs.isStartdoc())
    {
        curs.toFirstContentToken();
    }

    result = curs.currentTokenType();

    curs.dispose();

    return result;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:22,代码来源:XML.java

示例6: appendChild

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @param xml
 * @return
 */
XML appendChild(Object xml)
{
    XmlCursor curs = newCursor();

    if (curs.isStartdoc())
    {
        curs.toFirstContentToken();
    }

    // Move the cursor to the end of this element
    if (curs.isStart())
    {
        curs.toEndToken();
    }

    insertChild(curs, xml);

    curs.dispose();

    return this;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:27,代码来源:XML.java

示例7: escapeTextValue

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 * Escapes the reserved characters in a value of a text node
 *
 * @param value Unescaped text
 * @return The escaped text
 */
public String escapeTextValue(Object value)
{
    if (value instanceof XMLObjectImpl) {
        return ((XMLObjectImpl)value).toXMLString(0);
    }

    String text = ScriptRuntime.toString(value);

    if (text.length() == 0) return text;

    XmlObject xo = XmlObject.Factory.newInstance();

    XmlCursor cursor = xo.newCursor();
    cursor.toNextToken();
    cursor.beginElement("a");
    cursor.insertChars(text);
    cursor.dispose();

    String elementText = xo.toString();
    int begin = elementText.indexOf('>') + 1;
    int end = elementText.lastIndexOf('<');
    return (begin < end) ? elementText.substring(begin, end) : "";
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:30,代码来源:XMLLibImpl.java

示例8: 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

示例9: addSection

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public XmlObjectBuilder addSection(String sectionName, XmlObject section){
    cursor.beginElement(sectionName);
    cursor.push();
    XmlCursor srcCursor = section.newCursor();
    srcCursor.toNextToken();
    while(srcCursor.currentTokenType() != XmlCursor.TokenType.NONE && srcCursor.currentTokenType() !=  XmlCursor.TokenType.ENDDOC){
        srcCursor.copyXml(cursor);
        if(srcCursor.currentTokenType() == XmlCursor.TokenType.START) srcCursor.toEndToken();
        srcCursor.toNextToken();

    }
    cursor.pop();
    cursor.toEndToken();
    cursor.toNextToken();
    srcCursor.dispose();

    return this;
}
 
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:19,代码来源:XmlObjectBuilder.java

示例10: prependChild

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @param xml
 * @return
 */
XML prependChild (Object xml)
{
    XmlCursor curs = newCursor();

    if (curs.isStartdoc())
    {
        curs.toFirstContentToken();
    }

    // Move the cursor to the first content token
    curs.toFirstContentToken();

    insertChild(curs, xml);

    curs.dispose();

    return this;
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:24,代码来源:XML.java

示例11: addSection

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public XmlObjectBuilder addSection(String sectionName, XmlObject section) {
    cursor.beginElement(sectionName);
    cursor.push();
    XmlCursor srcCursor = section.newCursor();
    srcCursor.toNextToken();
    while (srcCursor.currentTokenType() != XmlCursor.TokenType.NONE
            && srcCursor.currentTokenType() != XmlCursor.TokenType.ENDDOC) {
        srcCursor.copyXml(cursor);
        if (srcCursor.currentTokenType() == XmlCursor.TokenType.START)
            srcCursor.toEndToken();
        srcCursor.toNextToken();

    }
    cursor.pop();
    cursor.toEndToken();
    cursor.toNextToken();
    srcCursor.dispose();

    return this;
}
 
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:21,代码来源:XmlObjectBuilder.java

示例12: remove

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 */
void remove ()
{
    XmlCursor childCurs = newCursor();

    if (childCurs.currentTokenType().isStartdoc())
    {
        // Remove on the document removes all children.
        TokenType tt = childCurs.toFirstContentToken();
        while (!tt.isEnd() && !tt.isEnddoc())
        {
            removeToken(childCurs);
            tt = childCurs.currentTokenType();      // Now see where we're pointing after the delete -- next token.
        }
    }
    else
    {
            removeToken(childCurs);
    }

    childCurs.dispose();
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:25,代码来源:XML.java

示例13: getOrCreateHPCProfileApplication

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static HPCProfileApplicationType getOrCreateHPCProfileApplication(JobDefinitionType value) {

		ApplicationType application = getOrCreateApplication(value);
		
		if(getPOSIXApplication(value) != null){
			//TODO handle: creating HPC element if POSIX already exists
			return getHPCProfileApplication(value);
		}
		
		if (getHPCProfileApplication(value) == null) {
			XmlCursor acursor = application.newCursor();
			acursor.toEndToken();
			acursor.insertElement(HPC_PROFILE_APPLICATION);
			acursor.dispose();
		}
		return getHPCProfileApplication(value);
	}
 
开发者ID:apache,项目名称:airavata,代码行数:18,代码来源:JSDLUtils.java

示例14: copy

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @return
 */
Object copy()
{
    XmlCursor srcCurs = newCursor();

    if (srcCurs.isStartdoc())
    {
        srcCurs.toFirstContentToken();
    }

    XML xml = createEmptyXML(lib);

    XmlCursor destCurs = xml.newCursor();
    destCurs.toFirstContentToken();

    srcCurs.copyXml(destCurs);

    destCurs.dispose();
    srcCurs.dispose();

    return xml;
}
 
开发者ID:tntim96,项目名称:rhino-jscover,代码行数:26,代码来源:XML.java

示例15: hasSimpleContent

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @return
 */
boolean hasSimpleContent()
{
    boolean simpleContent = false;

    XmlCursor curs = newCursor();

    if (curs.isAttr() || curs.isText()) {
        return true;
    }

    if (curs.isStartdoc())
    {
        curs.toFirstContentToken();
    }

    simpleContent = !(curs.toFirstChild());

    curs.dispose();

    return simpleContent;
}
 
开发者ID:WolframG,项目名称:Rhino-Prov-Mod,代码行数:26,代码来源:XML.java


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