Thorin Oakenshield Thorin Oakenshield - 28 days ago 4x
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.


How about:

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