Skip to content

Commit bf874c0

Browse files
committed
minor change
1 parent 4e36459 commit bf874c0

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

src/main/java/org/xmlobjects/util/xml/DepthXMLStreamReader.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,10 @@ public void require(int type, String namespaceURI, String localName) throws XMLS
122122

123123
@Override
124124
public String getElementText() throws XMLStreamException {
125-
if (getEventType() != START_ELEMENT) {
126-
throw new XMLStreamException("Parser must be on START_ELEMENT to read next text.");
127-
}
128-
129-
StringBuilder text = new StringBuilder();
130-
while (hasNext()) {
131-
switch (next()) {
132-
case CHARACTERS:
133-
case CDATA:
134-
case SPACE:
135-
text.append(getText());
136-
break;
137-
case END_ELEMENT:
138-
return text.toString();
139-
case START_ELEMENT:
140-
throw new XMLStreamException("Element text content may not contain START_ELEMENT.");
141-
}
142-
}
143-
144-
throw new XMLStreamException("Unexpected end of document when reading element text content.");
125+
String text = reader.getElementText();
126+
state++;
127+
depth--;
128+
return text;
145129
}
146130

147131
@Override

0 commit comments

Comments
 (0)