Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3216568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:18:35+00:00 2026-05-17T15:18:35+00:00

I know it is easier to read xml files in vb.net but since our

  • 0

I know it is easier to read xml files in vb.net but since our appl is still on vb6, i need a work around. but somehow, i am stuck. also i do not have control over the xml file as it is being generated from another application. Short code from the xml file is below,

    <Report>
           <Categories>
                   <Category name="CASHMAN" value="Cash Management" />
                   <Category name="IM" value="Inventory Management" />
                   <Category name="POS" value="Point of Sale" />
                   <Category name="PRODUCT" value="Product" />
           </Categories>
    </Report>

If the XML file would have been in a format like this, i would have been able to read it easily.

    <Report>
           <Categories>
                   <name>CASHMAN</name>
                   <value>Cash Management</value>
           </Categories>
           <Categories>
                   <name>IM</name>
                   <value>Inventory Management</value>
           </Categories>
           <Categories>
                   <name>POS</name>
                   <value>Point of Sale</value>
           </Categories>
           <Categories>
                   <name>PRODUCT</name>
                   <value>Product</value>
           <Categories>
    <Report>

But since the xml file generated is not in my control, i m stuck up this since couple of hours now.

i need to read the NAME-VALUE pairs from this xml file. how do i go about with this?

please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:18:36+00:00Added an answer on May 17, 2026 at 3:18 pm

    You can do it with MSXML, which offers similar functionality as some of the .NET XML APIs. I don’t have a copy of VB6 right now, but it’s pretty easy. First, add a reference to MSXML from you VB6 project. You would then do something like the following:

    • Create an instance of MSXML2.DOMDocument
    • Call the Load method to parse the XML file
    • Call the selectNodes("/Report/Categories/Category"). This will return an IXMLDOMNodeList object.
    • You can then loop through the node list retrieving each IXMLDOMNode via item or nextNode.
    • You can then get the name and value using the attributes property of the XMLDOMNode or using selectSingleNode("@name").Text and selectSingleNode("@value").Text

    MSXML is fairly flexible, so there is even shorter syntax that you can use, but the above should work out for you. If you have not already figured it out, I will post the code when I get to a machine with VB6 installed.

    UDPATE:

    Here is a working example using the XML sample you provided.

    Sub ParseXmlDocument()
       Dim doc As New MSXML2.DOMDocument
       Dim success As Boolean
    
       success = doc.Load(App.Path & "\test.xml")
       If success = False Then
          MsgBox doc.parseError.reason
       Else
          Dim nodeList As MSXML2.IXMLDOMNodeList
    
          Set nodeList = doc.selectNodes("/Report/Categories/Category")
    
          If Not nodeList Is Nothing Then
             Dim node As MSXML2.IXMLDOMNode
             Dim name As String
             Dim value As String
    
             For Each node In nodeList
                ' Could also do node.attributes.getNamedItem("name").text
                name = node.selectSingleNode("@name").Text
                value = node.selectSingleNode("@value").Text
             Next node
          End If
       End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this might be a no-brainer, but please read on. I also know
I know, I would have thought the answer was obviously no as well, but
I know there is a registry key indicating the install directory, but I don't
I know I must be missing something, but in a while statement how does
I've got a fairly big XML file that I need to parse into a
The problem When opening very large XML files locally, on your machine, it's almost
I am creating a webservice which is going to parse huge xml files from
I read many files from my system. I want to read them faster, maybe
I know its probably possible, but is it practical and doable to try and
I know its probably possible, but is it practical and doable to try and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.