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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:18:04+00:00 2026-05-26T16:18:04+00:00

Given the xml below why does the first selectsinglenode call not work but the

  • 0

Given the xml below why does the first selectsinglenode call not work but the second one does? Are the single quotes specifying a string type or something?

Dim dbglvlnode As Xml.XmlNode = doc.SelectSingleNode(String.Format("Config/Scanner[DeviceID = '{0}']/DebugLevel", XMLstuff.DeviceID))
Dim dbglvlnode As Xml.XmlNode = doc.SelectSingleNode(String.Format("Config/Scanner[DeviceID = {0}]/DebugLevel", XMLstuff.DeviceID))
<?xml version="1.0" standalone="yes"?>
<Config>
 <Scanner>
  <!--Test Scanner-->
  <DeviceID>00199</DeviceID>
  <DeviceNumber>0099</DeviceNumber>
  <DebugLevel>10</DebugLevel>
 </Scanner>
</Config>
  • 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-26T16:18:05+00:00Added an answer on May 26, 2026 at 4:18 pm

    Your first approach would lead to an XPath expression sort of like this:

    Config/Scanner[DeviceID = '00199']/DebugLevel
    

    This would return the DebugLevel element of the first Scanner in Config for which the DeviceID element has textual value 00199

    Your second approach would lead to an XPath expression like this:

    Config/Scanner[DeviceID = 00199]/DebugLevel
    

    This would return the DebugLevel element of the first Scanner in Config for which the DeviceID element has the numeric value 00199.

    The difference is that the first approach would only match 00199 exactly, so if XMLstuff.DeviceID is an integer or a string with value 199, it won’t work. The second approach will work as long as the element’s content evaluates to an integer with the right value. So yes, the single quotes identify that right-hand portion of the comparison as text.

    XPath is rather lenient in converting data types and doing comparisons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have AJAX call to one XML file and the source code is given
Given the XML below, I need to group by InputItem and sum the costs
I have a xml given below: <root title=الصفحة الرئيسة> <item title=الصفحة الرئيسة itemuri=tcm:8-29-4 ShowInNav=True
I am looking to transform a input xml given below <profile name=default> <color id=forecolor
I have a given XML document (structure can not be changed) and want to
Here's a question about repeated nodes and missing values. Given the xml below is
Given the contrived XML schema, sample XML input, and sample XSLT below used to
In a project I am working on I have been given XML to work
Given the XML below I need to recurively select the employee who's positions.position.manager_position matches
Say I have this given XML file: <root> <node>x</node> <node>y</node> <node>a</node> </root> And I

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.