2010-02-24 4 views

답변

1

Silverlight에서 LINQ to XML 또는 XmlReader을 사용하여 XML 데이터를 구문 분석 할 수 있습니다.

다음은 XmlReader를 사용하는 몇 가지 예제 코드입니다. 매우 간단하며 만이 정의한 정확한 입력 문자열을 사용할 수 있습니다. 그러나 그것은 당신을 당신의 길로 인도하기에 충분해야합니다.

http://msdn.microsoft.com/en-us/library/cc188996(VS.95).aspx

+0

감사합니다! :

string xmlText= @" <Person> <Name>abc</Name> <Age>22</Age> </Person>"; // Create an XmlReader using (XmlReader reader = XmlReader.Create(new StringReader(xmlText))) { // Parse the file and display each of the nodes. while (reader.Read()) { if (reader.Name == "Name" && reader.NodeType == XmlNodeType.Element) { // Advace to the element's text node reader.Read(); // ... do what you want (you can get the value with reader.Value) } else if (reader.Name == "Age" && reader.NodeType == XmlNodeType.Element) { // Advace to the element's text node reader.Read(); // ... do what you want (you can get the value with reader.Value) } } 

여기에서 자세한 내용과 기사의 그것은 나를 위해 일했다. –

관련 문제