04. april 2006 - 09:47
Der er
2 kommentarer
XML Parsing
Halløj Jeg kunne godt tænke mig at læse hovedet i et xml dokument. Jeg vil gerne læses alt inden <mstns:car> <?xml version="1.0" encoding="utf-8"?> <?mso-infoPathSolution solutionVersion="1.0.0.16" productVersion="11.0.6357" PIVersion="1.0.0.0" name="urn:schemas-microsoft-com:office:infopath:eks" language="en-us"?> <?mso-application progid="InfoPath.Document"?> <mstns:Summary xmlns:mstns="data.xsd"> <mstns:car> Hvordan gør jeg det?
Annonceindlæg fra Hitachi
04. april 2006 - 23:35
#1
til inspiration: using System; using System.IO; using System.Xml; namespace E { class MainClass { public static void Main(string[] args) { XmlTextReader xtr = new XmlTextReader(new StreamReader(@"C:\test.xml")); while(!xtr.EOF) { if(xtr.NodeType == XmlNodeType.Element && xtr.Name == "mstns:car") { break; } else { Console.WriteLine(xtr.NodeType + " Name=" + xtr.Name + " Value=" + xtr.Value.Replace("\r\n", "<CR><LF>")); } xtr.Read(); } } } }