Hello,
I'm a beginner and i got serious issues with reading xml in C#.
This is my XML doc:
I'm trying to fetch the Width, Height and SamplingRate/String into textboxes.
I started with the width, and i came up with this:
I just cant get it to work, can somebody give me advice?
Thanks in advance!
Regards,
Dennis
I'm a beginner and i got serious issues with reading xml in C#.
This is my XML doc:
Code:
<?xml version='1.0' encoding='ISO-8859-1'?><MediaInfo><File CompleteFileName='ToDo'> <StreamKind ID='General'> <Stream ID='0'><Tag ID='Format/String'>AVI</Tag> <Tag ID='OveralBitRate/String'></Tag> <Tag ID='FileSize/String'>698 MiB</Tag> </Stream> </StreamKind> <StreamKind ID='Video'> <Stream ID='0'><Tag ID='Codec/String'>XviD</Tag> <Tag ID='Width'>640</Tag> <Tag ID='Height'>272</Tag> </Stream> </StreamKind> <StreamKind ID='Audio'> <Stream ID='0'><Tag ID='Codec/String'>AC3</Tag> <Tag ID='SamplingRate/String'>48 KHz</Tag> </Stream> </StreamKind> </File> </MediaInfo>
I started with the width, and i came up with this:
Code:
XmlDocument doc = new XmlDocument(); doc.Load("C:\\example.xml"); xmlwidth = doc.GetElementById("Width"); newWidthBox.Text = xmlwidth;
Thanks in advance!
Regards,
Dennis
Comment