string filePath = @"geocode.xml";
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(filePath);
XmlElement xyinfo = xmlDocument.DocumentElement;
XmlElement iteminfo = (XmlElement)xyinfo.ChildNodes[2];
XmlElement pointinfo = (XmlElement)iteminfo.ChildNodes[0];
XmlElement pointinfox = (XmlElement)pointinfo.ChildNodes[0];
XmlElement pointinfoy = (XmlElement)pointinfo.ChildNodes[1];
label2.Text = pointinfox.InnerText;
label4.Text = pointinfoy.InnerText;
string filePath2 = @"geocode2.xml";
XmlDocument xmlDocument2 = new XmlDocument();
xmlDocument2.Load(filePath2);
XmlElement xyinfo2 = xmlDocument2.DocumentElement;
XmlElement iteminfo2 = (XmlElement)xyinfo2.ChildNodes[2];
XmlElement pointinfo2 = (XmlElement)iteminfo2.ChildNodes[0];
XmlElement pointinfox2 = (XmlElement)pointinfo2.ChildNodes[0];
XmlElement pointinfoy2 = (XmlElement)pointinfo2.ChildNodes[1];
label5.Text = pointinfox2.InnerText;
label6.Text = pointinfoy2.InnerText;
첫번째 아이템의 좌표 추출이다. 다음 아이템의 것을 추출하려면, xyinfo2.ChildNodes에서 3, 4로 이동하면서 찾으면 된다.
댓글 달기