Guest User

Untitled

a guest
Jun 13th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Xml;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. //System.Console.WriteLine("Hello, World!");
  14.  
  15. // Create the XmlDocument.
  16. XmlDocument doc = new XmlDocument();
  17. doc.LoadXml(
  18. "<plist>"+
  19. "<key>AudioList</key>"+
  20. "<array>"+
  21. "<dict>"+
  22. "<key>AudioBitrate</key>"+
  23. "<string>160</string>"+
  24. "<key>AudioEncoder</key>"+
  25. "<string>AAC (faac)</string>"+
  26. "<key>AudioTrack</key>"+
  27. "<integer>1</integer>"+
  28. "<key>AudioTrackDRCSlider</key>"+
  29. "<real>1</real>"+
  30. "<key>BogusA</key>"+
  31. "<false/>"+
  32. "<key>BugosB</key>"+
  33. "<true/>"+
  34. "</dict>"+
  35. "</array>"+
  36. "</plist>"
  37. );
  38.  
  39. XmlNode root = doc.FirstChild;
  40. if( !root.HasChildNodes )
  41. return;
  42.  
  43. XmlNode audioListKey = root.ChildNodes[0];
  44. XmlNode audioListDict = root.ChildNodes[1].FirstChild;
  45. for( int i = 0; i < audioListDict.ChildNodes.Count; i += 2 )
  46. {
  47. XmlNode key = audioListDict.ChildNodes[i];
  48. XmlNode value = audioListDict.ChildNodes[i + 1];
  49. if( value.Name == "true" )
  50. Console.WriteLine( "key={0} value=true", key.InnerText );
  51. else if( value.Name == "false" )
  52. Console.WriteLine( "key={0} value=false", key.InnerText );
  53. else
  54. Console.WriteLine( "key={0} value={1}", key.InnerText, value.InnerText );
  55. }
  56. }
  57. }
  58. }
Add Comment
Please, Sign In to add comment