Thorin Oakenshield Thorin Oakenshield - 1 year ago 196
C# Question

How to read processing instruction from an XML file using .NET 3.5

How to check whether an Xml file have processing Instruction


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


I need to read the processing instruction

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

from the XML file.

Please help me to do this.

Answer Source

How about:

XmlProcessingInstruction instruction = doc.SelectSingleNode("processing-instruction('xml-stylesheet')") as XmlProcessingInstruction;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download