本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.insertNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.insertNamespace方法的具体用法?Java XmlCursor.insertNamespace怎么用?Java XmlCursor.insertNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlCursor
的用法示例。
在下文中一共展示了XmlCursor.insertNamespace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAdditionalNamespace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* The reason behing adding additional namespace is, there is a difference between Microsoft and
* Axis web service artifacts
*
* @param queryBase
*/
private final void addAdditionalNamespace(final QueryBase queryBase) {
/* Get cursor from query node */
final XmlCursor cursor = queryBase.newCursor();
cursor.toNextToken();
cursor.insertNamespace("query", MSCRMSchemaConstants.QUERY);
/* Set cursor type information */
cursor.insertAttributeWithValue("type", MSCRMSchemaConstants.XML_SCHEMA_INSTANCE, "query:QueryExpression");
/* Dispose cursor */
cursor.dispose();
}
示例2: addMSSpecificNS
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* This method is to avoid error from MS about missing NS
*
* @param aoat
*/
private static final void addMSSpecificNS(final com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfanyType aoat) {
/* Create new cursor to add type information */
final XmlCursor xc = aoat.getAnyTypeArray(0).newCursor();
/* Go to first element */
xc.toFirstContentToken();
/* Add attribute with namespace */
xc.insertNamespace("xs", "http://www.w3.org/2001/XMLSchema");
xc.insertAttributeWithValue(new QName("http://www.w3.org/2001/XMLSchema-instance", "type"), "xs:string");
xc.dispose();
}
示例3: addAdditionalNamespace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private static final void addAdditionalNamespace(final QueryBase queryBase) {
/* Get cursor from query node */
final XmlCursor cursor = queryBase.newCursor();
cursor.toNextToken();
cursor.insertNamespace("query", MSCRMSchemaConstants.QUERY);
/* Set cursor type information */
cursor.insertAttributeWithValue("type", MSCRMSchemaConstants.XML_SCHEMA_INSTANCE, "query:QueryExpression");
/* Dispose cursor */
cursor.dispose();
}
示例4: getAttributedXmlString
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* Builds a new {@link XmlString} instance holding the given <code>String</code> value. The instance will also have an
* attribute with <code>xsi:type</code> name (where <code>xsi</code> represent a prefix for
* <code>http://www.w3.org/2001/XMLSchema-instance</code> namespace) and a <code>xsd:string</code> value (where
* <code>xsd</code> represents a prefix for <code>http://www.w3.org/2001/XMLSchema</code> namespace).
*
* @param value content value
* @return constructed {@link XmlString} instance
*/
public static XmlString getAttributedXmlString(String value) {
XmlString xmlString = XmlString.Factory.newInstance();
xmlString.setStringValue(value);
XmlCursor cursor = xmlString.newCursor();
cursor.toNextToken();
cursor.insertNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
cursor.insertAttributeWithValue(new QName("http://www.w3.org/2001/XMLSchema-instance", "type", "xsi"),
"xsd:string");
return xmlString;
}
示例5: addNamespaceDecl
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
@Override
public void addNamespaceDecl(String prefix, String uri) {
XmlCursor cursor;
cursor = document.newCursor();
while (cursor.hasNextToken()) {
if (cursor.isStart()) {
cursor.toNextToken();
cursor.insertNamespace(prefix, uri);
break;
} else {
cursor.toNextToken();
}
}
}