Advertisement
Guest User

C# ReadAttributeValue example

a guest
Aug 19th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Xml;
  4.  
  5. class Test {
  6.     public static void Main () {
  7.         TextReader reader = new StringReader ("<elem att1='foo' att2='bar'/>");
  8.         XmlReader xml = XmlReader.Create (reader);
  9.         while (xml.Read ())
  10.             while (xml.MoveToNextAttribute ())
  11.                 while (xml.ReadAttributeValue ())
  12.                     Console.WriteLine (xml.Value);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement