1
我有以下的XML,并为我的生活无法获得兄弟姐妹或兄弟姐妹的工作。我试过这些没有运气。jaxb moxy xpath之前的兄弟姐妹
我想获得名称属性等于“sporting”的Category元素之前的兄弟姐妹。所以这将是我想要的组元素。这些工作都不是:
Transaction/Animals/Dog/Boxers/Boxer/Category[@name='sporting']/preceding-sibling::
Transaction/Animals/Dog/Boxers/Boxer/Category[@name='sporting']/preceding-sibling::[1]
Transaction/Animals/Dog/Boxers/Boxer/Category[@name='sporting']/preceding-sibling::Group
甚至不能得到前拳击手....这些工作都没有。
Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::
Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::Boxer
Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::[1]
Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::[*]
--thanks
<Transaction>
<Animals>
<Dog>
<Boxers>
<Boxer id="46436">
<Transaction source="kennel"/>
<Category name="local"/>
</Boxer>
<Boxer name="Spike">
<Group id="456"/>
<Category name="sporting"/>
</Boxer>
</Boxers>
</Dog>
<Dog>
<Location Storee="pet store"/>
<Boxers>
<Boxer id="345739">
<Submission Source="store"/>
<Category name="local"/>
</Boxer>
<Boxer name="Butch">
<Group id="123"/>
<Category name="sporting"/>
</Boxer>
</Boxers>
<Additional>
<EffectiveDate>2015-03-01</EffectiveDate>
<ExpirationDate>2016-03-01</ExpirationDate>
</Additional>
</Dog>
</Animals>
</Transaction>
确定使用这些工作http://www.utilities-online.info/xpath两个 但没有一个适用于使用莫西的@XmlPath标签。 ARRRRGH! [交易/动物/狗/拳击手/拳击手[@ name ='Butch'] /之前的兄弟姐妹:: * 交易/动物/狗/拳击手/义和团[@ name ='Butch'] /义和团] –