本文整理汇总了Java中org.apache.xmlbeans.XmlObject.toString方法的典型用法代码示例。如果您正苦于以下问题:Java XmlObject.toString方法的具体用法?Java XmlObject.toString怎么用?Java XmlObject.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlObject
的用法示例。
在下文中一共展示了XmlObject.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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) : "";
}
示例3: getSkolemFromAtom
import org.apache.xmlbeans.XmlObject; //导入方法依赖的package包/类
public SKFunction getSkolemFromAtom (MappingType m, boolean foreach,
int atomPos, int argPos) throws Exception {
MapExprType clause = foreach ? m.getForeach() : m.getExists();
RelAtomType atom = clause.getAtomArray(atomPos);
XmlCursor c = atom.newCursor();
c.toChild(argPos);
XmlObject o = (XmlObject) c.getObject();
if (!(o instanceof SKFunction))
throw new Exception ("Expected an SK function: " + o.toString());
return (SKFunction) o;
}