1.
INTRODUCTION
XML, in full extensible markup language, a document formatting language used for
some World    Wide    Web pages.     XML     began   to   be   developed   in   the   1990s
because HTML (hypertext markup language), the basic format for Web pages, does not allow
the definition of new text elements; that is, it is not extensible. XML is a simplified form
of SGML (standard generalized markup language) intended for documents that are published
on the Web. Like SGML, XML uses DTDs (document type definitions) to define document
types and the meanings of tags used in them. XML adopts conventions that make it easy to
parse, such as that document entities are marked by both a beginning and an ending tag, such
as <BEGIN>…</BEGIN>. XML provides more kinds of hypertext links than HTML, such
as bidirectional links and links relative to a document subsection. Because an author may
define new tags, an XML DTD must also contain rules that instruct a Web browser how to
interpret them—how an entity is to be displayed or how it is to generate an action such as
preparing an e-mail message
[Definition: A software module called an XML processor is used to read XML documents
and provide access to their content and structure.] [Definition: It is assumed that an XML
processor is doing its work on behalf of another module, called the application.] This
specification describes the required behavior of an XML processor in terms of how it must
read XML data and the information it must provide to the application.
1|Page
                                 2. HISTORY OF XML
XML was developed by an XML Working Group (originally known as the SGML Editorial
Review Board) formed under the auspices of the World Wide Web Consortium (W3C) in
1996. It was chaired by Jon Bosak of Sun Microsystems with the active participation of an
XML Special Interest Group (previously known as the SGML Working Group) also
organized by the W3C. The membership of the XML Working Group is given in an
appendix. Dan Connolly served as the Working Group's contact with the W3C. XML is an
application profile of SGML (ISO 8879).
The versatility of SGML for dynamic information display was understood by early digital
media publishers in the late 1980s prior to the rise of the Internet. [27][28] By the mid-1990s
some practitioners of SGML had gained experience with the then-new World Wide Web, and
believed that SGML offered solutions to some of the problems the Web was likely to face as
it grew. Dan Connolly added SGML to the list of W3C's activities when he joined the staff in
1995; work began in mid-1996 when Sun Microsystems engineer Jon Bosak developed a
charter and recruited collaborators. Bosak was well connected in the small community of
people who had experience both in SGML and the Web. XML was compiled by a working
group of eleven members,[30] supported by a (roughly) 150-member Interest Group. Technical
debate took place on the Interest Group mailing list and issues were resolved by consensus or,
when that failed, majority vote of the Working Group. A record of design decisions and their
rationales was compiled by Michael Sperberg-McQueen on December 4, 1997. James
Clark served as Technical Lead of the Working Group, notably contributing the empty-
element <empty /> syntax and the name "XML".
2|Page
Other names that had been put forward for consideration included "MAGMA" (Minimal
Architecture for Generalized Markup Applications), "SLIM" (Structured Language for
Internet Markup) and "MGML" (Minimal Generalized Markup Language).
The co-editors of the specification were originally Tim Bray and Michael Sperberg-
McQueen. Halfway through the project Bray accepted a consulting engagement
with Netscape, provoking vociferous protests from Microsoft. Bray was temporarily asked to
resign the editorship. This led to intense dispute in the Working Group, eventually solved by
the appointment of Microsoft's Jean Paoli as a third co-editor.The XML Working Group
never met face-to-face; the design was accomplished using a combination of email and
weekly teleconferences. The major design decisions were reached in a short burst of intense
work between August and November 1996, when the first Working Draft of an XML
specification was published.[33] Further design work continued through 1997, and XML 1.0
became a W3C Recommendation on February 10, 1998.
3|Page
                            3. KEY/PRINCIPLES OF XML
