XProcessingInstruction

In this chapter you will learn:

  1. Add the processing instruction

Add the processing instruction

using System;/*from   j a va2  s  .  c  o m*/
using System.Data;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.IO;


public class MainClass{

   public static void Main(string[] args){   
      XDocument NewDoc = new XDocument(
            new XDeclaration("1.0", "utf-8", "yes"),
            new XElement("Root", "MyDoc"));
         // Add the processing instruction.
         NewDoc.AddFirst(new XProcessingInstruction(
            "xml-stylesheet", 
            "type='text/xsl' href='MyXSL.XSL'"));


   }
}

Next chapter...

What you will learn in the next chapter:

  1. Create XmlReader from FileStream
Home » C# Tutorial » XML
Parse XML file
Parse XML String
Parse XML from URL
Element create
Attribute create
Comments create
XProcessingInstruction
XmlReader
Read double value from XML
XmlReader
XmlReaderSettings
XML formatter
XmlSerializer
XmlTextReader
XmlTextWriter
XmlWriter
XmlWriterSettings
Output XML to console