【发布时间】:2016-08-21 11:37:59
【问题描述】:
我有以下 XML 架构:
<children>
<component library="xml">
<properties Output="1"/>
<data>
<root scrollposition="1">
<entry name="Demo" expanded="1">
<entry name="Subentry">
</entry>
</entry>
</root>
</data>
</component>
<component library="xml">
<properties/>
<data>
<root scrollposition="1">
<entry name="Demo" expanded="1">
<entry name="Subentry">
</entry>
</entry>
</root>
</data>
</component>
</children>
现在我想获取元素properties 中属性library 的值为xml 且属性Output 的值为1 的条目。
我的班级如下:
public class Component {
@XmlPath("component[@library='xml' and properties[@Output='1']]/data/root/entry")
private List<Entry> entries;
public List<Entry> getEntries() {
return entries;
}
public void setEntries(List<Entry> entries) {
this.entries = entries;
}
}
但列表为空。 我认为注释“XmlPath”中的某些内容是错误的,但我现在不知道有什么问题。
【问题讨论】:
标签: java xml eclipselink moxy