如何读取使用.NET 3.5 XML文件处理指令 [英] How to read processing instruction from an XML file using .NET 3.5

查看:155
本文介绍了如何读取使用.NET 3.5 XML文件处理指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查XML文件是否有处理指令

How to check whether an Xml file have processing Instruction

示例

 <?xml-stylesheet type="text/xsl" href="Sample.xsl"?>

 <Root>
    <Child/>
 </Root>

我需要阅读的处理指令

I need to read the processing instruction

<?xml-stylesheet type="text/xsl" href="Sample.xsl"?>

从XML文件中。

from the XML file.

请帮我做这件事。

推荐答案

怎么样:

XmlProcessingInstruction instruction = doc.SelectSingleNode("processing-instruction('xml-stylesheet')") as XmlProcessingInstruction;

这篇关于如何读取使用.NET 3.5 XML文件处理指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