VS2008 C# Extract XML file contents using node name

0 votes

I have been asked to extract data from XML File using NODE NAME. I am new to XML and I do not know how to identify or understand what is NODE NAME.

 

This is the XML File content, Please show me what is NODE NAME and Data. Thank You.
<?xml version="1.0" encoding="utf-8"?>
<!--File Exported on 21/05/2010 ;12:26:48 p.m.-->

<table>

 <row>

                <CustomerID>CHOPS</CustomerID>

                <CompanyName>Chop-suey Chinese</CompanyName>

             <OrdDate>01/03/2010</OrdDate>

    <ReqDate>02/03/2010</ReqDate>

    <ShipDate>03/03/2010</ShipDate>

    <TransFee>7555.55</TransFee>

</row>

<row>

    <CustomerID>CHOPS</CustomerID>

    <CompanyName>Chop-suey&nbsp;Chinese</CompanyName>

    <OrdDate>03/03/2010</OrdDate>

    <ReqDate>04/03/2010</ReqDate>

    <ShipDate>05/03/2010</ShipDate>

    <TransFee>123.45</TransFee>

</row>

<row>

    <CustomerID>CHOPS</CustomerID>

    <CompanyName>Chop-suey&nbsp;Chinese</CompanyName>

    <OrdDate>03/03/2010</OrdDate>

    <ReqDate>04/03/2010</ReqDate>

    <ShipDate>05/03/2010</ShipDate>

    <TransFee>987.65</TransFee>

</row>



</table>

 

asked Jan 28, 2013 by inquirer (710 points)
    

1 Answer

0 votes
 
Best answer

Hi, The XML file is comprised of nodes, in your case a table node, a row node, CustomerID node, etc, etc.

These are quite simply the names of the nodes.

The data is the bit that comes between the opening and closing tags. For example, your first CustomerID tag has:

An opening tag: <CustomerID>

Data: CHOPS
a closing tag: </CustomerID>

To extract this data you could use something called XPath.

A great place to start learning about these technologies is W3Schools.

XML

XPath

answered Jan 28, 2013 by analyst (3,200 points)
selected Jan 28, 2013 by inquirer
...