Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的元素
<name></name>
但在我的 switch 语句中
case XMLEvent.CHARACTERS:{ ... }
没有被调用。知道如何获得此活动吗?
没有要报告的字符内容,因此您不会收到 CHARACTERS 事件。您将需要解决此问题;例如,您可以XMLStreamReader.getElementText()在流指向 START_ELEMENT 时使用。在您的情况下,调用该方法将返回空字符串,并将流移动到匹配的 END_ELEMENT。
XMLStreamReader.getElementText()