SPR-8457 - XMLEventStreamReader.getText() fails for COMMENT and ENTITY_REFERENCE events

master
Arjen Poutsma 13 years ago
parent e79e08d7f7
commit 7c504853cd
  1. 6
      org.springframework.core/src/main/java/org/springframework/util/xml/XMLEventStreamReader.java

@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,6 +23,7 @@ import javax.xml.stream.Location;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Comment;
import javax.xml.stream.events.Namespace;
import javax.xml.stream.events.ProcessingInstruction;
import javax.xml.stream.events.StartDocument;
@ -74,6 +75,9 @@ class XMLEventStreamReader extends AbstractXMLStreamReader {
if (event.isCharacters()) {
return event.asCharacters().getData();
}
else if (event.getEventType() == XMLEvent.COMMENT) {
return ((Comment) event).getText();
}
else {
throw new IllegalStateException();
}

Loading…
Cancel
Save