Parsing mixed text and xml nodes with Xstream

瘦欲@ 提交于 2019-12-25 08:32:58

问题


I'm trying to parse xml done like this:

<foreign lang="gre">&lsquo;<LM lemma="auieo" catg="fg">auieo</LM>&rsquo;</foreign>

I'm using Xstream, and I tried to write a specific Converter, but it does not work :( I don't understand how to split the content of foreign in 'text' blocks and in the Lemma xml (I've a specific Converter for that)


回答1:


Xstream is not able to parse mixed content. I preprocessed the xml with xslt and transfored it to unmixed xml, with this command:

<xsl:template match="text()">
     <t> <xsl:value-of select="."/> </t>
</xsl:template>


来源:https://stackoverflow.com/questions/10065648/parsing-mixed-text-and-xml-nodes-with-xstream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!