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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:41:24+00:00 2026-06-04T11:41:24+00:00

How can I read the tag using linq2xml? var q = (from c in

  • 0

How can I read the tag using linq2xml?

var q = (from c in xDocument.Descendants("colecciones").Descendants("BoTblPacientes")
                    select c).ToList(); 

but dont work.

<?xml version="1.0" ?>
<DalClassObject xmlns="http://www.asd.com">
  <objeto class="BoTblPacientes"></objeto>
  <validador>true</validador>
  <mensaje>El paciente  existe en el sistema .</mensaje>
  <colecciones>
    <BoTblPacientes>
      <tblpacientesmotivoconsulta>5</tblpacientesmotivoconsulta>
      <tblpacientestlfcasa>5</tblpacientestlfcasa>
      <tblpacientescelular>5</tblpacientescelular>
      <tblpacientesoficina>5</tblpacientesoficina>
      <tblpacientescorreo>5</tblpacientescorreo>
      <tblpacientesdireccion>5</tblpacientesdireccion>
      <tblpacientesapellidos>5</tblpacientesapellidos>
      <tblpacientesdocumento>5</tblpacientesdocumento>
      <tblpacientessexoid>0</tblpacientessexoid>
      <tblpacientesfechanacimiento class="sql-date">2012-05-13</tblpacientesfechanacimiento>
      <tblpacientesnombres>5</tblpacientesnombres>
      <tblpacientesid>2</tblpacientesid>
      <tblpacientesestadocivil>0</tblpacientesestadocivil>
      <tblpacientesfecharegistro class="sql-date">2012-05-13</tblpacientesfecharegistro>
      <tblpacienteidmaster>0</tblpacienteidmaster>
    </BoTblPacientes>
    <BoTblPacientes>
      <tblpacientesmotivoconsulta>23232</tblpacientesmotivoconsulta>
      <tblpacientestlfcasa>2332</tblpacientestlfcasa>
      <tblpacientescelular>23</tblpacientescelular>
      <tblpacientesoficina>23</tblpacientesoficina>
      <tblpacientescorreo>23</tblpacientescorreo>
      <tblpacientesdireccion>2323</tblpacientesdireccion>
      <tblpacientesapellidos>ewr</tblpacientesapellidos>
      <tblpacientesdocumento>5</tblpacientesdocumento>
      <tblpacientessexoid>0</tblpacientessexoid>
      <tblpacientesfechanacimiento class="sql-date">2012-03-29</tblpacientesfechanacimiento>
      <tblpacientesnombres>wer</tblpacientesnombres>
      <tblpacientesid>3</tblpacientesid>
      <tblpacientesestadocivil>0</tblpacientesestadocivil>
      <tblpacientesfecharegistro class="sql-date">2012-05-13</tblpacientesfecharegistro>
      <tblpacienteidmaster>0</tblpacienteidmaster>
    </BoTblPacientes>
  </colecciones>
</DalClassObject>
  • 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-04T11:41:26+00:00Added an answer on June 4, 2026 at 11:41 am

    Your initial “but doesn’t work” statement isn’t very helpful as you are not really clarifying what isn’t working, but from the error i see, I am going to guess that your query isn’t selecting anything.

    Your xml root element declares a namespace but you are not specifying that namespace in the query, as a result nothing matches the string you are providing in the Descendants() method.

    You need to look up by the local name instead

    var q = (from c in xDocument.Descendants()
             where c.Name.LocalName == "BoTblPacientes"
             select c).ToList()
    

    Just for completeness sake, as mentioned by OP in the comments, another option is to add the namespace to the query instead:

    XNamespace ns = "http://www.asd.com";
    var q = (from c in xDocument.Descendants(ns + "colecciones") 
             select c).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can read unmanaged memory in C# using UnmanagedMemoryStream, but how can I do
I am trying to read tags from XML using LibXML. I can print all
I can directly read the XML Feed using jQuery, but when I display the
<name>Tag 6</name> using XmlTextReader how can i read the value of the text between
I know I can read off /proc/[id]/maps but I'm not sure if the first
The program can read all the data from the pipe. However, the program just
I want to read a card from Samsung Nexus phone but the android nfc
I have to read, change and rewrite an HTML OBJECT tag using node.outerHTML. on
I'm trying to read a file's id3v2 tag information using the TagLib# library with
I'm using ReadXML from DataSet to read a XML document without any schema. There

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.