XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. XML was developed based on SGML and is designed to transport and store data. XML documents contain elements, attributes, and have a tree structure. Documents must follow specific rules to be considered valid XML, such as having matching start and end tags.
3. e X tensible M arkup L anguage Derived from SGML ( S tandard G eneralized M arkup L anguage) SGML is an international standard for defining the structure of different types electronic documents. What is Markup? Information added to text to make its structure comprehensible. For ex : Punctuation .
4. XML is W3C recommendation. XML is designed to transport and store data. XML tags are not predefined. You must define your own tags. XML is designed to be self-descriptive. XML Documents Form a Tree Structure
5. XML shall be straightforwardly usable over the Internet. XML shall support a wide variety of applications. XML shall be compatible with SGML. It shall be easy to write programs which process XML documents. The number of optional features in XML is to be kept to the absolute minimum, ideally zero. XML documents should be human-legible and reasonably clear. The XML design should be prepared quickly. The design of XML shall be formal and concise. XML documents shall be easy to create.
6. XML is case sensitive All start tags must have end tags Elements must be properly nested XML declaration is the first statement Every document must contain a root element Attribute values must have quotation marks Certain characters are reserved for parsing
8. A Document Type Definition ( DTD ) allows the developer to create a set of rules to specify legal content and place restrictions on an XML file If the XML document does not follow the rules contained within the DTD, a parser generates an error An XML document that conforms to the rules within a DTD is said to be valid A single DTD ensures a common format for each XML document that references it An application can use a standard DTD to verify that data that it receives from the outside world is valid
9. An element type has element content when elements of that type must contain only child elements (no character data), optionally separated by white space. If an element name in DTD is followed by the star [*], this element can occur zero, once or several times. If an element name in DTD is followed by the plus [+], this element can occur once or several times. If an element name in DTD is followed by the question mark [?], this element can occur zero or one times. With character [ | ] you can select one from several elements.
10. Attributes are used to associate name-value pairs with elements. Attribute specifications may appear only within start-tags and empty-element tags. The declaration starts with ATTLIST then follows the name of the element the attributes belong to and then follows the definition of the individual attributes. An attribute of CDATA type can contain any character if it conforms to well formedness constraints. An element can be defined EMPTY. In such a case it can contain only attributes but no text.
11. defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes
12. XML Schemas are extensible to future additions XML Schemas are richer and more powerful than DTDs XML Schemas are written in XML XML Schemas support data types XML Schemas support namespaces
13. XSL (Extensible Stylesheet Language) XSLT transforms an XML document into another XML document. All Major browsers support XSLT. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
14. The design goals of XML include "It shall be easy to write programs which process XML documents Types of parsing APIs Stream-oriented - for example SAX and StAX. Tree-traversal - for example DOM. XML data binding - Mapping XML elements to programming languages Declarative transformation - XSLT and XQuery.