本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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 );
}
示例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: getRootNodeName
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static String getRootNodeName(XmlObject xmlbean) {
XmlCursor cursor = xmlbean.newCursor();
cursor.toFirstChild();
return cursor.getName().getLocalPart();
}
示例11: getRootNodeValue
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static String getRootNodeValue(XmlObject xmlbean) {
XmlCursor cursor = xmlbean.newCursor();
cursor.toFirstChild();
return cursor.getTextValue();
}
示例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);
}
}
} */
}
}
示例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;
}
示例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;
}