Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











METHOD:  Document::createProcessingInstruction

Document.createProcessingInstruction(target, data)

The createProcessingInstruction method creates a ProcessingInstruction object with the specified target name and data string. Creating an instance of this object does not automatically include it in the XML Document tree, and so its parentNode property is set to null.

The following example creates the ProcessingInstruction '<?xml version="1.0"?> and add it as the first child node of the document. To do this, the code uses the insertBefore method.

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("quotations.xml")

Dim objNewPI, currNode
Set objNewPI = objXMLDoc.createProcessingInstruction("xml", " version = ""1.0""")
objXMLDoc.insertBefore objNewPI, objXMLDoc.firstChild

Set currNode = objXMLDoc.firstChild
document.write(currNode.nodeType)
document.write("<br>" & currNode.nodeName)
document.write("<br>" & currNode.nodeValue)

Output:
7
xml
version="1.0"

The value '7' returned for the node's type indicates that it is a ProcessingInstruction object (see the list of node types).



 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information