top of page
HTML5.png

HTML

XML

•    XML stands for eXtensible Markup Language.
•    It is also a markup language.
•    But XML is different from HTML in the sense that HTML describes how to display and format the data, text and images in the browser.
•    Where as,  XML is used to describe the data.
•    The XML standard was created by W3C to provide an easy way to store self-describing data(self-describing data is the data that describes both its content and its structure.
•    XML is a software and hardware independent tool for storing and transporting data.
•    XML tags are case sensitive in nature.
•    XML tags are not predefined. We create our own tags.
•    Syntax:-
    <NOTE>
        <TO> LIFE </TO>
        <FROM> SILU </FROM>
        <HEADING> REMAINDER </HEADING>
        <MESSAGE> DON’T FORGET ME….. </MESSAGE>
    </NOTE>
•    The XML above is quite self-descriptive:-
    •    It has sender information.
    •    It has receiver information.
    •    It has a heading.
    •    It has a message body.

XML syntax rules:-
 

1.    XML document must have a root element:-
    •    XML document must contain one root element that is the parent of all other elements.
    •    Syntax:-
    <ROOT>
            <CHILD>
                <SUB CHILD>……… </SUB CHILD>
            </CHILD>
    </ROOT>

2.    All XML elements must have a closing tag:-
    In  HTML, Some elements may have only starting tag and some HTML might work well even with a missing closing tag, but in XML all elements must have a closing tag.

3.    XML tags are case sensitive:-
    The tag <Letter> is different from <letter> tag.

4.    XML elements must be properly nested:-
    <ROOT>
        <CHILD>
            <SUB CHILD>……… </SUB CHILD>
        </CHILD>
    </ROOT>

5.    XML attribute values must be quoted:-
    <NOTE date=”03/04/2003”>
    <TO> LIFE </TO>
    <FROM> SILU </FROM>
    <HEADING> REMAINDER </HEADING>
    <MESSAGE> DON’T FORGET ME….. </MESSAGE>
    </NOTE>

6.    Comments in xml:-
    The syntax for writing comment in XML is similar to that of HTML.
    Syntax:-
    <NOTE>
        <TO> LIFE </TO>
        <FROM> SILU </FROM>
        <!--- MESSAGE REGARDING TO MY BELOVED LIFE --->
        <HEADING> REMAINDER </HEADING>
        <MESSAGE> DON’T FORGET ME….. </MESSAGE>
    </NOTE>

 

WELL FORMED XML DOCUMENT

•    An XML document with correct syntax is called well formed XML document.
•    XML documents must have a root element.
•    XML elements or tags must have a closing tag.
•    XML tags are case sensitive.
•    XML elements must be properly nested.
•    XML attribute value must be quoted.

FEATURES OF XML

•    XML is eXtensible in nature.
•    XML allows the user to create his own tags and document structure.
•    XML can be used to store data.
•    XML can be used to exchange data.
•    XML is free. It can be written with a simple text editor. E.g. notepad.
•    XML is a W3C recommendation.

 

XML and XQuery

•    XQuery is a language for finding and extracting elements and attributes from XML document.
•    XQuery is the language for querying XML data.
•    XQuery for XML is like SQL for database.
•    XQuery is supported by all major database.
•    XQuery is a W3C recommendation.

 

Related Topics

bottom of page