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


Java XmlCursor.toFirstChild方法代码示例

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


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

示例1: hasSimpleContent

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @return
 */
boolean hasSimpleContent()
{
    boolean simpleContent = false;

    XmlCursor curs = newCursor();

    if (curs.isAttr() || curs.isText()) {
        return true;
    }

    if (curs.isStartdoc())
    {
        curs.toFirstContentToken();
    }

    simpleContent = !(curs.toFirstChild());

    curs.dispose();

    return simpleContent;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:26,代码来源:XML.java

示例2: 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;
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:21,代码来源:XmlPath.java

示例3: 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;
	}
}
 
开发者ID:apache,项目名称:airavata,代码行数:24,代码来源:JSDLUtils.java

示例4: 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;
	}
}
 
开发者ID:apache,项目名称:airavata,代码行数:24,代码来源:JSDLUtils.java

示例5: 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;
	}
}
 
开发者ID:apache,项目名称:airavata,代码行数:24,代码来源:JSDLUtils.java

示例6: 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();
		}

	}
 
开发者ID:apache,项目名称:airavata,代码行数:24,代码来源:BESProvider.java

示例7: dumpNode

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
 *
 * @param cursor
 * @param opts
 * @return
 */
private static String dumpNode(XmlCursor cursor, XmlOptions opts)
{
    if (cursor.isText())
        return cursor.getChars();

    if (cursor.isFinish())
        return "";

    cursor.push();
    boolean wanRawText = cursor.isStartdoc() && !cursor.toFirstChild();
    cursor.pop();

    return wanRawText ? cursor.getTextValue() : cursor.xmlText( opts );
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:21,代码来源:XML.java

示例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;
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:15,代码来源:XmlPath.java

示例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;
}
 
开发者ID:nortal,项目名称:j-road,代码行数:28,代码来源:DhlXTeeService.java

示例10: getRootNodeName

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static String getRootNodeName(XmlObject xmlbean) {
    XmlCursor cursor = xmlbean.newCursor();
    cursor.toFirstChild();
    return cursor.getName().getLocalPart();
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:6,代码来源:XmlPath.java

示例11: getRootNodeValue

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static String getRootNodeValue(XmlObject xmlbean) {
    XmlCursor cursor = xmlbean.newCursor();
    cursor.toFirstChild();
    return cursor.getTextValue();
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:6,代码来源:XmlPath.java

示例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);
                    }
                }
            }  */
        }
 
    }
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:67,代码来源:RestfulApiSchemaManager.java

示例13: getApplicationJobStatus

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private JobState getApplicationJobStatus(ActivityStatusType activityStatus) {
	if (activityStatus == null) {
		return JobState.UNKNOWN;
	}
	Enum state = activityStatus.getState();
	String status = null;
	XmlCursor acursor = activityStatus.newCursor();
	try {
		if (acursor.toFirstChild()) {
			if (acursor.getName().getNamespaceURI()
					.equals("http://schemas.ogf.org/hpcp/2007/01/fs")) {
				status = acursor.getName().getLocalPart();
			}
		}
		if (status != null) {
			if (status.equalsIgnoreCase("Queued")
					|| status.equalsIgnoreCase("Starting")
					|| status.equalsIgnoreCase("Ready")) {
				return JobState.QUEUED;
			} else if (status.equalsIgnoreCase("Staging-In")) {
				return JobState.SUBMITTED;
			} else if (status.equalsIgnoreCase("FINISHED")) {
				return JobState.COMPLETE;
			}else if(status.equalsIgnoreCase("Staging-Out")){
				return JobState.ACTIVE;
			} 
			else if (status.equalsIgnoreCase("Executing")) {
				return JobState.ACTIVE;
			} else if (status.equalsIgnoreCase("FAILED")) {
				return JobState.FAILED;
			} else if (status.equalsIgnoreCase("CANCELLED")) {
				return JobState.CANCELED;
			}
		} else {
			if (ActivityStateEnumeration.CANCELLED.equals(state)) {
				return JobState.CANCELED;
			} else if (ActivityStateEnumeration.FAILED.equals(state)) {
				return JobState.FAILED;
			} else if (ActivityStateEnumeration.FINISHED.equals(state)) {
				return JobState.COMPLETE;
			} else if (ActivityStateEnumeration.RUNNING.equals(state)) {
				return JobState.ACTIVE;
			}
		}
	} finally {
		if (acursor != null)
			acursor.dispose();
	}
	return JobState.UNKNOWN;
}
 
开发者ID:apache,项目名称:airavata,代码行数:51,代码来源:BESProvider.java

示例14: getApplicationJobStatus

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private JobState getApplicationJobStatus(ActivityStatusType activityStatus) {
    if (activityStatus == null) {
        return JobState.UNKNOWN;
    }
    ActivityStateEnumeration.Enum state = activityStatus.getState();
    String status = null;
    XmlCursor acursor = activityStatus.newCursor();
    try {
        if (acursor.toFirstChild()) {
            if (acursor.getName().getNamespaceURI()
                    .equals("http://schemas.ogf.org/hpcp/2007/01/fs")) {
                status = acursor.getName().getLocalPart();
            }
        }
        if (status != null) {
            if (status.equalsIgnoreCase("Queued")
                    || status.equalsIgnoreCase("Starting")
                    || status.equalsIgnoreCase("Ready")) {
                return JobState.QUEUED;
            } else if (status.equalsIgnoreCase("Staging-In")) {
                return JobState.SUBMITTED;
            } else if (status.equalsIgnoreCase("FINISHED")) {
                return JobState.COMPLETE;
            }else if(status.equalsIgnoreCase("Staging-Out")){
                return JobState.ACTIVE;
            }
            else if (status.equalsIgnoreCase("Executing")) {
                return JobState.ACTIVE;
            } else if (status.equalsIgnoreCase("FAILED")) {
                return JobState.FAILED;
            } else if (status.equalsIgnoreCase("CANCELLED")) {
                return JobState.CANCELED;
            }
        } else {
            if (ActivityStateEnumeration.CANCELLED.equals(state)) {
                return JobState.CANCELED;
            } else if (ActivityStateEnumeration.FAILED.equals(state)) {
                return JobState.FAILED;
            } else if (ActivityStateEnumeration.FINISHED.equals(state)) {
                return JobState.COMPLETE;
            } else if (ActivityStateEnumeration.RUNNING.equals(state)) {
                return JobState.ACTIVE;
            }
        }
    } finally {
        if (acursor != null)
            acursor.dispose();
    }
    return JobState.UNKNOWN;
}
 
开发者ID:apache,项目名称:airavata,代码行数:51,代码来源:BESJobSubmissionTask.java


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