Solved

Get proc. instruct. using MSXML DOM

Posted on 2000-04-19
1
353 Views
Last Modified: 2012-05-04
How do I get the first processing instruction in an XML document, using Microsoft's DOM API?

For example:
<?xml version="1.0" standalone="yes"?>
<root>
  <?process action="ignore"?>
  <test/>
</root>

In this example I can get the "process" node alright, but the "xml" processing instruction I cannot.  The way I retrieve the XML nodes is by first getting the document element and then going through the tree.
0
Comment
Question by:sgerlach
1 Comment
 
LVL 1

Accepted Solution

by:
abk102299 earned 100 total points
ID: 2735311
Dim root
Dim xmlDoc
Dim processNode
 
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("example.xml")
'Set root to the XML document's root element, COLLECTION:
Set root = xmlDoc.documentElement
'Set processNode to the "xml" processing instruction ( in case of your example input )
Set processNode = root.previousSibling

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now