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

  • Home
  • SEARCH
  • 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 9105967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:13:37+00:00 2026-06-17T02:13:37+00:00

I come from a vb6 background. New to .net and new to xml. I

  • 0

I come from a vb6 background. New to .net and new to xml. I am trying to retrieve nodes from an xml file. I have found several methods used (xmltextreader/serialization, xmldocument, xpath) I’m using xpath simply because I got some results with it first 🙂 My problem I am sure is namespace related but all examples I’ve found are much simpler than the xml I have. Here is part of the xml I need to access and a snippet of my code.

<?xml version="1.0" encoding="utf-8"?>
<MTConnectStreams xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mtconnect.org:MTConnectStreams:1.2 http://mtconnect.org/schemas/MTConnectStreams_1.2.xsd" xmlns="urn:mtconnect.org:MTConnectStreams:1.2">
  <Header creationTime="2012-11-29T12:30:19Z" instanceId="2" nextSequence="1918272" sender="Tarus MTConnect Instance" bufferSize="5000" firstSequence="1913272" lastSequence="1918271" version="1.2" />
  <Streams>
    <DeviceStream name="Vertical Bridge" uuid="TPIVB1">
      <ComponentStream component="Device" name="Vert" componentId="TPIVert">
        <Events>
          <Availability dataItemId="avail" timestamp="2012-11-27T23:19:40Z" sequence="44">AVAILABLE</Availability>
        </Events>
      </ComponentStream>
      <ComponentStream component="Linear" name="X" componentId="X">
        <Samples>
          <AxisFeedrate dataItemId="xs1" timestamp="2012-11-29T12:29:54Z" sequence="1717806" name="x_feed_cmd" subType="COMMANDED" units="MILLIMETER/SECOND">0</AxisFeedrate>

Trying to retrieve AxisFeedrate I have this:

Dim xDoc As XPathDocument = New XPathDocument(sUrl)
Dim xNav As XPathNavigator = xDoc.CreateNavigator
Dim xIt As XPathNodeIterator = xNav.Select("//AxisFeedrate")
Dim i As Integer

For i = 1 To xIt.Count
    xIt.MoveNext()
    msgbox (xIt.Current.Value)

If I change the root node to simply ‘MTConnectStreams’ everything works. Following namespace examples online I made the following changes to my code. But I still get zero results back when restoring the original root node.

Dim nsMgr = New XmlNamespaceManager(xNav.NameTable)
nsMgr.AddNamespace("ns", "http://www.w3.org/2001/XMLSchema-instance")
Dim xIt As XPathNodeIterator = xNav.Select("//ns:AxisFeedrate", nsMgr)

Can someone help me get past this hurdle?

  • 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-06-17T02:13:38+00:00Added an answer on June 17, 2026 at 2:13 am

    Your root node declares that the default namespace is “urn:mtconnect.org:MTConnectStreams:1.2”, so you need to use that:

    Dim nsMgr = New XmlNamespaceManager(xNav.NameTable)
    nsMgr.AddNamespace("mt", "urn:mtconnect.org:MTConnectStreams:1.2")
    Dim xIt As XPathNodeIterator = xNav.Select("//mt:AxisFeedrate", nsMgr)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a .NET developer now and have come from Foxpro /VB6/COM background. Over
I'm porting an application from VB6 to VB.NET and have come across something that
I am VERY new to ASP.NET. I come from a VB6 / ASP (classic)
I am learning C++. I come from a background of: .NET and VB6. I
I come from a Java background and am getting more into .NET, what are
I come from a .NET background and need to do a web project in
I come from a PHP background and have started using node.js. Most things I
I come from java/cpp environment where singletons do have their advantages over class(static) methods,
I come from an ASP.NET background and find the entire roles based authorization scheme
I come from an ASP.NET background. In ASP.NET, there is built-in support for users

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.