html, xhtml and xml

Upload: komando-pasukan-khusus

Post on 05-Apr-2018

249 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 HTML, Xhtml and XML

    1/24

    5/8/12

    Click to edit Master subtitle styleM. Tanzil Furqon, S.KomIlmu Komputer Brawijaya

    HTML, XHTML and

  • 8/2/2019 HTML, Xhtml and XML

    2/24

    5/8/12

    HTML vs XHTML

    v XHTML elements must be properly nested In HTML, some elements can be improperly

    nested within each other, like this:

    This text is bold and italic In XHTML, all elements must be properly nested

    within each other, like this:This text is bold and italic

    v XHTML elements must always be closed This is wrong:

    This is a paragraph

    This is another paragraph This is correct:

    This is a paragraph

    This is another paragraph

  • 8/2/2019 HTML, Xhtml and XML

    3/24

    5/8/12

    HTML vs XHTML (cont)

    v XHTML elements must be in lowercase This is wrong:

    This is a paragraph

    This is correct:

    This is a paragraph

    v

    XHTML documents must have one rootelement The basic document structure is:

    ... ...

  • 8/2/2019 HTML, Xhtml and XML

    4/24

    5/8/12

    HTML vs XHTML (cont)

    v Attribute values must be quoted This is wrong: This is correct:

    v Attribute minimization is forbidden This is wrong:

    This is correct:

  • 8/2/2019 HTML, Xhtml and XML

    5/24

    5/8/12

    HTML vs XHTML (cont)

    v The id attribute replaces the name attribute This is wrong:

    This is correct:

    v Note: To interoperate with older browsers for awhile, you should use both name and id, with

    identical attribute values, like this:

    v IMPORTANT Compatibility Note: To makeyour XHTML compatible with today's browsers,

    you should add an extra space before the "/"

  • 8/2/2019 HTML, Xhtml and XML

    6/24

    5/8/12

    HTML vs XHTML (cont)

    v

    The XHTML DTD defines mandatoryelementsv An XHTML document consists of three main

    parts:

    the DOCTYPE declaration the section the section

    v This is an XHTML document with a minimum

    of required tags:

    Title goes here< >

  • 8/2/2019 HTML, Xhtml and XML

    7/245/8/12

    HTML vs XHTML (cont)

    v

    Note: The DOCTYPE declaration is not a partof the XHTML document itself. It is not anXHTML element.

    v Note: The xmlns attribute in , specifies

    the xml namespace for a document, and isrequired in XHTML documents. However, theHTML validator at w3.org does not complainwhen the xmlns attribute is missing. This is

    because the namespace"xmlns=http://www.w3.org/1999/xhtml" isdefault, and will be added to the tageven if you do not include it.

  • 8/2/2019 HTML, Xhtml and XML

    8/245/8/12

    Document Type Definitions(DTD)

    v A DTD specifies the syntax of a web page inSGML

    v DTDs are used by SGML applications, such as

    HTML, to specify rules for documents of aparticular type, including a set of elements andentity declarations

    v An XHTML DTD describes in precise, computer-

    readable language, the allowed syntax ofXHTML markup

    v There are three XHTML DTDs: STRICT TRANSITIONAL

  • 8/2/2019 HTML, Xhtml and XML

    9/245/8/12

    XHTML 1.0 Strict

    v Use the strict DOCTYPE when you want reallyclean markup, free of presentational clutter. Useit together with CSS.

  • 8/2/2019 HTML, Xhtml and XML

    10/24

    5/8/12

    XHTML 1.0 Transitional

    v Use the transitional DOCTYPE when you wantto still use HTML's presentational features.

  • 8/2/2019 HTML, Xhtml and XML

    11/24

    5/8/12

    XHTML 1.0 Frameset

    v Use the frameset DOCTYPE when you want touse HTML frames.

  • 8/2/2019 HTML, Xhtml and XML

    12/24

    5/8/12

    XHTML 1.0 DTD

  • 8/2/2019 HTML, Xhtml and XML

    13/24

    5/8/12

    XHTML 1.0 DTD (cont)

  • 8/2/2019 HTML, Xhtml and XML

    14/24

    5/8/12

    XHTML 1.0 DTD (cont)

  • 8/2/2019 HTML, Xhtml and XML

    15/24

    5/8/12

    XHTML 1.0 DTD (cont)

    S=Strict, T=Transitional, and F=Frameset

  • 8/2/2019 HTML, Xhtml and XML

    16/24

    5/8/12

    XHTML Modules

    v For some purposes XHTML is too large andcomplex, and for other purposes it's too simple.

    v With modular XHTML, designers can:

    Choose the elements to be supported by a device Simplify XHTML for small devices Extend XHTML for complex applications by adding

    new XML functionality (like MathML, SVG, Voice

    and Multimedia) Define XHTML profiles like XHTML Basic (a

    subset of XHTML for mobile devices)

  • 8/2/2019 HTML, Xhtml and XML

    17/24

    5/8/12

    XHTML 28 modules

  • 8/2/2019 HTML, Xhtml and XML

    18/24

    5/8/12

    XML vs HTML

    v XML was designed to transport and store data.v HTML was designed to display data.

  • 8/2/2019 HTML, Xhtml and XML

    19/24

    5/8/12

    XML vs HTML (cont)

    v The Difference Between XML and HTML XML is not a replacement for HTML. XML and HTML were designed with different

    goals: XML was designed to transport and store data, with

    focus on what data is.

    HTML was designed to display data, with focus onhow data looks.

    v HTML is about displaying information, while XMLis about carrying information.

  • 8/2/2019 HTML, Xhtml and XML

    20/24

    5/8/12

    XML Does not DO Anything

    v Maybe it is a little hard to understand, but XMLdoes not DO anything. XML was created tostructure, store, and transport information.

    v

    The following example is a note to Tove fromJani, stored as XML:

    Tove

    JaniReminderDon't forget me this weekend!

    v It is just pure information wrapped in tags.

  • 8/2/2019 HTML, Xhtml and XML

    21/24

    5/8/12

    XML is Not a Replacement forHTML

    v XML is a complement to HTML.v It is important to understand that XML is not a

    replacement for HTML. In most web

    applications, XML is used to transport data,while HTML is used to format and display thedata.

    v My best description of XML is this:

    XML is a software- and hardware-independent tool for carrying information.(http://www.w3schools.com/xml/xml_whatis.asp)

  • 8/2/2019 HTML, Xhtml and XML

    22/24

    5/8/12

    HTML, XHTML and XML

    v XHTML derived from XML and HTML whereXML derives from SGML (Standardized GeneralMarkup Language)

    v

    XHTML is a mark-up languagev XML and SGML is a meta language (A language

    is what's used to build other languages)v Markup languages created with XML include

    XHTML, MathML (for mathematics),VoiceXML (for speech), SMIL (theSynchronized Multimedia Integration Languagefor multimedia presentations), CML (Chemical

    Markup Language for chemistry) and XBRL

  • 8/2/2019 HTML, Xhtml and XML

    23/24

    5/8/12

    Why the need for XHTML?

    v The XHTML family is designed to accommodateextensions (in XML) through XHTML modulesand techniques for developing new XHTML-conforming modules. These modules will permitthe combination of existing and new feature setswhen developing content and when designingnew user agents.

    v

    Alternate ways of accessing the Internet areconstantly being introduced. With XHTML it willbe possible to develop XHTML-conformingcontent that is usable by any XHTML-

    conforming user agent.

  • 8/2/2019 HTML, Xhtml and XML

    24/24

    5/8/12

    Source