XML - Documents


Advertisements

An XML document is a basic unit of XML information composed of elements and other markup in an orderly package. An XML document can contains wide variety of data. For example, database of numbers, numbers representing molecular structure or a mathematical equation.

XML Document Example

A simple document is shown in the following example −

<?xml version = "1.0"?>
<contact-info>
   <name>Tanmay Patil</name>
   <company>Howcodex</company>
   <phone>(011) 123-4567</phone>
</contact-info>

The following image depicts the parts of XML document.

XML Document

Document Prolog Section

Document Prolog comes at the top of the document, before the root element. This section contains −

  • XML declaration
  • Document type declaration

You can learn more about XML declaration in this chapter − XML Declaration

Document Elements Section

Document Elements are the building blocks of XML. These divide the document into a hierarchy of sections, each serving a specific purpose. You can separate a document into multiple sections so that they can be rendered differently, or used by a search engine. The elements can be containers, with a combination of text and other elements.

You can learn more about XML elements in this chapter − XML Elements

Advertisements