3 Replies Latest reply on Apr 23, 2014 7:50 AM by odie_63

    node vs. element

    SunshineFR

      Hi. I'm a ERP developer who is trying to learn XML.

       

      Is the <Page_Header_S1> in the sample code (from report converted to XML) below is a node? I know that the fields inside <Page_Header_S1> are elements.

       

      What is the difference between a node and an element?

       

       

      <PageHeaders>

      - <Page_Header_S1>

        <PageHeaderNumber>1</PageHeaderNumber>

        <R914921_ID9>R914921</R914921_ID9>

        <SystemTime_ID4>11:44:52</SystemTime_ID4>

        <SystemDate_ID2>2013-12-02</SystemDate_ID2>

        <Company_Name_ID10>999 Fanta Inc</Company_Name_ID10>

        <Report_Name_ID11>Address Report</Report_Name_ID11>

        <ReportPageNumber_ID14>Page -</ReportPageNumber_ID14>

        <ReportPageNumber_ID15>1</ReportPageNumber_ID15>

        </Page_Header_S1>

        </PageHeaders>

      <P   

       

       

       

        • 1. Re: node vs. element
          odie_63

          An element is a type of node.

          From the XML Data Model (XDM) point of view, almost everything in an XML document is a node, even text and comments.

           

          An element is an item delimited by a start tag and an end tag, or a self-closing (empty) tag.

           

          In your example, PageHeaders is an element, and so are Page_Header_S1, PageHeaderNumber etc.

          • 2. Re: node vs. element
            SunshineFR

            Would Page_Header_S1 be considered as a sub-element of PageHeaders?

             

            Do the elements like PageHeaderNumber, R914921_ID9, SystemTime_ID4 define the element Page_Header_S1?

            • 3. Re: node vs. element
              odie_63

              Would Page_Header_S1 be considered as a sub-element of PageHeaders?

              The right term is "child", and the other way around, PageHeaders is Page_Header_S1's "parent".

               

               

              Do the elements like PageHeaderNumber, R914921_ID9, SystemTime_ID4 define the element Page_Header_S1?

              In a sense, yes.

              That kind of consideration leads to the the notion of XML Schema Definition (XSD). You'll probably learn about that later when you master the basic concepts and terminology.

               

              Pick up any XML tutorials on the internet.

              Also start looking at the XPath language, the standard to address XML content.