【发布时间】:2012-10-03 07:30:40
【问题描述】:
我需要使用通用配置读取复杂的 XML 文件。有人可以帮我吗?
<configurations>
<configuration type="application configuration">
<group id="1" name="President">
<sentiment-searcher>
<sentiment id="1" type="sentiment candidate 1">
<positive>'Obama okay' 'Obama great'</positive>
<negative>'Obama bad' 'Obama idiot'</negative>
</sentiment>
<sentiment id="2" type="sentiment candidate 2">
<positive>'Putin okay'</positive>
<negative>'Putin bad'</negative>
</sentiment>
</sentiment-searcher>
</group>
</configuration>
</configurations>
【问题讨论】:
-
使用 xml 解析器。
DOM方便,SAX/STAX用于非常大的文件。 -
除非您遇到任何特定问题,否则您正在寻找的是使用通用配置 (apache) 的标准。检查this example
-
是的,这是标准的,对不起先生,我是新手 :)
标签: java xml apache-commons-config