1
votes

I have the following xml and for the life of me cannot get preceding-sibling or following-sibling to work. I've tried these with no luck.

I would like to get the sibling just before the Category element that has name attribute that equals "sporting". So it would be the Group element i want. None of these work:

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

Cant even get previous boxer....none of these work.

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>
1
Ok both of these work using utilities-online.info/xpath But neither one works using Moxy's @XmlPath tag. ARRRRGH!!! [Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::* Transaction/Animals/Dog/Boxers/Boxer[@name='Butch']/preceding-sibling::Boxer] - Jared Tims

1 Answers

1
votes

Well, figured out that moxy doesn't do axis. Which is ridiculous.

EclipseLink MOXy @XmlPath support for axes/parent