1
임은 구글 API 장소에서 XML 파일을 읽고 구조에 추가하려고하지만, 그것에 메신저 새가 ... 나는이 같은 XML 파일이 있기 때문에 메신저 C#을 몇 가지 문제가 :nodeType을 어떻게 찾을 수 있습니까?
<PlaceSearchResponse>
<status>OK</status>
<result>
<name>Williamsburg</name>
<type>locality</type>
<type>political</type>
<icon>http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png</icon>
<reference>CkRAAAAAUhZG...Yy0b4-sd1zCUu9P8</reference>
</result>
<result>
<name>Greenpoint</name>
<vicinity>New York</vicinity>
<type>neighborhood</type>
<type>political</type>
<icon>http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png</icon>
<reference>CkQ-AAAAHIDo...nYmSR8l52FmkMH6c</reference>
<name>Peter Luger Steakhouse</name>
<vicinity>Broadway, Brooklyn</vicinity>
<type>restaurant</type>
<type>food</type>
<type>establishment</type>
<icon>http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png</icon>
<reference>ClRBAAAATIpR...mHSxoyiRcr_FVuww</reference>
</result>
...additional results...
</PlaceSearchResponse>
을 그리고 모든 노드를 반복하고 목록에 추가해야합니다. 이런 식으로 뭔가 :
while (nodetype == "type")
{
PlaceType t = new PlaceType();
t.name = x.Element("type").Value;
place.types.Add(t);
}
또한, 내 수업 장소 : 다음은 문자열 배열에 모든 유형을 끌어
public class Place
{
public string name { get; set; }
public List<PlaceType> types { get; set; }
public string vicinity { get; set; }
public string icon { get; set; }
public string reference { get; set; }
}