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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:17:15+00:00 2026-06-11T15:17:15+00:00

Hi i am having problems reading out the nodes of a XML file? I

  • 0

Hi i am having problems reading out the nodes of a XML file? I cant find the child nodes in the XML. This code finds no nodes. if i change:

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

To

XmlNodeList dataNodes = xmlDoc.SelectNodes("//NewDataSet");

Then i get two nodes returned i get properties and requestdata, but i want the properties child nodes.

Could some one please tel me why i cant see the child nodes of properties and please help me to find them.


Here is my C# code.

if (File.Exists("C://Users//Shaun//Documents//Visual Studio 2010//Projects//LightStoneTestService//LightStoneTestService//FileTest//Testdo.xml")) //In bin and Debug
    {
    XmlDocument xmlDoc = new XmlDocument();

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

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

    foreach (XmlNode node in dataNodes)
      {
        int Count = 0;
        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;
          }
           Count = Count + 1;
         }
      }

Here is my XML file i am trying to read all the nodes in properties:

  <NewDataSet>
  <RequestData xmlns="RequestData">
    <Req_ID>fe0bc7ab-1dc9-4526-bd29-b522ff13e162</Req_ID>
  </RequestData>
  <Properties xmlns="Properties">
    <sr_id>19374149</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>
    <ERF>627</ERF>
    <PORTION>0</PORTION>
    <BUYER_NAME>FOURIE MARION ROBB</BUYER_NAME>
    <FIRSTNAME>MARION</FIRSTNAME>
    <MIDDLENAME>ROBB</MIDDLENAME>
    <SURNAME>FOURIE</SURNAME>
    <PERSON_TYPE_ID>PP</PERSON_TYPE_ID>
    <BUYER_IDCK>7402110182087</BUYER_IDCK>
    <MUNIC_ID>74</MUNIC_ID>
    <PROV_ID>8</PROV_ID>
    <STREET_NUMBER>973</STREET_NUMBER>
    <STREET_NAME>MAIN</STREET_NAME>
    <STREET_TYPE>ROAD          </STREET_TYPE>
    <PO_CODE>1709</PO_CODE>
    <User_ID>2443598d-948b-4322-bd91-d39f57bec1b6</User_ID>
    <SS_Number>29</SS_Number>
    <SS_UnitNoFrom>1</SS_UnitNoFrom>
    <SS_UnitTo>26</SS_UnitTo>
    <Size>65</Size>
    <X>27.919578</X>
    <Y>-26.125565</Y>
    <SUBURB>ALLENS NEK</SUBURB>
    <Registrar>J</Registrar>
    <Title_Deed_No>ST28776/2004</Title_Deed_No>
    <Reg_Date>20040519</Reg_Date>
    <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>

New Part

I am having troubles pulling out the inner text, my code is in the foreach above, my app keeps breaking on the line:

ArrayProperties[Count].Value = node.SelectSingleNode(ArrayProperties[Count].LightStoneTag).InnerText;

Could someone please show me how to pull out a value from an XML File.

  • 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-11T15:17:17+00:00Added an answer on June 11, 2026 at 3:17 pm

    Here is the sample code

    code for loading the file

    private const string XML_FILE_NAME = "sample.xml";
    public static XmlDocument LoadSampleXML()
        {
            XmlDocument oXmlDocument = null;
            try
            {
    
                oXmlDocument= new XmlDocument();
                oXmlDocument.Load(XML_FILE_NAME);
                return oXmlDocument;
            }
            catch (Exception ex)
            {
                return oXmlDocument;
            }
        }
    

    Following code you can use to get child nodes

     private const string XML_NODE_PROP = "Properties";
     XmlDocument oXmlDocument = null;
     oXmlDocument = LoadSampleXML();
     XmlNodeList oXMlNodeList = oXmlDocument.GetElementsByTagName(XML_NODE_PROP);
    
     foreach (XmlNode oXmlNodeItem in oXMlNodeList)
                {
                   // DoSomething
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems reading this one JPEG file using ImageIO.read(File file) - it throws
I'm having a problem with reading and processing a xml file, which I cannot
I am having problems reading out a mutable array out of a mutable dictionary.
I'm having problems reading in a text file with java. The text file has
I am reading XOR linked list (from Wikipedia).But I am having some problems in
I've been reading about problems people are having with browsers caching an old version
its me again with this project. im having a problem reading the text on
I'm having a problem where instead of reading a text file from the location
Having an interesting issue. I'm reading from an excel file on a server via
This is what I'm trying to do: I'm reading a file in from the

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.