1

I am hoping someone could help, and would really appreciate.

I am trying to create elements from an xml using simple xml for android and I am not interested in the root, but only some nested elements. I wonder if there is a way for simple xml to get those elements without me creating all the classes starting from root(Response class in this case). I am only interested in getting the Stations class from the xml below.

Thank you.

    <Response xmlns="http://www.sss.com/ws/">
    <GroupInfo>
    <Id>lirr</Id>
    <Name>Long Island Rail Road</Name>
    <VehicleTypes>R</VehicleTypes>
    <Category>NYC to LI Regional Rail</Category>
    <IconLarge>
    <Width>50</Width>
    <Height>50</Height>
    </IconLarge>
    <Icon>
    <Width>25</Width>
    <Height>25</Height>
    </Icon>
    <Stations>
    <Station>
    <Id>albertson</Id>
    <Name>Albertson</Name>
    <X>-73.64169</X>
    <Y>40.77205</Y>
    <Radius>100</Radius>
    </Station>
    <Station>
    <Id>yaphank</Id>
    <Name>Yaphank</Name>
    <X>-72.91588</X>
    <Y>40.8256</Y>
    <Radius>100</Radius>
    </Station>
    </Stations>
    </GroupInfo>
    <ResponseStatus>
    <ResultCode>200</ResultCode>
    <ResultString>Success.</ResultString>
    </ResponseStatus>
    </Response>

1 Answer 1

1

I found the solution. I used @Path to specify the xpath and it solves the problem http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#xpath

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.