XML in ViBa with DOM

Posted on 2003-02-27
Medium Priority
Last Modified: 2010-05-01
Using Visual Basic together with Ms Xml 4.0 SP1

with the following xml-file:

<?xml version="1.0" ?>
<!DOCTYPE data SYSTEM "-------Censored--------">
<error code="-3002804">
<string>WARNING: vault..proc_insertMSG. Message cannot be queued. Transmission is within 60 seconds of existing entry in queue.</string>

Now, i'm looking for ways to read the <string> , but strangely it works no matter what i try, but i can't read the error code itself

VB code i have sofar:

Dim doc As New DOMDocument40
doc.async = False
doc.validateOnParse = False
doc.resolveExternals = False
xmlPath = "temp.xml"
doc.Load xmlPath
message = doc.selectSingleNode("data").Text  '<-- still gives the whole line :S
Question by:LaMoS
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 16

Expert Comment

ID: 8035684
LVL 75

Expert Comment

by:Anthony Perkins
ID: 8036235
Change this line:
message = doc.selectSingleNode("data").Text

message = doc.selectSingleNode("data/error/string").Text


Expert Comment

ID: 8038850
It's not clear whether you want the string or the error code.  If you want the string, then acperkins' suggestion should work.  If you want the error code you need to use:
If Not oNode Is Nothing then
End If

Accepted Solution

WHalphen earned 300 total points
ID: 8038856

I had a typo... change "default" to "code"...

If Not oNode Is Nothing then
End If

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

801 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