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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:41:27+00:00 2026-05-25T14:41:27+00:00

i am trying to grab the TopicName how should i go after it and

  • 0

i am trying to grab the TopicName how should i go after it and try different combination but somehow i am unable to get TopicName below is my source codee…

XmlDocument xdoc = new XmlDocument();//xml doc used for xml parsing

    xdoc.Load(
        "http://latestpackagingnews.blogspot.com/feeds/posts/default"
        );//loading XML in xml doc

    XmlNodeList xNodelst = xdoc.DocumentElement.SelectNodes("content");//reading node so that we can traverse thorugh the XML

    foreach (XmlNode xNode in xNodelst)//traversing XML 
    {
        //litFeed.Text += "read";
    }

sample xml file

<content type="application/xml">
 <CatalogItems xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="sitename.xsd">
        <CatalogSource Acronym="ABC" OrganizationName="ABC Corporation" />
        <CatalogItem Id="3212" CatalogUrl="urlname">
          <ContentItem xmlns:content="sitename.xsd" TargetUrl="url">
            <content:SelectionSpec ClassList="" ElementList="" />
            <content:Language Value="eng" Scheme="ISO 639-2" />
            <content:Source Acronym="ABC" OrganizationName="ABC Corporation" />
            <content:Topics Scheme="ABC">
              <content:Topic TopicName="Marketing" />
              <content:Topic TopiccName="Coverage" />
            </content:Topics>
          </ContentItem>
        </CatalogItem>
      </CatalogItems>
    </content>
  • 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-25T14:41:28+00:00Added an answer on May 25, 2026 at 2:41 pm

    The Topic nodes in your XML are using the content namespace – you need to declare and use the XML namespace in your code, then you can use SelectNodes() to grab the nodes of interest – this worked for me:

    XmlNamespaceManager nsmgr = new XmlNamespaceManager(xdoc.NameTable);
    nsmgr.AddNamespace("content", "sitename.xsd");
    
    var topicNodes = xdoc.SelectNodes("//content:Topic", nsmgr);
    
    foreach (XmlNode node in topicNodes)
    {
        string topic = node.Attributes["TopicName"].Value;
    }
    

    Just as a comparison see how easy this would be with Linq to XML:

    XDocument xdoc = XDocument.Load("test.xml");
    XNamespace ns = "sitename.xsd";
    string topic = xdoc.Descendants(ns + "Topic")
                       .Select(x => (string)x.Attribute("TopicName"))
                       .FirstOrDefault();
    

    To get all topics you can replace the last statement with:

    var topics = xdoc.Descendants(ns + "Topic")
                     .Select(x => (string)x.Attribute("TopicName"))
                     .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to grab a user job notes but am not sure what
I'm trying to grab the source of an image with jquery. My HTML looks
I'm trying to grab all the links and their content from a text, but
I'm trying to grab out some information from Active Directory using Powershell, but I
I'm trying to grab data from a JSON on an external site but the
Im trying to grab the entire DOM from a page using document.getElementsByTagName('html')[0].innerHTML but I
I'm trying to grab an image from an HTTP response in C#, but instead
I'm trying to grab my files from isolated storage but unfortunatly it is pulling
I'm trying to grab a songkick json feed using the below: var jsonpArgs =
I am trying to grab source code of pages using proxies. It works up

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.