QTP-XML service functions (7) – Add processing instruction
Parent page: Service Functions – XML (QTP, VBScript)
Description
This particular example demonstrates adding XSL call that contains instructions transforming XML tree to a web-page (HTML).
Built-in QTP support for XML does not provide mapping for XML methods that operate special nodes, like Processing Instructions. It can be done through Microsoft XML DOM object.
Dim objXMLDoc Dim objNode Set objXMLDoc = CreateObject("Microsoft.XMLDOM") objXMLDoc.async = False objXMLDoc.load("C:\Temp\textdiff.xml") Set objNode = objXMLDoc.CreateProcessingInstruction("xml-stylesheet", "type=""text/xsl"" href="".\showdiff.xsl""") objXMLDoc.InsertBefore objNode, objXMLDoc.FirstChild objXMLDoc.Save("C:\Temp\textdiff.xml") Set objXMLDoc = Nothing Set objNode = Nothing