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


Java XMLEvent.isAttribute方法代码示例

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


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

示例1: unmarshall

import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
/**
 * Id (aka configuration name) isn't modeled on the actual {@link NotificationConfiguration}
 * class but as the key name in the map of configurations in
 * {@link BucketNotificationConfiguration}
 */
@Override
public Entry<String, NotificationConfiguration> unmarshall(StaxUnmarshallerContext context) throws Exception {
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) {
        targetDepth += 1;
    }

    T topicConfig = createConfiguration();
    String id = null;

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument()) {
            return new SimpleEntry<String, NotificationConfiguration>(id, topicConfig);
        }

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (handleXmlEvent(topicConfig, context, targetDepth)) {
                // Do nothing, subclass has handled it
            } else if (context.testExpression("Id", targetDepth)) {
                id = StringStaxUnmarshaller.getInstance().unmarshall(context);
            } else if (context.testExpression("Event", targetDepth)) {
                topicConfig.addEvent(StringStaxUnmarshaller.getInstance().unmarshall(context));
            } else if (context.testExpression("Filter", targetDepth)) {
                topicConfig.setFilter(FilterStaxUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return new SimpleEntry<String, NotificationConfiguration>(id, topicConfig);
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:41,代码来源:NotificationConfigurationStaxUnmarshaller.java

示例2: unmarshall

import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
@Override
public S3KeyFilter unmarshall(StaxUnmarshallerContext context) throws Exception {
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) {
        targetDepth += 1;
    }

    S3KeyFilter filter = new S3KeyFilter();

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument()) {
            return filter;
        }

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("FilterRule", targetDepth)) {
                filter.addFilterRule(FilterRuleStaxUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return filter;
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:29,代码来源:S3KeyFilterStaxUnmarshaller.java

示例3: unmarshall

import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
@Override
public Filter unmarshall(StaxUnmarshallerContext context) throws Exception {
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) {
        targetDepth += 1;
    }

    Filter filter = new Filter();

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument()) {
            return filter;
        }

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("S3Key", targetDepth)) {
                filter.withS3KeyFilter(S3KeyFilterStaxUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return filter;
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:29,代码来源:FilterStaxUnmarshaller.java

示例4: unmarshall

import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
@Override
public FilterRule unmarshall(StaxUnmarshallerContext context) throws Exception {
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) {
        targetDepth += 1;
    }

    FilterRule filter = new FilterRule();

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument()) {
            return filter;
        }
        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Name", targetDepth)) {
                filter.setName(StringStaxUnmarshaller.getInstance().unmarshall(context));
            } else if (context.testExpression("Value", targetDepth)) {
                filter.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return filter;
            }
        }
    }

}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:31,代码来源:FilterRuleStaxUnmarshaller.java

示例5: unmarshall

import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
@Override
public Entry<String, NotificationConfiguration> unmarshall(StaxUnmarshallerContext context) throws Exception {
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) {
        targetDepth += 1;
    }

    String id = null;
    List<String> events = new ArrayList<String>();
    Filter filter = null;
    String functionArn = null;
    String invocationRole = null;

    while (true) {
        XMLEvent xmlEvent = context.nextEvent();
        if (xmlEvent.isEndDocument()) {
            return createLambdaConfig(id, events, functionArn, invocationRole, filter);
        }

        if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
            if (context.testExpression("Id", targetDepth)) {
                id = StringStaxUnmarshaller.getInstance().unmarshall(context);
            } else if (context.testExpression("Event", targetDepth)) {
                events.add(StringStaxUnmarshaller.getInstance().unmarshall(context));
            } else if (context.testExpression("Filter", targetDepth)) {
                filter = FilterStaxUnmarshaller.getInstance().unmarshall(context);
            } else if (context.testExpression("CloudFunction", targetDepth)) {
                functionArn = StringStaxUnmarshaller.getInstance().unmarshall(context);
            } else if (context.testExpression("InvocationRole", targetDepth)) {
                invocationRole = StringStaxUnmarshaller.getInstance().unmarshall(context);
            }
        } else if (xmlEvent.isEndElement()) {
            if (context.getCurrentDepth() < originalDepth) {
                return createLambdaConfig(id, events, functionArn, invocationRole, filter);
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:41,代码来源:LambdaConfigurationStaxUnmarshaller.java


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