Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 References  














Root element







Add links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Each XML document has exactly one single root element. It encloses all the other elements and is, therefore, the sole parent element to all the other elements. ROOT elements are also called document elements. In HTML, the root element is the <html> element.[1]

The World Wide Web Consortium defines not only the specifications for XML itself,[2] but also the DOM, which is a platform- and language-independent standard object model for representing XML documents. DOM Level 1 defines, for every XML document, an object representation of the document itself and an attribute or property on the document called documentElement. This property provides access to an object of type element which directly represents the root element of the document.[3]

 <parent>
   <child>content</child>
   <child attribute="att"/>
 </parent>

There can be other XML nodes outside of the root element.[4] In particular, the root element may be preceded by a prolog, which itself may consist of an XML declaration, optional comments, processing instructions and whitespace, followed by an optional DOCTYPE declaration and more optional comments, processing instructions and whitespace. After the root element, there may be further optional comments, processing instructions and whitespace within the document.[5]

Within the root element, apart from any number of attributes and other elements, there may also be more optional text, comments, processing instructions and whitespace.

A more expanded example of an XML document follows, demonstrating some of these extra nodes along with a single rootElement element.

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE example [<!ENTITY copy "&#xA9;">]>
   
 <rootElement attribute="xyz">
   <contentElement/>
 </rootElement>
 
 <!-- comment nodes may appear almost anywhere -->

References

[edit]
  1. ^ "4 The elements of HTML — HTML5". www.w3.org. Retrieved 2017-10-10.
  • ^ The current W3C XML 1.0 specification
  • ^ The 'documentElement' definition in the W3C DOM Level 1 specification
  • ^ The 'well-formed document' section of the W3C XML specification
  • ^ The 'prolog' section of the W3C XML specification
  • t
  • e

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=Root_element&oldid=1102698862"

    Categories: 
    XML
    Programming language topic stubs
    Hidden category: 
    All stub articles
     



    This page was last edited on 6 August 2022, at 11:57 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki