SPR-8457 - XMLEventStreamReader.getText() fails for COMMENT and ENTITY_REFERENCE events
This commit is contained in:
parent
e79e08d7f7
commit
7c504853cd
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.XMLEventReader;
|
||||||
import javax.xml.stream.XMLStreamException;
|
import javax.xml.stream.XMLStreamException;
|
||||||
import javax.xml.stream.events.Attribute;
|
import javax.xml.stream.events.Attribute;
|
||||||
|
import javax.xml.stream.events.Comment;
|
||||||
import javax.xml.stream.events.Namespace;
|
import javax.xml.stream.events.Namespace;
|
||||||
import javax.xml.stream.events.ProcessingInstruction;
|
import javax.xml.stream.events.ProcessingInstruction;
|
||||||
import javax.xml.stream.events.StartDocument;
|
import javax.xml.stream.events.StartDocument;
|
||||||
|
|
@ -74,6 +75,9 @@ class XMLEventStreamReader extends AbstractXMLStreamReader {
|
||||||
if (event.isCharacters()) {
|
if (event.isCharacters()) {
|
||||||
return event.asCharacters().getData();
|
return event.asCharacters().getData();
|
||||||
}
|
}
|
||||||
|
else if (event.getEventType() == XMLEvent.COMMENT) {
|
||||||
|
return ((Comment) event).getText();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue