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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:07:43+00:00 2026-05-25T16:07:43+00:00

i am trying to parse an xml element ( DItem >> Title ) below

  • 0

i am trying to parse an xml element (DItem >> Title)
below is my code but somehow i am not getting hold of it…. any help?

XDocument xdoc1 = XDocument.Load(url);
XNamespace ns = "http://sitename/items.xsd";
string topic = xdoc1.Descendants(ns + "DItem")
             .Select(x => (string)x.Attribute("Title"))
             .FirstOrDefault();

<?xml version='1.0'?>
<root xmlns="http://www.w3.org/2005/Atom">
  <title type="text">title</title> 
  <entry>
    <id>da7d3189-fd89-4d3f-901c-30eab7a3baa5</id>
    <title type="text">Swimming Pools</title>
    <summary type="text"></summary>
    <updated>2011-08-19T19:02:21Z</updated>
    <link rel="alternate" href="link" />
    <link href="link" />
    <content type="application/xml">
      <Items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.namespace.xsd">
        <CatalogSource Acronym="ABC" OrganizationName="organization name" />
        <Item Id="28466" CatalogUrl="url">
          <DItem xmlns:content="http://namespace.xsd" TargetUrl="http://index.html" Title="my title">
            <content:Source Acronym="ABC" OrganizationName="ABC" /> 
          </DItem>
        </Item>
      </Items>
    </content>
  </entry>
</root>
  • 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-25T16:07:43+00:00Added an answer on May 25, 2026 at 4:07 pm

    Using the namespace “http://www.namespace.xsd” should (and does) work:

    XNamespace ns = "http://www.namespace.xsd";
    string topic = xdoc1.Descendants(ns + "DItem")
                        .Select(x => (string)x.Attribute("Title"))
                        .FirstOrDefault();
    

    Since DItem is not qualified with a namespace itself, it will use the default namespace specified asxmlns="http://www.namespace.xsd" on its parent element.

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

Sidebar

Related Questions

I am trying to parse XML with Python but not getting very far. I
i am trying to parse an xml element using XMLDocument ( DItem >> Title
I am trying to parse some currency data in xml format. Below code does
Im trying to parse the XML returned by the Google Geo code API ,but
i am trying to parse following xml but no sucess any one guide me
i'm trying to parse this xml file but i can't find a way to
I am trying to parse an XML file using NSXMLParser, but the method [parser
I'm trying to parse objects to XML in Delphi, so I read about calling
I'm trying to use XPath to parse an XML document. One of my NSXMLElement's
I'm trying to parse an Atom feed programmatically. I have the atom XML downloaded

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.