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 7588101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:50:25+00:00 2026-05-30T19:50:25+00:00

this is probably a silly question and the solution is something i overlooked, but

  • 0

this is probably a silly question and the solution is something i overlooked, but suppose the following xml file (below)

I am iteratiing through the info/test items and then want to iterate again through the test_properties, but I don’t know how.

the properties are never a fixed count, so it could have 1 property or 200
i need the type='” attribute and the value of the property
I use this so far:

    Dim Xml_Document As XPathDocument = New XPathDocument("e:\test.xml")
            Dim Navigator As XPathNavigator = Xml_Document.CreateNavigator()
            Dim ns As XmlNamespaceManager = New XmlNamespaceManager(Navigator.NameTable)
            Dim NodeIterator As XPathNodeIterator = Navigator.Select("/info/test")


            Try
                While NodeIterator.MoveNext()
                    Dim sanction_id As Integer = CInt(NodeIterator.Current.GetAttribute("id", ns.DefaultNamespace))
                    Dim clone As XPathNavigator = NodeIterator.Current.Clone()

                    clone.MoveToFirstChild()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
                    MsgBox(clone.Value)
                    clone.MoveToNext()
''''''''
' here i want to iterate through test_properties for each property 
'''''''

                End While
            Catch ex As Exception
                Console.WriteLine(ex.StackTrace)
            End Try

and the xml

<?xml version="1.0" encoding="UTF-8"?>
<info>
    <test id="1">
        <test_source>ONLINE</test_source>
        <test_type><![CDATA[P]]></test_type>
        <test_date><![CDATA[2012-02-23]]></test_date>
        <test_programme><![CDATA[UK]]></test_programme>
        <test_remark><![CDATA[Nice guy]]></test_remark>
        <test_key>123456789</test_key>
        <test_properties>
            <property type="FIRSTNAME"><![CDATA[Robert]]></property>
            <property type="MIDDLENAME"><![CDATA[]]></property>
            <property type="LASTNAME"><![CDATA[Johnson]]></property>
            <property type="GENDER"><![CDATA[M]]></property>
            <property type="BIRTHDATE"><![CDATA[1900-01-01]]></property>
        </test_properties>
    </test>
    <test id="2">
        <test_source>ONLINE</test_source>
        <test_type><![CDATA[P]]></test_type>
        <test_date><![CDATA[2012-02-23]]></test_date>
        <test_programme><![CDATA[UK]]></test_programme>
        <test_remark><![CDATA[Nice girl]]></test_remark>
        <test_key>123456789</test_key>
        <test_properties>
            <property type="FIRSTNAME"><![CDATA[Roberta]]></property>
            <property type="MIDDLENAME"><![CDATA[]]></property>
            <property type="LASTNAME"><![CDATA[Johnsons]]></property>
            <property type="GENDER"><![CDATA[M]]></property>
            <property type="BIRTHDATE"><![CDATA[1900-01-01]]></property>
        </test_properties>
    </test>
</info>
  • 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-30T19:50:26+00:00Added an answer on May 30, 2026 at 7:50 pm
    For Each test As XPathNavigator In Xml_Document.CreateNavigator().Select("/info/test")
      For Each prop As XPathNavigator In test.Select("test_properties/property")
        Console.WriteLine("{0}: {1}", prop.GetAttribute("type", null), prop.Value);
      Next
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a silly question, but here it goes.Imagine you have the following
This is probably a silly question, but I'm following a videocast about Rails, right
This is probably a silly question, but curiosity has gotten the better of me.
This is probably something silly I'm missing but I'm definitely lost. I'm using .NET
This is probably a silly question, but I am trying to stuff an anonymous
This is probably a really silly question to experienced C++ developers, but what is
This is probably a really silly question but, given the example code at the
This is quite probably a very silly question but I need to be sure.
This is probably a silly question but I'm having a hard time trying to
This is probably a silly question, but why am I unable to utilize Ajax

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.