The material in this section is based on the XML Specification. This is not an exhaustive list
of all the constructs that appear in XML; it provides an introduction to the key constructs
most often encountered in day-to-day use.
Character
An XML document is a string of characters. Every legal Unicode character (except Null) may
appear in an XML document (while some are discouraged).
Processor and application
The processor analyzes the markup and passes structured information to an application. The
specification places requirements on what an XML processor must do and not do, but the
application is outside its scope. The processor (as the specification calls it) is often referred to
colloquially as an XML parser.
Markup and content
The characters making up an XML document are divided into markup and content, which
may be distinguished by the application of simple syntactic rules. Generally, strings that
constitute markup either begin with the character < and end with a > , or they begin with the
character & and end with a ; . Strings of characters that are not markup are content.
However, in a CDATA section, the delimiters <![CDATA[ and ]]> are classified as markup,
while the text between them is classified as content. In addition, whitespace before and after
the outermost element is classified as markup.
Tag
A tag is a markup construct that begins with < and ends with > . There are three types of tag:
      start-tag, such as <section> ;
      end-tag, such as </section> ;
      empty-element tag, such as <line-break /> .
4|Page
Element
An element is a logical document component that either begins with a start-tag and ends with
a matching end-tag or consists only of an empty-element tag. The characters between the
start-tag and end-tag, if any, are the element's content, and may contain markup, including
other elements, which are called child elements. An example is <greeting>Hello,
world!</greeting> . Another is <line-break /> .
Attribute
An attribute is a markup construct consisting of a name–value pair that exists within a start-
tag or empty-element tag. An example is <img src="madonna.jpg" alt="Madonna" /> , where
the names of the attributes are "src" and "alt", and their values are "madonna.jpg" and
"Madonna" respectively. Another example is <step number="3">Connect A to B.</step> ,
where the name of the attribute is "number" and its value is "3". An XML attribute can only
have a single value and each attribute can appear at most once on each element. In the
common situation where a list of multiple values is desired, this must be done by encoding
the list into a well-formed XML attribute [i] with some format beyond what XML defines
itself. Usually this is either a comma or semi-colon delimited list or, if the individual values
are known not to contain spaces,[ii] a space-delimited list can be used.
<div class="inner greeting-box">Welcome!</div> , where the attribute "class" has both the
value "inner greeting-box" and also indicates the two CSS class names "inner" and "greeting-
box".
XML declaration
XML documents may begin with an XML declaration that describes some information about
themselves. An example is <?xml version="1.0" encoding="UTF-8"?> .
5|Page
                                 4. ARCHITECTURE
