本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.toNextSibling方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.toNextSibling方法的具体用法?Java XmlCursor.toNextSibling怎么用?Java XmlCursor.toNextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlCursor
的用法示例。
在下文中一共展示了XmlCursor.toNextSibling方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verify_condition
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private boolean verify_condition(XmlCursor cursor, Condition condition) {
boolean more, found=false;
XmlBookmark bookmark = new XmlBookmark(){};
cursor.setBookmark(bookmark);
if (condition.isAttribute) {
for (more=cursor.toFirstAttribute(); more&&!found; more=cursor.toNextAttribute()) {
if (cursor.getName().getLocalPart().equals(condition.name)) {
found = cursor.getTextValue().trim().equals(condition.value);
}
}
} else {
for (more=cursor.toFirstChild(); more&&!found; more=cursor.toNextSibling()) {
if (cursor.getName().getLocalPart().equals(condition.name)) {
found = cursor.getTextValue().trim().equals(condition.value);
}
}
}
cursor.toBookmark(bookmark);
return found;
}
示例2: getSPMDApplication
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static SPMDApplicationType getSPMDApplication(JobDefinitionType value) {
if (value != null &&
value.getJobDescription() != null &&
value.getJobDescription().isSetApplication() ) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if(acursor.getName().equals(SPMD_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (SPMDApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
示例3: getPOSIXApplication
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static POSIXApplicationType getPOSIXApplication(JobDefinitionType value) {
if (value != null &&
value.getJobDescription() != null &&
value.getJobDescription().isSetApplication() ) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if(acursor.getName().equals(POSIX_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (POSIXApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
示例4: getHPCProfileApplication
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static HPCProfileApplicationType getHPCProfileApplication(JobDefinitionType value) {
if (value != null &&
value.getJobDescription() != null &&
value.getJobDescription().isSetApplication() ) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if(acursor.getName().equals(HPC_PROFILE_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (HPCProfileApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
示例5: subStatusAsString
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
protected String subStatusAsString(ActivityStatusType statusType) {
StringBuffer sb = new StringBuffer();
sb.append(statusType.getState().toString());
XmlCursor acursor = statusType.newCursor();
if (acursor.toFirstChild()) {
do {
if (acursor.getName().getNamespaceURI()
.equals("http://schemas.ogf.org/hpcp/2007/01/fs")) {
sb.append(":");
sb.append(acursor.getName().getLocalPart());
}
} while (acursor.toNextSibling());
acursor.dispose();
return sb.toString();
} else {
acursor.dispose();
return sb.toString();
}
}
示例6: getAtomParameters
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
* Retrieves all of the parameters of an atom in order (including skolems and vars)
*
* @author mdangelo
*
* @param m The mapping to get the atomParameters of
* @param foreach A boolean to determine whether to check the for each or exist clauses for the atom
* @param atomPos The position of the atom within the mapping
*
* @return An array of objects
*/
public Object[] getAtomParameters (MappingType m, boolean foreach, int atomPos)
{
MapExprType clause = foreach ? m.getForeach() : m.getExists();
RelAtomType atom = clause.getAtomArray(atomPos);
XmlCursor c = atom.newCursor();
int size = atom.sizeOfSKFunctionArray() + atom.sizeOfVarArray();
Object[] result = new Object[size];
int varPos = 0;
for(int i = 0; i < size; i++)
{
if(i == 0)
c.toChild(i);
else
c.toNextSibling();
XmlObject x = c.getObject();
if (x instanceof SKFunction)
result[i] = x;
else
result[i] = atom.getVarArray(varPos++);
}
return result;
}
示例7: argsToString
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void argsToString(XmlCursor c, StringBuilder b, int numElements)
throws Exception {
b.append("(");
c.toChild(0);
for(int i = 0; i < numElements; i++) {
XmlObject o = (XmlObject) c.getObject();
b.append(atomArgToString(o) + ", ");
c.toNextSibling();
}
b.delete(b.length() - 2, b.length());
b.append(")");
}
示例8: evaluate_recursive_descent
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private String evaluate_recursive_descent(XmlCursor cursor, PathSegment path) {
String value = null;
XmlBookmark bookmark = new XmlBookmark(){};
cursor.setBookmark(bookmark);
value = evaluate_segment(cursor, path);
if (value!=null) return value;
boolean more = cursor.toFirstChild();
while (value==null && more) {
value = evaluate_recursive_descent(cursor, path);
more = cursor.toNextSibling();
}
cursor.toBookmark(bookmark);
return value;
}
示例9: parse
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
protected Map<Class<? extends XmlObject>, List<? extends XmlObject>> parse(XmlObject xmlObject) {
if (log.isTraceEnabled()) {
log.trace("starting to parse xmlObject:\n" + xmlObject + "\n\n");
}
XmlCursor cursor = xmlObject.newCursor();
cursor.toFirstChild();// move before the root element
cursor.toFirstChild();// move to the first child of the root
Map<Class<? extends XmlObject>, List<? extends XmlObject>> subElementsList = new HashMap<Class<? extends XmlObject>, List<? extends XmlObject>>();
try {
do {
XmlObject object = XmlObject.Factory.parse(cursor.getDomNode());
@SuppressWarnings("unchecked")
// to be able to add object that is in fact a subclass of XmlObject, but referenced using XmlObject
List<XmlObject> list = (List<XmlObject>) subElementsList.get(object.getClass());
if (list == null) {
list = new ArrayList<XmlObject>();
}
list.add(object);
subElementsList.put(object.getClass(), list);
log.debug("adding node: '" + cursor.getDomNode().getLocalName() + "' (" + cursor.getDomNode().getNamespaceURI()
+ "),\nclass: " + object.getClass() + ", cursor: \n" + object);
} while (cursor.toNextSibling());
} catch (XmlException e) {
throw new RuntimeException("Failed to parse xmlObject:\n" + xmlObject, e);
}
return subElementsList;
}
示例10: copy
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param cursToCopy
* @return
*/
private XmlCursor copy (XmlCursor cursToCopy)
{
XmlObject xo = XmlObject.Factory.newInstance();
XmlCursor copyCurs = null;
if (cursToCopy.currentTokenType().isText())
{
try
{
// Try just as a textnode, to do that we need to wrap the text in a special fragment tag
// that is not visible from the XmlCursor.
copyCurs = XmlObject.Factory.parse("<x:fragment xmlns:x=\"http://www.openuri.org/fragment\">" +
cursToCopy.getChars() +
"</x:fragment>").newCursor();
if (!cursToCopy.toNextSibling())
{
if (cursToCopy.currentTokenType().isText())
{
cursToCopy.toNextToken(); // It's not an element it's text so skip it.
}
}
}
catch (Exception ex)
{
throw ScriptRuntime.typeError(ex.getMessage());
}
}
else
{
copyCurs = xo.newCursor();
copyCurs.toFirstContentToken();
if (cursToCopy.currentTokenType() == XmlCursor.TokenType.STARTDOC)
{
cursToCopy.toNextToken();
}
cursToCopy.copyXml(copyCurs);
if (!cursToCopy.toNextSibling()) // If element skip element.
{
if (cursToCopy.currentTokenType().isText())
{
cursToCopy.toNextToken(); // It's not an element it's text so skip it.
}
}
}
copyCurs.toStartDoc();
copyCurs.toFirstContentToken();
return copyCurs;
}
示例11: copy
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param cursToCopy
* @return
*/
private XmlCursor copy (XmlCursor cursToCopy)
{
XmlObject xo = XmlObject.Factory.newInstance();
XmlCursor copyCurs = null;
if (cursToCopy.currentTokenType().isText())
{
try
{
// Try just as a textnode, to do that we need to wrap the text in a special fragment tag
// that is not visible from the XmlCursor.
copyCurs = XmlObject.Factory.parse("<x:fragment xmlns:x=\"http://www.openuri.org/fragment\">" +
cursToCopy.getChars() +
"</x:fragment>").newCursor();
if (!cursToCopy.toNextSibling())
{
if (cursToCopy.currentTokenType().isText())
{
cursToCopy.toNextToken(); // It's not an element it's text so skip it.
}
}
}
catch (Exception ex)
{
throw ScriptRuntime.typeError(ex.getMessage());
}
}
else
{
copyCurs = xo.newCursor();
copyCurs.toFirstContentToken();
if (cursToCopy.currentTokenType() == XmlCursor.TokenType.STARTDOC)
{
cursToCopy.toNextToken();
}
cursToCopy.copyXml(copyCurs);
if (!cursToCopy.toNextSibling()) // If element skip element.
{
if (cursToCopy.currentTokenType().isText())
{
cursToCopy.toNextToken(); // It's not an element it's text so skip it.
}
}
}
copyCurs.toStartDoc();
copyCurs.toFirstContentToken();
return copyCurs;
}
示例12: createAnnotationForElement
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void createAnnotationForElement(SchemaAnnotation annotation, XmlCursor xmlc, Map<String, String> mapValues)
{
String access = "";
String documentation = "";
if(null != annotation && _bIsAttrib){
boolean isfine = false;
XmlObject xmlObject = null;
XmlCursor xmlCursor = null;
XmlObject[] lstxmlAppinfo = annotation.getApplicationInformation();
if(lstxmlAppinfo.length > 0)
{
for(int i = 0; i < lstxmlAppinfo.length; i++)
{
xmlObject= lstxmlAppinfo[i];
xmlCursor = xmlObject.newCursor();
if(xmlCursor.toFirstChild())
{
if (xmlCursor.getName().getLocalPart().equalsIgnoreCase("access"))
{
access = xmlCursor.getTextValue();
mapValues.put("access", access);
}
if (xmlCursor.getName().getLocalPart().equalsIgnoreCase("key"))
{
access = xmlCursor.getTextValue();
mapValues.put("key", access);
}
while(xmlCursor.toNextSibling())
{
if (xmlCursor.getName().getLocalPart().equalsIgnoreCase("access"))
{
access = xmlCursor.getTextValue();
mapValues.put("access", access);
}
if (xmlCursor.getName().getLocalPart().equalsIgnoreCase("key"))
{
access = xmlCursor.getTextValue();
mapValues.put("key", access);
}
}
}
}
}
// 不再记录documentation节点数据, 关闭
/* XmlObject[] lstdocument = annotation.getUserInformation();
if(lstdocument.length > 0)
{
for(int i = 0; i < lstdocument.length; i++)
{
xmlObject= lstdocument[i];
xmlCursor = xmlObject.newCursor();
if (xmlCursor.getName().getLocalPart().equalsIgnoreCase("documentation"))
{
documentation = xmlCursor.getTextValue();
mapValues.put("description", documentation);
}
}
} */
}
}