ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is the root node in XML document?

user-image
تم إضافة السؤال من قبل Walaa Alhalabi , Sr. PMIS (Oracle BI Publisher) , Khatib & Alami
تاريخ النشر: 2015/12/23
Ali Alawieh
من قبل Ali Alawieh , Software Engineer (Android) , CME Offshore S.A.L

The root node is the "parent" node that all nodes are children of.

For example if you have an XML file where you are storing books, your root node would be <books> and your XML file would look something like this:

<books>

    <book id="1">

        <author id=""/>

        <page_numbers></page_numbers>

        <category id="5"/>

    </book>

    <book id="2">

        <author id=""/>

        <page_numbers></page_numbers>

        <category id="6"/>

    </book>

    <book id="3">

        <author id=""/>

        <page_numbers></page_numbers>

        <category id="2"/>

    </book>

</books>

 

The root node is especially useful when you try to access the file from software you are trying to make. Because parsers (objects made to read the file) like the DOM parser, load such file as a tree . And there has to be a parent node in the tree , that would be the root node.

 

XML loaded into memory as a tree

 

المزيد من الأسئلة المماثلة