Extract XML FILE Contents using NODE NAME

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenniekuah
    New Member
    • Oct 2006
    • 126

    Extract XML FILE Contents using NODE NAME

    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.

    Code:
    ]<?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 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 Chinese</CompanyName>
    	<OrdDate>03/03/2010</OrdDate>
    	<ReqDate>04/03/2010</ReqDate>
    	<ShipDate>05/03/2010</ShipDate>
    	<TransFee>987.65</TransFee>
    </row>
    		 
    </table>
  • nukefusion
    Recognized Expert New Member
    • Mar 2008
    • 221

    #2
    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

    Good luck, I hope this helps.

    Comment

    • lenniekuah
      New Member
      • Oct 2006
      • 126

      #3
      Originally posted by nukefusion
      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

      Good luck, I hope this helps.
      Hi Nukefuson,
      thank you very much for the information. You are awesome and generous in sharing information.

      Have a Good Day,
      Cheers,
      Lennie

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        I would also suggest looking up the tools in the System.Xml.Linq namespace. They are, to me, much easier to use for querying into XML if you are unfamiliar with XPath or the DOM.

        Here's a good place to start.

        Comment

        Working...