An XML (EXtensible Markup Language) Document contains declarations, elements, text,
and attributes. It is made up of entities (storing units) and It tells us the structure of the data
it refers to. It is used to provide a standard format of data transmission. As it helps in
message delivery, it is not always stored physically, i.e. in a disk but generated dynamically
but its structure always remains the same.
XML Standard structure and its rules:
Rule 1: Its standard format consists of an XML prolog which contains both XML
Declaration and XML DTD (Document Type Definition) and the body. If the XML prolog
is present, it should always be the beginning of the document. The XML Version, by
default, is 1.0, and including only this forms the shortest XML Declaration. UTF-8 is the
default character encoding and is one of seven character-encoding schemes. If it is not
present, it can result in some encoding errors
Syntax of XML Declaration:
<?xml version="1.0" encoding="UTF-8"?>
Syntax of DTD:
<!DOCTYPE root-element [<!element-declarations>]>
Example:
 <!DOCTYPE website [
 <!ELEMENT website (name,company,phone)>
 <!ELEMENT name (#PCDATA)>
 <!ELEMENT company (#PCDATA)>
 <!ELEMENT phone (#PCDATA)>
 ]>
 <website>
 <name>GeeksforGeeks</name>
 <company>GeeksforGeeks</company>
 <phone>011-24567981</phone>
 </website>
6|Page
Rule 2: XML Documents must have a root element (the supreme parent element) and its
child elements (sub-elements). To have a better view of the hierarchy of the data elements,
XML follows the XML tree structure which comprises of one single root (parent) and
multiple leaves (children).
Example:
 <?xml version="1.0" encoding="UTF-8"?>
 <website>
       <company category="geeksforgeeks">
              <title>Machine learning</title>
              <author>aarti majumdar</author>
              <year>2022</year>
       </company>
       <company category="geeksforgeeks">
              <title>Web Development</title>
              <author>aarti majumdar</author>
              <year>2022</year>
       </company>
       <company category="geeksforgeekse">
              <title>XML</title>
              <author>aarti majumdar</author>
              <year>2022</year>
       </company>
 </website>
7|Page
Rule   3:     All   XML        Elements   are   required   to   have   Closing   and   opening
Tags(similar to HTML).
 <message>Welcome to GeeksforGeeks</message>
Rule 4: The opening and closing tags are case-sensitive. For Example, <Message> is
different from <message> from above example.
Rule 5: Values of XML attributes are required to have quotations:
 <website category="open source">
        <company>geeksforgeeks</company>
 </website>
Rule 6: White-Spaces are retained and maintained in XML.
 <message>welcome         to              geeksforgeeks</message>
Rule 7: Comments can be defined in XML enclosed between <!– and –> tags.
 <!-- XML Comments are defined like this -->
Rule 8: XML elements must be nested properly.
 <message>
        <company>GeeksforGeeks</company>
 </message>
8|Page
                            5. APPLICATIONS OF XML
     Data storage and exchange: XML is often used to store and exchange data between
      different applications and systems. Because it is a text-based language, it is easy to
      transmit over the internet and to integrate with other systems.
     Web development: XML is used in many aspects of web development, including the
      creation of user-friendly documents for the web and the definition of web services.
     Electronic data interchange: XML is used for electronic data interchange (EDI),
      which allows businesses to exchange documents and data electronically.
     Data integration: XML is often used to integrate data from different sources, such as
      databases and legacy systems.
     Document management: XML is used to create and manage documents that have
      complex structures, such as technical manuals, legal documents, and books.
     Mobile applications: XML is used in many mobile applications to store
      and exchange data.
     Storing and exchanging project data: XML can be used to store project data in a
      structured and standardized format, which makes it easy to exchange data between
      different applications and systems. For example, XML can be used to store project
      plans, task lists, and other project-related information.
     Defining project documents: XML can be used to create project documents that have
      complex structures, such as technical manuals, legal documents, and books. XML
      allows developers to define their own custom tags and attributes, which makes it
      possible to create documents with a wide range of formatting and layout options.
     Creating web services: XML is often used as the basis for web services, which are
      APIs that allow applications to communicate with each other over the internet. In a
      project, XML can be used to define the structure of the data that is exchanged
      between different applications, which makes it easier to integrate different systems
      and services.
     Integrating with other systems: XML is often used to integrate data from different
      sources, such as databases and legacy systems. In a project, XML can be used to
      import data from external sources and to export data to other systems.
9|Page
XML can be used in a variety of different ways, depending on the specific requirements of
the application. Here are some examples of how XML can be used in code:
 1.Storing data in an XML document:
To store data in an XML document, you can use the XmlDocument class in the .NET
Framework. Here is an example of how to create an XML document and add data to it:
XmlDocument doc = new XmlDocument();
// Create the root element
XmlElement root = doc.CreateElement("root");
// Create a child element
XmlElement child = doc.CreateElement("child");
// Set the child element's value
child.InnerText = "Hello, world!";
// Add the child element to the root element
root.AppendChild(child);
// Add the root element to the document
doc.AppendChild(root);
// Save the XML document to a file
doc.Save("data.xml");
10 | P a g e
2. Reading data from an XML document:
 To read data from an XML document, you can use the XmlDocument class in the .NET
Framework. Here is an example of how to load an XML document and read the data from it:
 XmlDocument doc = new XmlDocument();
 // Load the XML document from a file
 doc.Load("data.xml");
 // Get the root element
 XmlElement root = doc.DocumentElement;
 // Get the first child element
 XmlElement child = (XmlElement)root.FirstChild;
 // Get the value of the child element
 string value = child.InnerText;
 // Print the value to the console
 Console.WriteLine(value); // Hello, world!
11 | P a g e
3. Using XML data in a LINQ query:
LINQ (Language Integrated Query) is a powerful language feature in the .NET Framework
that allows you to query data using a syntax that is similar to SQL. You can use LINQ to
query XML data, which makes it easier to work with complex XML documents. Here is an
example of how to use LINQ to query XML data:
 XmlDocument doc = new XmlDocument();
 // Load the XML document from a file
 doc.Load("data.xml");
 // Get the root element
 XmlElement root = doc.DocumentElement;
 // Use LINQ to query the XML data
 var query = from e in root.Elements()
        where e.Name == "child" && e.Value == "Hello, world!"
        select e;
 // Print the results to the console
 foreach (XmlElement element in query)
 {
    Console.WriteLine(element.Value); // Hello, world!
 }
Overall, XML is a powerful and versatile language that can be used in many different ways in
code. By using XML, developers can create structured and standardized data that is easy to
work with and integrate with other systems.
12 | P a g e
                          6. PROJECTS BASED ON XML
         1.Layout for Text to speech
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/andro
id"
  xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
  android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margi
n"
android:paddingRight="@dimen/activity_horizontal_marg
in"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margi
n"
 tools:context=".MainActivity"
 android:transitionGroup="true">
  <TextView android:text="Text to Speech"
android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:id="@+id/textview"
   android:textSize="35dp"
   android:layout_alignParentTop="true"
   android:layout_centerHorizontal="true" />
 <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
 13 | P a g e
   android:text="Tutorials point"
  android:layout_below="@+id/textview"
  android:layout_centerHorizontal="true"
  android:textColor="#ff7aff24"
  android:textSize="35dp" />
<ImageView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/imageView"
  android:src="@drawable/abc"
  android:layout_below="@+id/textView"
  android:layout_centerHorizontal="true"
  android:theme="@style/Base.TextAppearance.AppCompat" />
<EditText
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/editText"
  android:layout_below="@+id/imageView"
  android:layout_marginTop="46dp"
  android:hint="Enter Text"
  android:layout_alignParentRight="true"
  android:layout_alignParentEnd="true"
  android:layout_alignParentLeft="true"
  android:layout_alignParentStart="true"
  android:textColor="#ff7aff10"
  android:textColorHint="#ffff23d1" />
<Button
14 | P a g e
 <Button
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Text to Speech"
   android:id="@+id/button"
   android:layout_below="@+id/editText"
   android:layout_centerHorizontal="true"
   android:layout_marginTop="46dp" />
</RelativeLayout>
15 | P a g e
 2.Login screen layout:
<?xml version = "1.0" encoding = "utf-8"?>
<RelativeLayout xmlns:android =
"http://schemas.android.com/apk/res/android"
  xmlns:tools = "http://schemas.android.com/tools"
android:layout_width="match_parent"
  android:layout_height = "match_parent"
android:paddingLeft= "@dimen/activity_horizontal_margin"
 android:paddingRight =
"@dimen/activity_horizontal_margin"
 android:paddingTop = "@dimen/activity_vertical_margin"
  android:paddingBottom =
"@dimen/activity_vertical_margin" tools:context =
".MainActivity">
  <TextView android:text = "Login"
android:layout_width="wrap_content"
   android:layout_height = "wrap_content"
   android:id = "@+id/textview"
   android:textSize = "35dp"
   android:layout_alignParentTop = "true"
   android:layout_centerHorizontal = "true" />
 <TextView
   android:layout_width = "wrap_content"
   android:layout_height = "wrap_content"
   android:text = "Tutorials point"
   android:id = "@+id/textView"
   android:layout_below = "@+id/textview"
   android:layout_centerHorizontal = "true"
   android:textColor = "#ff7aff24"
   android:textSize = "35dp" />
 16 | P a g e
<EditText
   android:layout_width = "wrap_content"
   android:layout_height = "wrap_content"
   android:id = "@+id/editText"
   android:hint = "Enter Name"
   android:focusable = "true"
   android:textColorHighlight = "#ff7eff15"
   android:textColorHint = "#ffff25e6"
   android:layout_marginTop = "46dp"
   android:layout_below = "@+id/imageView"
   android:layout_alignParentLeft = "true"
   android:layout_alignParentStart = "true"
   android:layout_alignParentRight = "true"
   android:layout_alignParentEnd = "true" />
 <ImageView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:id="@+id/imageView"
   android:src="@drawable/abc"
   android:layout_below="@+id/textView"
   android:layout_centerHorizontal="true" />
 <EditText
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:inputType="textPassword"
   android:ems="10"
   android:id="@+id/editText2"
17 | P a g e
   android:id="@+id/editText2"
   android:layout_below="@+id/editText"
   android:layout_alignParentLeft="true"
   android:layout_alignParentStart="true"
   android:layout_alignRight="@+id/editText"
   android:layout_alignEnd="@+id/editText"
   android:textColorHint="#ffff299f"
   android:hint="Password" />
 <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Attempts Left:"
   android:id="@+id/textView2"
   android:layout_below="@+id/editText2"
   android:layout_alignParentLeft="true"
   android:layout_alignParentStart="true"
   android:textSize="25dp" />
 <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="New Text"
   android:id="@+id/textView3"
   android:layout_alignTop="@+id/textView2"
   android:layout_alignParentRight="true"
18 | P a g e
   android:layout_alignParentEnd="true"
   android:layout_alignBottom="@+id/textView2"
   android:layout_toEndOf="@+id/textview"
   android:textSize="25dp"
   android:layout_toRightOf="@+id/textview" />
 <Button
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="login"
   android:id="@+id/button"
   android:layout_alignParentBottom="true"
   android:layout_toLeftOf="@+id/textview"
   android:layout_toStartOf="@+id/textview" />
 <Button
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Cancel"
   android:id="@+id/button2"
   android:layout_alignParentBottom="true"
   android:layout_toRightOf="@+id/textview"
   android:layout_toEndOf="@+id/textview" />
</RelativeLayout>
 19 | P a g e
                              7. ADVANTAGES OF XML
       Extensibility: XML allows users to define their own tags and attributes, which makes
        it possible to encode information in a way that is customized to the needs of a
        particular application or industry.
       Self-describing nature: XML documents include tags that provide information about
        the data they contain, which makes it easy for programs to parse and interpret the
        data.
       Interoperability: XML is widely supported and can be used to exchange data between
        different systems and applications, which makes it a useful tool for enabling
        interoperability between different software platforms.
       Human-readable: XML documents are formatted in a way that is easy for humans to
        read and understand, which makes it possible for users to view and edit the data
        contained in an XML document without the need for specialized software.
       Platform independence: XML is platform-independent, which means that XML
        documents can be used and interpreted on any system that has an XML parser.
       Supports internationalization: XML supports the use of Unicode, which allows it to
        encode and display text in multiple languages.
    
20 | P a g e
                            8. DISADVANTAGES OF XML
       Verbosity: XML documents can be quite verbose, as they require the use of tags to
        describe the data they contain. This can make XML documents larger and more
        difficult to read and edit than other formats such as CSV or JSON.
       Complexity: XML has a more complex syntax than some other formats, which can
        make it more difficult for developers to work with and create XML documents.
       Performance: XML parsing and processing can be slower than some other formats,
        which can be an issue when working with large volumes of data.
       Limited support for data types: XML does not have native support for data types such
        as integers and floating-point numbers, which can make it more difficult to represent
        and manipulate certain types of data.
       Lack of standardization: While there are many standards that define how XML should
        be used and interpreted, there is still a lack of standardization in terms of how XML
        documents should be structured and formatted. This can make it difficult to ensure
        that XML documents are consistently interpreted across different systems
        and applications.
21 | P a g e
                                        8. CONCLUSION
In conclusion, XML is a widely-used markup language that has a number of advantages,
including extensibility, self-describing nature, interoperability, human-readability, and
platform independence. However, it also has some disadvantages, such as verbosity,
complexity, performance issues, limited support for data types, and lack of standardization.
XML is a useful tool for encoding and exchanging data in a variety of contexts, but it may
not be the best choice for every situation. It is important to consider the specific requirements
and needs of your application or project when deciding whether to use XML
or another format.
XML is a flexible and widely-used markup language that is useful for encoding and
exchanging data in a human-readable and machine-readable format. It has many advantages,
but it can also be verbose and complex, and may not always be the best choice for certain
situations due to performance or data type limitations. It is important to carefully consider the
specific needs and requirements of your project when deciding whether to use XML
or another format.
22 | P a g e
                                      REFERENCES
    1. https://www.geeksforgeeks.org/xml-basics/?ref=gcse
    2. https://en.wikipedia.org/wiki/XML#Sources
    3. https://www.w3.org/TR/xml/
    4. https://www.techtarget.com/whatis/definition/XML-Extensible-Markup-
        Language
    5. https://chat.openai.com/chat
23 | P a g e