Skip to content

Commit 40e4ea8

Browse files
committed
Add commented out code for coercing start+end tags into null
1 parent 9951c43 commit 40e4ea8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.fasterxml.jackson</groupId>
66
<artifactId>jackson-base</artifactId>
7-
<version>2.9.5</version>
7+
<version>2.9.6-SNAPSHOT</version>
88
</parent>
99
<groupId>com.fasterxml.jackson.dataformat</groupId>
1010
<artifactId>jackson-dataformat-xml</artifactId>

src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlTokenStream.java

+15
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,24 @@ private final String _collectUntilTag() throws XMLStreamException
381381
while (true) {
382382
switch (_xmlReader.next()) {
383383
case XMLStreamConstants.START_ELEMENT:
384+
return (text == null) ? "" : text;
385+
384386
case XMLStreamConstants.END_ELEMENT:
385387
case XMLStreamConstants.END_DOCUMENT:
388+
// 04-May-2018, tatu: We could easily make <tag></tag> ALSO report
389+
// as `null`, by below, but that breaks existing tests so not
390+
// done at least until 3.0.
391+
/*
392+
if (text == null) {
393+
if (FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL.enabledIn(_formatFeatures)) {
394+
return null;
395+
}
396+
return "";
397+
}
398+
return text;
399+
*/
386400
return (text == null) ? "" : text;
401+
387402
// note: SPACE is ignorable (and seldom seen), not to be included
388403
case XMLStreamConstants.CHARACTERS:
389404
case XMLStreamConstants.CDATA:

0 commit comments

Comments
 (0)