[英]special characters in xml stax parser file
original xml file:
<root> <article>
<artists><artist role="A&R Staff" id="1">Vance</artist><artists></article>
</root>
当我使用stax解析器读取文件并将其写入新文件时,它会创建无效的xml文件,因为新文件中没有&amp。
下面为我工作:
// This can be any InputStream
InputStream is;
XMLInputFactory factory = XMLInputFactory.newInstance();
// Set this property to handle special HTML characters like & etc.
factory.setProperty(XMLInputFactory.IS_COALESCING, true);
// Now use the factory to get the EventReader from the InputStream
XMLEventReader eventReader = factory.createXMLEventReader(is);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.