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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:53:39+00:00 2026-06-09T01:53:39+00:00

I have a complex structure xml from which I need to read some element

  • 0

I have a complex structure xml from which I need to read some element value.
My xml is somewhat like this:

<plist version="1.0">
<dict>
<key>XYZ</key>
<dict>
    <key>KEYVALUE1</key>
    <dict>
        <key>A</key>
        <date>AVALUE1</date>
        <key>B</key>
        <string>BVALUE1</string>            
    </dict>
    <key>KEYVALUE2</key>
    <dict>
        <key>A</key>
        <date>AVALUE2</date>
        <key>B</key>
        <string>BVALUE2</string>    
        <key>C</key>
        <string>CVALUE2</string>        
    </dict>
</dict>
</dict>
</plist>

What I need is: search for a dict with KEYVALUE2, and wherever I get it, pick BVALUE2 out of it (you can replace 2 with whatever number, I have just included 2 nodes for brevity).

I am newbie for xml programming and all my attempts to try out MS documentation have only confused me more. Sometimes I find a xmlreader example which didn’t quite serve my purpose, and other time I got LINQ example which confused me because of its structure. Please help!

  • 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-09T01:53:41+00:00Added an answer on June 9, 2026 at 1:53 am

    There are many technologies that allow you to access XML.
    Since linq wasn’t your taste, you could do the following:
    Use XmlDocument with XPath, such as in this example:

    XmlDocument xmldoc = new XmlDocument();
    xmlDoc.LoadXml(xml);
    string bvalue = xmlDoc.SelectSingleNode("//dict[key='" + key + "']/dict/string).InnerText;
    

    But I would advice changing the structure of your XML first..
    XML is a great relational data structure. The way your keys are arranged is not relational.. In my opinion, there should be one key on each level like this:

    <dict>     
        <KeyValuePair>
            <key type="date">A</key>        
            <value>AVALUE2</value>
        </KeyValuePair>
        <KeyValuePair>
            <key type="string">B</key>        
            <value>BVALUE2</value>            
        </KeyValuePair>        
    </dict>  
    

    That way you could write:

    string value = xmlDoc.SelectSingleNode("//KeyValuePair[key = 'B']/value").InnerText;
    

    Good Luck!

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

Sidebar

Related Questions

I have a dataset that I read in from a complex xml structure.... here
i have complex XML structure i want get all descendents uisng some xml paren.child.@attribute
I have a complex Clojure data structure that I would like to serialize -
i have generated a cs-classes with the xsd-tool from some xml scheme. The scheme
I have an XML structure like the following <root> <person> <name>James</name> <description xsi:type=me:age>12</description> <description
Consider that I have a complex class structure where many elements inherit from other
In a complex project, I have many XML files like data files, config files
In my application I have a complex database structure. In order to generate the
I have to transfer objects between activities. Objects are with complex structure. I'm not
I have a complex input form within a PHP based web application. To structure

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.