Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //System.Console.WriteLine("Hello, World!");
- // Create the XmlDocument.
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(
- "<plist>"+
- "<key>AudioList</key>"+
- "<array>"+
- "<dict>"+
- "<key>AudioBitrate</key>"+
- "<string>160</string>"+
- "<key>AudioEncoder</key>"+
- "<string>AAC (faac)</string>"+
- "<key>AudioTrack</key>"+
- "<integer>1</integer>"+
- "<key>AudioTrackDRCSlider</key>"+
- "<real>1</real>"+
- "<key>BogusA</key>"+
- "<false/>"+
- "<key>BugosB</key>"+
- "<true/>"+
- "</dict>"+
- "</array>"+
- "</plist>"
- );
- XmlNode root = doc.FirstChild;
- if( !root.HasChildNodes )
- return;
- XmlNode audioListKey = root.ChildNodes[0];
- XmlNode audioListDict = root.ChildNodes[1].FirstChild;
- for( int i = 0; i < audioListDict.ChildNodes.Count; i += 2 )
- {
- XmlNode key = audioListDict.ChildNodes[i];
- XmlNode value = audioListDict.ChildNodes[i + 1];
- if( value.Name == "true" )
- Console.WriteLine( "key={0} value=true", key.InnerText );
- else if( value.Name == "false" )
- Console.WriteLine( "key={0} value=false", key.InnerText );
- else
- Console.WriteLine( "key={0} value={1}", key.InnerText, value.InnerText );
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment