reading an attribute from an XML

Hi,
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***************************
<BizTalk>
      <Body>
            <Loan="CONSUMER" schemaVersion="11.0.0" trackingNumber="001500001">
                  <TransferRequest>
                        <BookCode="PENDING" BookStatusCode="INITIATED" classCode="OPEN" >
                              <dateOfLoan>04/03/2006</dateOfLoan>
                                            </BookCode>
                                                                 <CustomerProfile customerRole="APPLICANT" member="TRUE" prefillStatus="SUCCESS" roleConsent="TRUE">
                              <BasicInformation>
                                    <CustomerName>
                                          <IndividualName>
                                                <firstName prefillValue="exmaple">exmaple</firstName>
                                                <lastName prefillValue="exmaple">exmaple</lastName>
                                                <middleName prefillValue="A">A</middleName>
                                          </IndividualName>
                                    </CustomerName>
                              </BasicInformation>
                                                                </CustomerProfile>      
                                                 </TransferRequest>
            </Loan>
                 </Body>
</BizTalk>


Thanks a lot,
Chicho
chicho12Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chicho12Author Commented:
It works,

THanks

Chicho
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.