HTML vs XHTML or XML

1. What is HTML?

HTML stands for hypertext markup language and is used to develop web pages.


HTML vs XHTML


As its name describes, Html is not a programming language like Java, C#, and Python but a markup language.

·        HTML is based on ISO SGML (Standard Generalized Markup Language).

·        HTML is easy to learn.

·        Supported by all browsers.

·        HTML is a markup language.

·        HTML was first introduced in late 1991 by Tim Berners-Lee.

·        The world's first HTML comprised 18 tags.

·        The latest version of HTML is HTML 5.

 

2. What is XHTML?

·        XHTML stands for Extensible Hypertext Markup Language.

·        XHTML is also simple to learn and understand.

·        XHTML is basically XML Markup Language.

·        XHTML is supported by all major browsers.

·        XML 1.0 standard was adopted in January 2000.

3. HTML and XHTML File Extensions?

·        HTML documents have two extensions i.e .html and .htm.

·         HTML documents have extension xhtml, .xml, xht

4. How do I open an XML file extension?

·        Right-click the XML file or HTML file and select "Open with." Select "Notepad" on Windows or "TextEdit" on Mac OS. These text editors are available on all operating systems.

5. Why XHTML?

·        XHTML is strict than HTML and XML based documents are well formed.

·        Error handling comes with XHTML.

·        Previously browsers were displaying pages even with errors.

·        Data transportation is also possible with XML-based documents.


6. HTML vs XHTML document Structure

HTML Document starts with html tag and ends with html tag. Everything will be in the body tag like the heading etc.

Example of HTML Document / Page

<html>

<head>   

    <title>David chu's china Bistro</title>

</head>

<body>

       <h1>This is HTML page</h1>

  </body>

  </html>

7. Example of XHTML or XML Document

XML documents are well-defined text files. Look at the following DTD Document type definition.

8. Example of XHTML or XML DTD or Schema

 

<?xml version = "1.0"?>

<!DOCTYPE ORDERFILE [

<!ELEMENT ORDERFILE (CUSTOMER)*>

<!ELEMENT CUSTOMER (NAME, DATE, ORDERS)>

<!ELEMENT NAME (LAST-NAME, FIRST-NAME)>

<!ELEMENT LAST-NAME (#PCDATA)>

<!ELEMENT FIRST-NAME (#PCDATA)>

<!ELEMENT DATE (#PCDATA)>

<!ELEMENT ORDERS (ITEM)*>

<!ELEMENT ITEM (PRODUCT, NUMBER, (PRICE | CHARGEACCT | SAMPLE))>

<!ELEMENT PRODUCT (#PCDATA)>

<!ELEMENT NUMBER (#PCDATA)>

<!ELEMENT PRICE (#PCDATA)>

<!ELEMENT CHARGEACCT (#PCDATA)>

<!ELEMENT SAMPLE (#PCDATA)>

]>


9. Example of XHTML file based on the above DTD

 

<ORDERFILE>
    <CUSTOMER>
        <NAME>
            <LAST-NAME>Asif</LAST-NAME>
            <FIRST-NAME>Nawaz</FIRST-NAME>
        </NAME>
        <DATE>October 19, 2022</DATE>
        <ORDERS>
            <ITEM>
                <PRODUCT>Dry Cell</PRODUCT>
                <NUMBER>8</NUMBER>
                <PRICE>1.25</PRICE>
            </ITEM>
            <ITEM>
        <PRODUCT>Mangos</PRODUCT>
                <NUMBER>12</NUMBER>
                <PRICE>2.50</PRICE>
            </ITEM>
            <ITEM>
        <PRODUCT>Burger</PRODUCT>
                <NUMBER>1</NUMBER>
                <PRICE>10</PRICE>
            </ITEM>
        </ORDERS>
    </CUSTOMER>

10 My Blog theme is also developed using xml

bytesinfo2022.blogspot


11. What are the Advantages of XHTML?

·         XHTML guarantees that the elements in the pages are well formed.

·         XHTML. pages will be rendered correctly and consistently in all browsers.

·         XHTML helps to make pages accessible across network streams and transport.

·         As XHTML is extensible, so it allows the definition of new elements.

·         From the programmer’s and developer’s perspective XHTML page is much easier to read programmatically.

·         All major platforms like Microsoft.net is using these standards and there are a lot of APIs) Application Programming Interface) and Libraries are available.

·         Famous MVC Framework of .Net still uses dynamically generated XHTML and Blazer Pages.

12. Learning HTML vs XHTML

HTML5

13. Why Learn HTML5?

·         HTML5 allows you to build online as well as offline applications. HTML 5 is not simply a markup language but a complete set of tools like JavaScript, CSS, and APIs to develop cross-platform application web applications or mobile applications.

·         HTML5 also added Semantic tags and API for graphics.

·         Learning HTML5 is worthwhile. The choice to use depends on you.

14. Why Learn XHTML or XML?

·         XML format is used to store data with its structure.

·         Useful for transferring data across web Pages.

·         Store Configuration data in software and applications.

·         Useful for creating layouts in UI

15. Conclusion

·         Either HTML or XHTML are markup languages for web pages. Requirements are always different, but both are essential to learn and implement in web applications.