本文整理汇总了Java中org.apache.xmlbeans.XmlObject.xmlText方法的典型用法代码示例。如果您正苦于以下问题:Java XmlObject.xmlText方法的具体用法?Java XmlObject.xmlText怎么用?Java XmlObject.xmlText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlObject
的用法示例。
在下文中一共展示了XmlObject.xmlText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: 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;
}
示例4: determineNotificationTypeFromXmlBeansDocument
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
public static NotificationTypeEnum determineNotificationTypeFromXmlBeansDocument(XmlObject document, Integer flog) {
String document_string = document.xmlText();
if(document_string.contains("addAgentAgentRelationship")){
return ADD_AGENT_AGENT_RELATION;
} else if (document_string.contains("addAgentActivityRelationship")){
return ADD_AGENT_ACTIVITY_RELATION;
} else if (document_string.contains("addActivityActivityRelationship")){
return ADD_ACTIVITY_ACTIVITY_RELATION;
} else if (document_string.contains("addEntityEntityRelationship")){
return ADD_ENTITY_ENTITY_RELATION;
} else if (document_string.contains("addActivityEntityRelationship")){
return ADD_ACTIVITY_ENTITY_RELATION;
} else if(document_string.contains("addAgentEntityRelationship")){
return ADD_AGENT_ACTIVITY_RELATION;
} else if(document_string.contains("addAttributes")){
return ADD_ATTRIBUTES;
} else {
return UNKNOWN_TYPES;
}
}
示例5: createInstanceForSchemaType
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
/***
* 处理全局的schematype数据内容
* @param sType 当前schema节点
* @return 解析出来的xml表达式
*/
public String createInstanceForSchemaType(SchemaType sType, boolean isSaveJson,String fileName)
{
XmlObject xmlobject = XmlObject.Factory.newInstance();
XmlCursor cursor = xmlobject.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
_soapEnc = false;
//RestfulApiSchemaManager restful = new RestfulApiSchemaManager(false);
setViewAttrib(isSaveJson);
Map<String, String> mapValues = new LinkedHashMap<String, String>();
createSampleForType(sType, cursor, mapValues);
// 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.
XmlOptions options = new XmlOptions();
options.put(XmlOptions.SAVE_PRETTY_PRINT);
options.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, 2);
options.put(XmlOptions.SAVE_USE_DEFAULT_NAMESPACE);
String result = xmlobject.xmlText(options);
//System.out.println(result);
// get current xml object
navigatingXML(xmlobject,fileName);
// System.out.println(getRestApiManager().getAllRestfulApi());
return result;
}
示例6: realToString
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
public String realToString(Object object) throws TranslationException {
XmlObject xmlBean = (XmlObject) object;
XmlOptions tempOptions = new XmlOptions(xmlOptions);
tempOptions.setSavePrettyPrint();
return xmlBean.xmlText(tempOptions);
}
示例7: toText
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
private static String toText(XmlObject xbObject) {
return xbObject.xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
}
示例8: anyTypeToString
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
/**
* converts an XmlObject into a pretty printed string
*
* @param any XmlObject
* @return converted string
*/
public static String anyTypeToString(XmlObject any) {
return any.xmlText(new XmlOptions().setSavePrettyPrint());
}