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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:22:58+00:00 2026-06-02T06:22:58+00:00

i am using a xpathdocument to get some values by their xpath expression, which

  • 0

i am using a xpathdocument to get some values by their xpath expression, which works until it comes to namespaces.

The xml:

?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="vsstyle_xml.cgi" type="text/css"?>
<vs120data version="0x1210019" build="21.0.117" label="D21.00.117SAEN060223"   
xmlns:html="http://www.w3.org/1999/xhtml" SIMATIC_VS_Escaped="1">
VS120 Data from 192.168.0.43 (MAC: 08:00:06:71:8C:EE) Time Sync Info: Source was PC:   
PC=192.168.0.1 - TZ is GMT/UTC +1h. Last Synchronization: Feb 27, 2006, 16:41:08.   
Current Timestamp: Feb 27, 2006, 16:44:14.  HWVers: 0x34<html:title>VS120   
Data from 192.168.0.43 (MAC: 08:00:06:71:8C:EE)  at Feb 27,    2006, 16:44:14.   
</html:title>   
<Standard-Parameters>      
Standard-Parameters   
  <Startup-Request> 

...

<Images>
Images
  <Scene>
  Scene<html:img alt="html:img" src="data:image/png;base64...."

‘

The c# code:

XmlNamespaceManager mgr = new XmlNamespaceManager(nav.NameTable);      
mgr.AddNamespace("html", "http://www.w3.org/1999/xhtml");   
XPathNavigator hc = nav.SelectSingleNode("//html:img", mgr);  

i only get empty node here.

When i use the sandart xpath parsing by the xpath expression

parseXPath("/vs120data/Model/Images/Scene/html:img/@src");

i get the namespace problem, that some prefix stuff is missing.

  • 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-02T06:23:00+00:00Added an answer on June 2, 2026 at 6:23 am

    Obviously, if you need to get to the src attribute, change:

    nav.SelectSingleNode("//html:img", mgr)
    

    to:

    nav.SelectSingleNode("//html:img/@src", mgr)
    

    As you need not the attribute itself, but its string value, supposing the type of nav is IXpathNavigable, use:

    nav.Evaluate("string(//html:img/@src)", mgr)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lately I've been using XPathDocument and XNavigator to parse an XML file for a
I have an XML file like below , using xpath and xnavigator how can
I'm navigating XML document with XPathNodeIterator, and I want to change some nodes' values.
Using MVC2 I have an AJAX form which is posting to a bound model.
Is it possible to select a node using an XPathNodeIterator and get the Outer
using file_get_contents , I open an Internet URL and get the contents of this
I have a simple xml document and I want to get the count of
I am using C# code in aspx pages to covert the infopath xml pages
I am returning XML data from the Yahoo GeoPlanet web service using HttpWebRequest .
I'm implementing the ReadXml() method of IXmlSerializable and I figure using XPath is probably

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.