Download presentation
Presentation is loading. Please wait.
Published byHaley Joyce Modified over 11 years ago
1
eXtensible HyperText Markup Language Miruna Bădescu Finsiel Romania Copenhagen, 25 May 2004
2
What is XMTL? n HTML4 is regarded as the standard publishing language on the Web F SGML application conform with the ISO 8879 standard F Defines a set of structural and semantic tags for authoring Web documents n XML is also a SGML implementation F Conceived to standardize the data transfer n XHTML is a family of document types that reproduce and extend HTML4 and are XML-based F Design to work with XML-based user agents
3
Why use it? n XHTML documents are XML conforming F => can be validated using XML tools n Can utilize applications (e.g. scripts and applets) that rely on either the: F HTML Document Object Model F XML Document Object Model n Easier to interoperate F Alternate ways of accessing the Internet are constantly being introduced n New XHTML-compliant user agents can be built to benefit from new and existing features
4
n Must have a DOCTYPE declaration prior to the Root element n Can have an XML declaration when the character encoding is other that the default UTF-8 or UTF-16 Making XHTML compatible documents
5
n The root element must be html n When a user agent processes an XHTML document, it will recognize only attributes of type ID (i.e. id instead of name) as fragment identifier n If an element is not recognized, the elements content must be processed n If an attribute is not recognized, it is ignored n If an attributes value is not recognized, the default value is used Making XHTML compatible documents (2)
6
n The document must be well-formed: no nested tags u Correct: here is a paragraph. u Incorrect: here is a paragraph. n Elements and attributes must be in lowercase (XML is case sensitive) u Correct: u Incorrect: Differences with HTML4
7
n End tags are required for non-empty elements u Correct: here is a paragraph here is another u Incorrect: here is a paragraph here is another n Attribute values must always be quoted u Correct: u Incorrect: Differences with HTML4 (2)
8
n XML does not support attribute minimization u Correct: u Incorrect: n Empty elements must have an end tag u Correct: u Incorrect: Differences with HTML4 (3)
9
n Script and style elements must have a #PCDATA content u Correct: <![CDATA[ … unescaped script content … ]]> n References to characters can be made using hexadecimal values u Correct: &#xnn; &x20AC; (Euro sign) u Incorrect: &#Xnn; &X20AC; Differences with HTML4 (4)
10
n SGML allows DTDs to exclude specific elements from being contained within an element u Examples: a must not contain another a element pre must not contain elements like img, object, big, small, sub, sup form must not contain another form element u Such prohibitions are not possible in XML Element prohibitions
11
n The encoding of a HTML document is specified by the Web server via: F The charset parameter of the HTTP Content-Type header or F The meta element in the document itself n In XML documents, the character encoding is specified in the XML declaration n For XHTML, the server should provide correct headers. If not, the document must include both XML declaration and meta http-equiv statement Character encoding
12
n The free W3C validator is located at: http://validator.w3.org Validate offline pages at: http://validator.w3.org/file-upload.html Validating your documents
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.