使用Xstream解析混合的文本和xml节点 [英] Parsing mixed text and xml nodes with Xstream
本文介绍了使用Xstream解析混合的文本和xml节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试解析xml,如下所示:
I'm trying to parse xml done like this:
<foreign lang="gre">‘<LM lemma="auieo" catg="fg">auieo</LM>’</foreign>
我正在使用Xstream,并且尝试编写一个特定的Converter,但是它不起作用:( 我不明白如何在文本"块和文本"块中拆分外来内容. 引理xml(为此我有一个特定的Converter)
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)
推荐答案
Xstream无法解析混合内容.我使用xslt预处理了xml,并使用以下命令将其转换为未混合的xml:
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>
这篇关于使用Xstream解析混合的文本和xml节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文