这样的xml该怎么读取数据那啊各位大侠?(比较着急)
请多帮忙!!!
我想在vs 2008 C#里面读取如下的xml文件,取得 <Bold> The text needed </Bold> 中间的字符串,请教各位怎么操作那?
看了不少帖子,仍然不得要领。
<FlowDocument xml:space= "preserve "
xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation "
ColumnRuleWidth= "1 " ColumnRuleBrush= "Black "
ColumnWidth= "200 ">
<Table>
<TableRowGroup>
<TableRow>
<TableCell >
<Section Style= "{StaticResource MouseOverHighlightStyle} " >
<Paragraph>
<Hyperlink NavigateUri= "C:\TheStraitsTimes\philippine.xml ">
<Bold> The text needed </Bold>
</Hyperlink>
</Paragraph>
</Section>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
------解决方案--------------------XmlReader reader = new XmlTextReader( "XMLFile1.xml ");
while(reader.Read())
{
if (reader.Name.ToLower().Equals( "bold "))
{
Console.WriteLine(reader.ReadInnerXml());
//break;
}
}
reader.Close();