Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child nodes not being correctly picked up #13

Closed
jbmlaird opened this issue Jan 11, 2017 · 1 comment
Closed

Child nodes not being correctly picked up #13

jbmlaird opened this issue Jan 11, 2017 · 1 comment

Comments

@jbmlaird
Copy link

Apologies for the general question but I wasn't getting much help from StackOverflow.

I'm trying to parse some XML using IceSoap but it's returning null for some values, I think there's an error with my parse classes.

This is what my XML looks like:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetDepBoardWithDetailsResponse xmlns="http://thalesgroup.com/RTTI/2016-02-16/ldb/">
         <GetStationBoardResult xmlns:lt3="http://thalesgroup.com/RTTI/2015-05-14/ldb/types" xmlns:lt5="http://thalesgroup.com/RTTI/2016-02-16/ldb/types" xmlns:lt4="http://thalesgroup.com/RTTI/2015-11-27/ldb/types" xmlns:lt="http://thalesgroup.com/RTTI/2012-01-13/ldb/types" xmlns:lt2="http://thalesgroup.com/RTTI/2014-02-20/ldb/types">
            <lt4:generatedAt>2017-01-10T21:52:46.8436123+00:00</lt4:generatedAt>
            <lt4:locationName>Birmingham New Street</lt4:locationName>
            <lt4:crs>BHM</lt4:crs>
            <lt4:filterLocationName>Redditch</lt4:filterLocationName>
            <lt4:filtercrs>RDC</lt4:filtercrs>
            <lt4:platformAvailable>true</lt4:platformAvailable>
            <lt5:trainServices>
               <lt5:service>
                  <lt4:std>22:14</lt4:std>
                  <lt4:etd>On time</lt4:etd>
                  <lt4:platform>9B</lt4:platform>
                  <lt4:operator>London Midland</lt4:operator>
                  <lt4:operatorCode>LM</lt4:operatorCode>
                  <lt4:serviceType>train</lt4:serviceType>
                  <lt4:serviceID>REA+a3xzY/NH5bk/XmEgww==</lt4:serviceID>
                  <lt5:rsid>LM139600</lt5:rsid>
                  <lt5:origin>
                     <lt4:location>
                        <lt4:locationName>Lichfield Trent Valley</lt4:locationName>
                        <lt4:crs>LTV</lt4:crs>
                     </lt4:location>
                  </lt5:origin>
                  <lt5:destination>
                     <lt4:location>
                        <lt4:locationName>Redditch</lt4:locationName>
                        <lt4:crs>RDC</lt4:crs>
                     </lt4:location>
                  </lt5:destination>
                  etc.

Service (parent class):

@XMLObject("//GetStationBoardResult")
public class Service
{
    @XMLField("trainServices")
    private TrainServices trainServices;

    @XMLField("generatedAt")
    private String generatedAt;
}

TrainServices

@XMLObject("//trainServices")
public class TrainServices
{
    @XMLField("service")
    private InnerService service;
}

InnerService

@XMLObject("//service")
public class InnerService
{
    @XMLField("std")
    private String std;
}

My parent class Service gets instantiated and the value for generatedAt does get fetched but anything beyond that does not get included. TrainServices is always null. Where am I going wrong?

@AlexGilleran
Copy link
Owner

I've responded in a comment on your SO Thread. Shame you got those downvotes :/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants