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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:06:14+00:00 2026-06-09T21:06:14+00:00

Dim root As XElement = XElement.Load(xmlFile) Dim stuff = From item In root.Elements(abc) Select

  • 0
    Dim root As XElement = XElement.Load(xmlFile)
    Dim stuff =
        From item In root.Elements("abc") Select item

    Debug.Print(stuff.Count)

and the contents of the XML are:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook
 xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
  <abc xmlns="foo">1</abc>
  <abc xmlns="foo">2</abc>
  <abc xmlns="foo">3</abc>
</Workbook>

If I remove xmlns=”urn:schemas-microsoft-com:office:spreadsheet” the beginning of the the Workbook tag, I get the correct result of 3

ETA What do I do if I have another namespace embedded, in this case “foo”

  • 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-09T21:06:16+00:00Added an answer on June 9, 2026 at 9:06 pm

    You’re trying to find an element with a name abc without any namespace. The xmlns=... part of the parent element sets the default namespace for descendant elements.

    You need:

    Dim ns As XNamespace = "urn:schemas-microsoft-com:office:spreadsheet"
    ...
    Dim stuff = root.Elements(ns + "abc")
    

    Note that there’s no point in using a query expression here – if you’re just doing From x in y Select x you can just use y instead…

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

Sidebar

Related Questions

sRecieved = <XmlClient>2.0</XmlClient><XmlVersion>3.0</XmlVersion> Dim xml As New XmlDocument(); xml.LoadXml(sRecieved); There are multiple root elements
Dim MyQuery = From c In xdoc.Descendants() _ Where c.Attribute(OriginY) IsNot Nothing _ Order
Dim xml = <Root> <Parent id=1> <Child>Thomas</Child> </Parent> <Parent id=2> <Child>Tim</Child> <Child>Jamie</Child> </Parent> </Root>
For recent checkins it is pretty straightforward: Dim UserSelfCheckins As FourSquare.UserSelfCheckins.Root Dim ser As
Dim db as MySQLCommunityServer db =New MySQLCommunityServer db.host=127.0.0.1 db.port=3306 db.databaseName=requesterdb db.userName=root db.Password= Dim divisionID
i have this code Dim htmldoc As HtmlDocument = New HtmlDocument() htmldoc.LoadHtml(strPageContent) Dim root
I'm trying to load an image that is in the root dir of my
Dim str as String str = 30 40 50 60 I want to count
Dim _tableBackLogs As System.Data.DataTable Do While i - 2 > 0 _tableBackLogs = Global.DataAccess.GetDataTable(SELECT
Dim dtmStart As Date, dtmEnd As Date, dblDuration As Double dtmStart = 1900/01/01 08:10:00

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.