AlexGilleran / IceSoap

Easy, asynchronous, annotation-based SOAP for Android
Other
75 stars 18 forks source link

Access to attributes #6

Closed danielnilsson9 closed 8 years ago

danielnilsson9 commented 8 years ago

Not sure if this is not supported or just me being stupid but basically I have this SOAP response:

<SOAP-ENV:Envelope 
    xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
    xmlns:trt="http://www.onvif.org/ver10/media/wsdl" 
    xmlns:tt="http://www.onvif.org/ver10/schema">
   <SOAP-ENV:Body>
      <trt:GetProfilesResponse>
         <trt:Profiles fixed="true" token="000">
            <tt:Name>Profile_000</tt:Name>
            <tt:VideoSourceConfiguration token="000">
               <tt:Name>VideoS_000</tt:Name>
    ....
</SOAP-ENV:Envelope>

I need to access the value of the attribute "token" in the "Profiles" node, is it supported by the parser in any way or do I have to parse the xml manually? Obviously the XMLField annotation does not work for this.

Thanks in advance

AlexGilleran commented 8 years ago

Yep should work - attributes are part of the subset defined in https://github.com/AlexGilleran/IceSoap/wiki/Getting-Started-%283%29#using-xmlobject.

In XPath you target attributes by prefixing @ to the name. So that should be accessible with XMLField("@token") or something like that.

danielnilsson9 commented 8 years ago

Ohh, how embarrassing, looks like I read through these documents a bit too fast, missed the @ part... Thank you for your the library and your help, works perfectly!

AlexGilleran commented 8 years ago

No worries, great to hear it's helped :)