views:

25

answers:

1

I have a .NET web service that is returning the following:

<ArrayOfAddressLocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt; 
  <AddressLocation> 
    <AddressLocationId>0</AddressLocationId> 
    <SubscribedCount>0</SubscribedCount> 
    <City>Florida A &amp; M</City> 
    <CountryStateName>Florida</CountryStateName> 
    <CountryName>United States</CountryName> 
  </AddressLocation>
</ArrayOfAddressLocation>

I am trying to parse out the city node of this for each location, however, I am getting a line break after the & in the console:

//2010-09-28 11:14:02.121 Appt Pal[8296:207] Florida A
//2010-09-28 11:14:02.121 Appt Pal[8296:207] &
//2010-09-28 11:14:02.121 Appt Pal[8296:207] M

What I don't understand is that the &amp; is valid XML, but it is not maintaining the node's value...

+1  A: 

The parser is sending the parser:foundCharacters: message three times. If you move your log statement to the parser:didEndElement:namespaceURI:qualifiedName: delegate method, you will see the entire string without the line breaks that are added by the NSLog function.

falconcreek