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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:56:30+00:00 2026-06-11T13:56:30+00:00

I am trying to populate an array with the inner text or value of

  • 0

I am trying to populate an array with the inner text or value of a XML tag. I can loop though the nodes of the tag i am just having an issue pulling out the stored value.

I am looping though the child nodes of the Properties Tag, XML at bottom of Question.

    XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C://Users//Shaun//Documents//Visual Studio 2010//Projects//LightStoneTestService//LightStoneTestService//FileTest//Testdo.xml");

//XmlNodeList dataNodes = xmlDoc.SelectNodes("//Properties");
XmlNodeList oXMlNodeList = xmlDoc.GetElementsByTagName("Properties");

for (int Count = 0; Count < 27; Count++)
{
    foreach (XmlNode node in oXMlNodeList)
    {                    
        int Max = node.ChildNodes.Count;                   
        foreach (XmlNode childNode in node.ChildNodes) //For each child node in FieldData
        {                          
              if (ArrayProperties[Count].LightStoneTag == childNode.Name)
            {
              ArrayProperties[Count].Value = node.SelectSingleNode(ArrayProperties[Count].LightStoneTag).InnerText;    
            }                                                     
        }
    }
}

***** My Xml file looks as follows:

<NewDataSet>
  <RequestData xmlns="RequestData">
    <Req_ID>3204eba5-07f4-4e83-8b46-d89fa1d70bf6</Req_ID>
  </RequestData>
  <Properties xmlns="Properties">
    <sr_id>19374324</sr_id>
    <prop_id>9841107</prop_id>
    <DEED_ID>21</DEED_ID>
    <PROPTYPE_ID>2</PROPTYPE_ID>
    <SS_ID>2315</SS_ID>
    <NAD_ID>3048001</NAD_ID>
    <property_type>SS</property_type>
    <PROVINCE>GA</PROVINCE>
    <MUNICNAME>CITY OF JOHANNESBURG</MUNICNAME>
    <DEEDTOWN>ALLENS NEK</DEEDTOWN>
    <SECTIONAL_TITLE>SS GREENHILLS</SECTIONAL_TITLE>
    <UNIT>15</UNIT>
    <TownShip>ALLENS NEK</TownShip>
    <Purchase_Price>236500</Purchase_Price>
    <Purchase_Date>20031020</Purchase_Date>
    <Bond_Number>SB37369/2006</Bond_Number>
    <Township_alt>ALLEN'S NEK EXT 32</Township_alt>
    <RE>false</RE>
  </Properties>
</NewDataSet>
  • 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-11T13:56:31+00:00Added an answer on June 11, 2026 at 1:56 pm

    It’s the namespace issue. Add this portion of code before the for loop:

            NameTable nt = new NameTable();
            nt.Add("Properties");
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
            nsmgr.AddNamespace("ns1", "Properties");
    

    Change the line where you retrieve InnerText to:

            ArrayProperties[Count].Value = node
                .SelectSingleNode(
                    String.Concat("//ns1:", ArrayProperties[Count].LightStoneTag), 
                    nsmgr)
                .InnerText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to populate an array with the text value of a json
I am dynamically trying to populate a multidimensional array and having some trouble. I
I'm trying to populate an array with the following xml: <?xml version=\1.0\ encoding=\UTF-8\?> <data>
I'm trying to populate a specific value of an array, defined by a key
I am trying to populate an array with a path to a file. <?php
I am trying to populate a javascript array that will be used to pass
Hi i am trying to auto populate a 2d array based on user input.
I'm trying to populate a multidimensional array (array with array elements) via Javascript or
I am trying to populate a dropdown select with an array using jQuery. Here
I am trying to populate a UITableView with data from json result. I can

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.