XMLDictionary icon indicating copy to clipboard operation
XMLDictionary copied to clipboard

Attribute parsing for XML response

Open shahdhiren opened this issue 9 years ago • 1 comments

Hi,

Is there attribute parsing support for XML response? I looked at all the methods and properties, but did not get any such methods. Also, I gone through the sample example, but it does not contain such scenarios as below:

       <SrcGeos>
            <Geo>
                <Level1 DisplayText="Sao Paulo" Code="saopaulo"/>
                <Level2 DisplayText="Sao Paulo" Code="saopaulo"/>
                <City DisplayText="Sao Paulo" Code="saopaulo"/>
                <Country DisplayText="Brazil" Code="brazil"/>
                <Latitude>-23.5475</Latitude>
                <Longitude>-46.63611</Longitude>
                <Region DisplayText="Latin America" Code="latinamerica"/>
            </Geo>
        </SrcGeos>

shahdhiren avatar Oct 01 '15 09:10 shahdhiren

Yes, there's an "attributes" property added to NSDictionary by the category. You can also refer to attributes with an underscore prefix by default, e.g

xmlDict[@"_foo"] // returns attribute "foo"

nicklockwood avatar Oct 02 '15 18:10 nicklockwood