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


Java XmlObject类代码示例

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


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

示例1: createSample

import org.apache.xmlbeans.XmlObject; //导入依赖的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: createSampleForElement

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
public static String createSampleForElement( SchemaGlobalElement element )
{
	XmlObject xml = XmlObject.Factory.newInstance();

	XmlCursor c = xml.newCursor();
	c.toNextToken();
	c.beginElement( element.getName() );

	new SampleXmlUtil( false ).createSampleForType( element.getType(), c );

	c.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 = xml.xmlText( options );

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

示例3: initAssertions

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
private void initAssertions(TestStepConfig testStepData) {
        if(testStepData != null && testStepData.getConfig() != null){
            XmlObject config = testStepData.getConfig();
            XmlObject[] assertionsSections = config.selectPath("$this/" + ASSERTION_SECTION);
            for(XmlObject assertionSection: assertionsSections){
//                //TestAssertionConfig assertionConfig = TestAssertionConfig.Factory.newInstance();
//                //assertionConfig.set(assertionSection);
//                TestAssertionConfig assertionConfig = (TestAssertionConfig)( assertionSection.changeType(TestAssertionConfig.type));
                TestAssertionConfig assertionConfig;
                try {
                    assertionConfig = TestAssertionConfig.Factory.parse(assertionSection.toString());
                }
                catch(XmlException e){
                    SoapUI.logError(e);
                    continue;
                }
                assertionConfigs.add(assertionConfig);
            }
        }
        assertionsSupport = new AssertionsSupport(this, new AssertableConfigImpl());
    }
 
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:22,代码来源:ReceiveTestStep.java

示例4: escapeAttributeValue

import org.apache.xmlbeans.XmlObject; //导入依赖的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:CyboticCatfish,项目名称:code404,代码行数:26,代码来源:XMLLibImpl.java

示例5: render

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
@Override
public void render(ElementTemplate eleTemplate, Object data,
		XWPFTemplate template) {
	NiceXWPFDocument doc = template.getXWPFDocument();
	RunTemplate runTemplate = (RunTemplate) eleTemplate;
	XWPFRun run = runTemplate.getRun();
	try {
		XmlCursor newCursor = ((XWPFParagraph)run.getParent()).getCTP().newCursor();
		newCursor.toParent();
		//if (newCursor.getObject() instanceof CTTc) 
		newCursor.toParent();
		newCursor.toParent();
		XmlObject object = newCursor.getObject();
		XWPFTable table = doc.getTable((CTTbl) object);
		render(table, data);
	} catch (Exception e) {
		logger.error("dynamic table error:" + e.getMessage(), e);
	}
}
 
开发者ID:Sayi,项目名称:poi-tl,代码行数:20,代码来源:DynamicTableRenderPolicy.java

示例6: createSampleForType

import org.apache.xmlbeans.XmlObject; //导入依赖的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

示例7: createTextElement

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
/**
 *
 * @param qname
 * @param value
 * @return
 */
static XML createTextElement(XMLLibImpl lib, javax.xml.namespace.QName qname, String value)
{
    XScriptAnnotation anno;

    XmlObject xo = XmlObject.Factory.newInstance();
    XmlCursor cursor = xo.newCursor();
    try {
        cursor.toNextToken();

        cursor.beginElement(qname.getLocalPart(), qname.getNamespaceURI());
        //if(namespace.length() > 0)
        //    cursor.insertNamespace("", namespace);
        cursor.insertChars(value);

        cursor.toStartDoc();
        cursor.toNextToken();
        anno = new XScriptAnnotation(cursor);
        cursor.setBookmark(anno);
    } finally {
        cursor.dispose();
    }

    return new XML(lib, anno);
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:31,代码来源:XML.java

示例8: createFromXmlObject

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
static XML createFromXmlObject(XMLLibImpl lib, XmlObject xo)
{
    XScriptAnnotation anno;
    XmlCursor curs = xo.newCursor();
    if (curs.currentTokenType().isStartdoc())
    {
        curs.toFirstContentToken();
    }
    try {
        anno = new XScriptAnnotation(curs);
        curs.setBookmark(anno);
    } finally {
        curs.dispose();
    }
    return new XML(lib, anno);
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:17,代码来源:XML.java

示例9: escapeTextValue

import org.apache.xmlbeans.XmlObject; //导入依赖的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

示例10: handleEventMessage

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
public String handleEventMessage(String message, Object msgdoc, Map<String,String> metaInfo)
        throws EventHandlerException {
    ActionRequestDocument xmlbean = (ActionRequestDocument)
            ((XmlObject)msgdoc).changeType(ActionRequestDocument.type);
    String subaction = getSubAction(xmlbean);
    try {
        if (subaction.equals("LaunchProcess")) return handleProcessLaunch(xmlbean, message, metaInfo);
        else if (subaction.equals("Timeout")) return handleTimeout(xmlbean, message, metaInfo);
        else if (subaction.equals("Signal")) return handleNotifyProcess(xmlbean, message, metaInfo);
        else if (subaction.equals("NotifyProcess")) return handleNotifyProcess(xmlbean, message, metaInfo);
        else if (subaction.equals("Watching")) return handleWatching(xmlbean, message, metaInfo);
        else if (subaction.equals("Stubbing")) return handleStubbing(xmlbean, message, metaInfo);
        else if (subaction.equals("TaskAction")) return handleTaskAction(xmlbean, message, metaInfo);
        else throw new Exception("Unknown subaction " + subaction);
    } catch (Exception e) {
        logger.severeException(e.getMessage(), e);
        return createErrorResponse(e.getClass().getName() + ": " + e.getMessage());
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:20,代码来源:RegressionTestEventHandler.java

示例11: getXml

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
public String getXml(XmlObject request, Map<String,String> metaInfo) throws ServiceException {
    String className = metaInfo.get(JOB_CLASS_NAME);
    if (className == null)
        throw new ServiceException("Missing parameter to RunScheduledJob: " + JOB_CLASS_NAME);

    CallURL url = new CallURL(className);
    try {
        ScheduledJob job = MdwServiceRegistry.getInstance().getScheduledJob(className);
        if (job == null) {
            Class<? extends ScheduledJob> jobClass = Class.forName(className).asSubclass(ScheduledJob.class);
            job = jobClass.newInstance();
        }
        job.run(url);

        StatusMessage statusMessage = new StatusMessage();
        statusMessage.setCode(0);
        statusMessage.setMessage("Triggered ScheduledJob: " + url);
        return statusMessage.getXml();
    }
    catch (Exception ex) {
        logger.severeException(ex.getMessage(), ex);
        throw new ServiceException(ex.getMessage(), ex);
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:25,代码来源:RunScheduledJob.java

示例12: getDocType

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
/**
 * TODO: There's gotta be a better way
 */
public String getDocType(Object docObj) {
    if (docObj instanceof String || docObj instanceof StringDocument)
        return StringDocument.class.getName();
    else if (docObj instanceof XmlObject)
        return XmlObject.class.getName();
    else if (docObj instanceof XmlBeanWrapper)
        return XmlBeanWrapper.class.getName();
    else if (docObj instanceof groovy.util.Node)
        return groovy.util.Node.class.getName();
    else if (docObj instanceof JAXBElement)
        return JAXBElement.class.getName();
    else if (docObj instanceof Document)
        return Document.class.getName();
    else if (docObj instanceof JSONObject)
        return JSONObject.class.getName();
    else if (docObj.getClass().getName().equals("org.apache.camel.component.cxf.CxfPayload"))
        return "org.apache.camel.component.cxf.CxfPayload";
    else if (docObj instanceof Jsonable)
        return Jsonable.class.getName();
    else if (docObj instanceof Yaml)
        return Yaml.class.getName();
    else
        return Object.class.getName();

}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:29,代码来源:WorkflowServicesImpl.java

示例13: getProcessExecutionPlan

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
protected ProcessExecutionPlanDocument getProcessExecutionPlan()
        throws ActivityException, XmlException {
    String plan_varname = getAttributeValue(EXECUTION_PLAN_VARIABLE);
    Object binding = this.getParameterValue(plan_varname);
    if (binding==null || ! (binding instanceof DocumentReference))
        throw new ActivityException("InvokeHeterogenenousProcess: "
                + "control variable is not bound to a process plan");
    DocumentReference docref = (DocumentReference)binding;
    binding = super.getDocumentForUpdate(docref, getParameterType(plan_varname));
    if  (binding instanceof ProcessExecutionPlanDocument) {
        return (ProcessExecutionPlanDocument)binding;
    } else if (binding instanceof XmlObject) {
        return (ProcessExecutionPlanDocument)((XmlObject)binding).changeType(ProcessExecutionPlanDocument.type);
    } else {
        Variable docVar = getProcessDefinition().getVariable(plan_varname);
        XmlDocumentTranslator docRefTrans = (XmlDocumentTranslator)VariableTranslator.getTranslator(getPackage(), docVar.getType());
        Document doc = docRefTrans.toDomDocument(binding);
        return ProcessExecutionPlanDocument.Factory.parse(doc, Compatibility.namespaceOptions());
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:21,代码来源:InvokeHeterogeneousProcessActivity.java

示例14: removeHyperlink

import org.apache.xmlbeans.XmlObject; //导入依赖的package包/类
public static void removeHyperlink(XSLFTextRun textRun) {
	XmlObject xml = textRun.getXmlObject();
	if (xml instanceof CTTextField) {
		CTTextField tf = (CTTextField) xml;
		if (tf.isSetRPr()) {
			tf.getRPr().unsetHlinkClick();
		}
	} else if (xml instanceof CTTextLineBreak) {
		CTTextLineBreak tlb = (CTTextLineBreak) xml;
		if (tlb.isSetRPr()) {
			tlb.getRPr().unsetHlinkClick();
		}
	} else if (xml instanceof CTRegularTextRun) {
		CTRegularTextRun tr = (CTRegularTextRun) xml;
		if (tr.isSetRPr()) {
			tr.getRPr().unsetHlinkClick();
		}
	}
}
 
开发者ID:Coreoz,项目名称:PPT-Templates,代码行数:20,代码来源:PptPoiBridge.java

示例15: addSection

import org.apache.xmlbeans.XmlObject; //导入依赖的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


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