• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's the difference - document root & document element?

 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the book "Professional XML", it says,
Any well-formed XML document must be a simple hierarchical tree with a single root node, called the "document root". This document tree contains a secondary tree of elements, with its own singular root node, called "document element".
Can anyone give an example for the difference?
Thanks!!!
 
Shoba Ramachandran
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Document root is the very first element of the DOM tree. This is something like virtual, there is no physical element like this in your xml document. This is DOM's representation. Document root is the parent of Document Element.
Document element is the root element of the xml document. This is very first element of your xml document.
Hope this helps
Shoba
 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Shoba, Ramachandran!! I got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic