davidogdenblue
asked on
How do I read information froma file?
I keep on coming across situations where reading data from a file would be incredibly useful. Are there any standard methods to get at the data I need, ignoring the stuff I don't want and placing that data somewhere where I can manipulate it in my program.
Currently I want to read subtitle data from an XML based subtitle file. The data looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<DCSubtitle Version="1.0">
<SubtitleID>SomeID</Subtit leID>
<MovieTitle>Some Movie</MovieTitle>
<ReelNumber>1</ReelNumber>
<Language>French</Language >
<Font Italic="no">
<Font Italic="yes">
<Subtitle SpotNumber="1" TimeIn="10:00:58:080" TimeOut="10:01:01:220" FadeUpTime="20" FadeDownTime="20">
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="14.0">some Caption</Text>
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="6.0">Some Caption</Text>
</Subtitle>
</Font>
<Font Italic="yes">
<Subtitle SpotNumber="2" TimeIn="10:01:02:020" TimeOut="10:01:05:220" FadeUpTime="20" FadeDownTime="20">
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="14.0">Some Caption</Text>
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="6.0">Some Caption</Text>
</Subtitle>
</Font>
</DCSubtitle>
What can I do with this?
Currently I want to read subtitle data from an XML based subtitle file. The data looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<DCSubtitle Version="1.0">
<SubtitleID>SomeID</Subtit
<MovieTitle>Some Movie</MovieTitle>
<ReelNumber>1</ReelNumber>
<Language>French</Language
<Font Italic="no">
<Font Italic="yes">
<Subtitle SpotNumber="1" TimeIn="10:00:58:080" TimeOut="10:01:01:220" FadeUpTime="20" FadeDownTime="20">
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="14.0">some Caption</Text>
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="6.0">Some Caption</Text>
</Subtitle>
</Font>
<Font Italic="yes">
<Subtitle SpotNumber="2" TimeIn="10:01:02:020" TimeOut="10:01:05:220" FadeUpTime="20" FadeDownTime="20">
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="14.0">Some Caption</Text>
<Text Direction="horizontal" HAlign="center" HPosition="0.0" VAlign="bottom" VPosition="6.0">Some Caption</Text>
</Subtitle>
</Font>
</DCSubtitle>
What can I do with this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry I ignored the code that you seemed to have commented out. Whoops
dg is a datagrid name. Paste the code and you can run it
ASKER
What should I be declaring "dg" as?