DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Bryan Guest

    Processing Instruction


    Does anybody know how to add the Processing Instruction to a DOMDocument using
    the createProcessingInstruction that is a part of the DOMDocument?

    Thanks,
    Bryan

  2. #2
    Russell Jones Guest

    Re: Processing Instruction

    I don't know what technology you're using, but here's a VB example. You need
    msxml2 or higher installed for this to work. Create a new project, add a
    reference to the Microsoft XML, version x.x library, and paste this code in
    as the form_load event in the default form.

    Private Sub Form_Load()
    Dim xml As New DOMDocument
    Dim pi As IXMLDOMProcessingInstruction
    Dim N As IXMLDOMNode
    Set pi = xml.createProcessingInstruction("xml", "version=""1.0""")
    xml.appendChild pi
    Set pi = xml.createProcessingInstruction("xml-stylesheet",
    "type=""text/xsl"" href=""junk.xsl""")
    Set N = xml.createElement("root")
    xml.appendChild pi
    Set xml.documentElement = N
    Debug.Print xml.xml
    End
    End Sub

    HTH
    Russell Jones
    Sr. Web Development Editor,
    DevX.com

    "Bryan" <stenfors@swbell.net> wrote in message
    news:3addca04$1@news.devx.com...
    >
    > Does anybody know how to add the Processing Instruction to a DOMDocument

    using
    > the createProcessingInstruction that is a part of the DOMDocument?
    >
    > Thanks,
    > Bryan




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links