本文整理汇总了Java中javax.xml.stream.events.XMLEvent.isEndDocument方法的典型用法代码示例。如果您正苦于以下问题:Java XMLEvent.isEndDocument方法的具体用法?Java XMLEvent.isEndDocument怎么用?Java XMLEvent.isEndDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.stream.events.XMLEvent
的用法示例。
在下文中一共展示了XMLEvent.isEndDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}
示例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);
}
}
}
}
示例6: getElementText
import javax.xml.stream.events.XMLEvent; //导入方法依赖的package包/类
@Override
public final String getElementText() throws XMLStreamException {
XMLEvent event = this.previousEvent;
if (event == null) {
throw new XMLStreamException("Must be on START_ELEMENT to read next text, element was null");
}
if (!event.isStartElement()) {
throw new XMLStreamException("Must be on START_ELEMENT to read next text", event.getLocation());
}
final StringBuilder text = new StringBuilder();
while (!event.isEndDocument()) {
switch (event.getEventType()) {
case XMLStreamConstants.CHARACTERS:
case XMLStreamConstants.SPACE:
case XMLStreamConstants.CDATA: {
final Characters characters = event.asCharacters();
text.append(characters.getData());
break;
}
case XMLStreamConstants.ENTITY_REFERENCE: {
final EntityReference entityReference = (EntityReference)event;
final EntityDeclaration declaration = entityReference.getDeclaration();
text.append(declaration.getReplacementText());
break;
}
case XMLStreamConstants.COMMENT:
case XMLStreamConstants.PROCESSING_INSTRUCTION: {
//Ignore
break;
}
default: {
throw new XMLStreamException("Unexpected event type '" + XMLStreamConstantsUtils.getEventName(event.getEventType()) + "' encountered. Found event: " + event, event.getLocation());
}
}
event = this.nextEvent();
}
return text.toString();
}