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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:42:16+00:00 2026-05-11T14:42:16+00:00

I have part of XmlDocument Example.xml as given below: <rapaine dotoc=palin domap=rattmin> <derif meet=local

  • 0

I have part of XmlDocument Example.xml as given below:

<rapaine dotoc='palin' domap='rattmin'>   <derif meet='local' />   <derif meet='intro' /> . . . </rapaine> 

Here i am creating a Nodelist and fetching the element raplin to get its attributes.

Now i want to make sure that whether the attributes ‘dotoc’ and ‘domap’ are the attributes of rapaine with respective values which are always fixed.Then only i can access the childNodes ‘deriff’ with its attribute ‘meet’. here the value only changes.
i have written a part of code there are no compile errors but on debugging i found that its not going inside the for loop to check its attributes and child nodes.

XmlNodeList listOfSpineRootNodes = opfXmlDoc.GetElementsByTagName('rapine'); for (int x = 0; x < listOfSpineRootNodes.Count; x++)   {     XmlAttributeCollection spineAttributes = listOfSpineRootNodes[x].Attributes;     string id = spineAttributes[0].Value;     if (spineAttributes != null)     {       XmlNode attrToc = spineAttributes.GetNamedItem('dotoc');       XmlNode attrPageMap = spineAttributes.GetNamedItem('domap');       if (attrToc.Value == 'palin' && attrPageMap.Value == 'rattmine')       {         if (listOfSpineRootNodes != null)         {           foreach (XmlNode spineNodeRoot in listOfSpineRootNodes)           {             XmlNodeList listOfSpineItemNodes = spineNodeRoot.ChildNodes;             if (listOfSpineItemNodes != null)             {               foreach (XmlNode spineItemNode in listOfSpineItemNodes)               {                 if (spineItemNode.NodeType == XmlNodeType.Element                   && spineItemNode.Name == 'derif')                 {                   XmlAttributeCollection spineItemAttributes = spineItemNode.Attributes;                    if (spineItemAttributes != null)                   {                     XmlNode attrIdRef = spineItemAttributes.GetNamedItem('meet');                     if (attrIdRef != null)                     {                       spineListOfSmilFiles.Add(attrIdRef.Value);                     }                   }                 }               }             }           }         }       }     } 

Can you please tell me where i am going wrong.. Thanks….

  • 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. 2026-05-11T14:42:17+00:00Added an answer on May 11, 2026 at 2:42 pm

    You can do this with the following code using XPath. Since XPath is a language designed specifically to query XML documents, you should consider learning it. Most newbies like to start learning at W3schools.

    Here is the code:

    XmlNodeList meetList = opfXmlDoc.SelectNodes('/rapaine[(@dotoc = 'palin') and (@domap = 'rattmin')]/derif/@meet') if (meetList.Count > 0) {   foreach (XmlNode meet in meetList)   {     spineListOfSmilFiles.Add(meet.Value);   } } 

    For your reference, the XPath expression:

    /rapaine[(@dotoc = 'palin') and (@domap = 'rattmin')]/derif/@meet 

    can be explained as:

    a) Find all rapaine root level elements that have an attribute dotoc with a value of ‘palin’ and also have an attribute domap with a value ‘rattmin’.

    b) Within those rapaine elements, find all derif children.

    c) Within those derif elements, retrieve all meet attributes.

    Note how much more concise the code becomes.

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

Sidebar

Related Questions

I have part of the code below: while($array = $result->fetch_assoc() ){ $second_query = INSERT
I have a part of code mentioned like below. //Reading from a file and
I have an XML document, part of which has the following in it: <math
I have a XML document.I am signing a part of document using xmlsignature. Before
I have part of my script that goes like this: while read line do
i have part of Asp.NET 1.1 project. I work with remote site, which works
I have part objects and material objects. Each part has at most 1 material
I'm using an update panel to have part of my page update asynchronously. Its
I am writing an app for android and i am trying to have part
I'm stuck on one thing i can't get solved. I have part of code,

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.