JFSD HA Session10
JFSD HA Session10
1)Raju is a Web Developer and trying to learn XML, make him understand what XML and the
Advantages of XML.
Ans: XML stands for Extensible Mark Up Language. XML uses DTDs (Document Type Definitions)
to define the XML document structure.
The main goal is to transport data not to display information. XML bridges the gap between human
readability and machine readability. Unlike HTML tags, XML tags are self-descriptive. The filename
extension of XML is “.xml”
XML Features
➢ It is human-readable.
➢ Overall simplicity.
➢ Self-descriptive nature.
➢ It separates data from HTML.
➢ XML tags are not predefined. You need to define your customized tags.
➢ XML was designed to carry data, not to display that data.
➢ Mark-up code of XML is easy to understand for a human.
➢ XML is an extensible markup language like HTML.
2)Raju has understood what an XML is but doesn’t know how to code in XML. So, make him
learn the tree structure in XML and some of the elements or attributes of XML
Ans: XML documents form a tree structure that starts at "the root" and branches to "the leaves".
DOM stands for Document Object Model. It defines a standard manner of accessing and manipulating
XML documents. DOM has a (hierarchical) tree structure.
Ex:
<?xml version="1.0" encoding="UTF-8" ?>
<school>
<student>
<name>
<first_name>Alex</first_name>
<last_name>Clarke</last_name>
</name>
<age>14</age>
<address>No. 35, Flower Road, Leeds</address>
</student>
</school>
Attributes are part of XML elements. An element can have multiple unique attributes. Attribute gives
more information about XML elements. To be more precise, they define properties of elements. An
XML attribute is always a name-value pair.
An XML attribute has the following syntax −
The tree structure of the above XML file would look like the following image.
Where the Tree is described with root, parent, and Child structure.
<book id="bk002">
<author>Poet</author>
<title>The Poet's First Poem</title>
<genre>Poem</genre>
<price>24.95</price>
<review>Least poetic poems.</review>
</book>
</x:books>
Output: