Learn how to a build a cloud-first strategyRegister Now


reading an attribute from an XML

Posted on 2006-04-10
Medium Priority
Last Modified: 2013-11-19
How do I read the value of the BookStatusCode  attribute using VB 6 on the XML below.  
This is the code that i have so far for that part:

Dim oXMLDoc          As DOMDocument40
Dim oXMLDomNode      As IXMLDOMNode        
Set oXMLDoc = New DOMDocument40
bValidXML = oXMLDoc.loadXML(aRequestXML)


******************This is a sample of the XML***************************
            <Loan="CONSUMER" schemaVersion="11.0.0" trackingNumber="001500001">
                        <BookCode="PENDING" BookStatusCode="INITIATED" classCode="OPEN" >
                                                                 <CustomerProfile customerRole="APPLICANT" member="TRUE" prefillStatus="SUCCESS" roleConsent="TRUE">
                                                <firstName prefillValue="exmaple">exmaple</firstName>
                                                <lastName prefillValue="exmaple">exmaple</lastName>
                                                <middleName prefillValue="A">A</middleName>

Thanks a lot,
Question by:chicho12
LVL 52

Accepted Solution

Carl Tawn earned 1000 total points
ID: 16421684
Something like:

    Dim oNode As IXMLDomNode
    Set oNode = oXMLDoc.selectSingleNode("/BizTalk/Body/Loan/TransferRequest/BookCode")

    MsgBox oNode.attributes.getNamedItem("BookStatusCode").Text

Although, the XML you posted is badly formed. Either that was a typo, or you need to revise your XML.

For example, this line: <BookCode="PENDING" BookStatusCode="INITIATED" classCode="OPEN" >

is invalid. You cannot have ="PENDING" on a node name, it needs to be an attribute.

Author Comment

ID: 16421900
It works,



Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

810 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