XHTML: diferenças entre revisões
Conteúdo apagado Conteúdo adicionado
→XHTML 1.0: Adequando ao !DOCTYPE --> "xhtml1-frameset.dtd" |
m +fix -redirect (com WCleaner) - Apple (v1.13) |
||
Linha 5:
|screenshot =
|legenda =
|extensão =
|mime = application/xhtml+xml
|magica =
Linha 34:
== Exemplos ==
Um exemplo simples de XHTML seria: (Observando dentro das tags
<source lang="html4strict">
<html>
</html>
</source>
Linha 114:
<html xmlns="http://www.w3.org/1999/xhtml">
</html>
</source>
* '''XHTML 1.0 Transitional''' é o mesmo que HTML 4.01 Transitional, mas segue as regras de sintaxe XML. Ele suporta tudo encontrado no XHTML 1.0 Strict, mas também permite o uso de vários elementos e atributos que são julgados ''presencionais'', para facilitar a transição de HTML 3.2 e mais recentes. Isso inclui
Declaração da XHTML 1.0 Transitional:
Linha 132:
<html xmlns="http://www.w3.org/1999/xhtml">
</html>
</source>
Linha 150:
<html xmlns="http://www.w3.org/1999/xhtml">
</html>
</source>
=== XHTML 1.1 ===
A mais recente Recomendação XHTML da W3C é o ''XHTML 1.1: Module-based XHTML'', que é uma reformulação do XHTML 1.0 Strict, com pequenas modificações, usando alguns módulos de um conjunto definido em Modularização de XHTML,<ref>[http://www.w3.org/TR/xhtml-modularization/ XHTML Modularization]</ref> uma Recomendação W3C que cria uma modularização de frames, um padrão de módulos, e várias outras definições. Todas as ferramentas depreciadas de HTML, como elementos presencionais e framesets, e até mesmo os atributos
Além da Modularização de XHTML permitir pequenas ferramentas XHTML serem reutilizadas por outras aplicações XML de uma maneira bem definida, e que o XHTML seja estendido para alguns propósitos, XHTML 1.1 adiciona o conceito de um documento "estritamente conformado": esses documentos definidos nos módulos requeridos para XHTML 1.1. Por exemplo, se um documento é estendido para usar o módulo XHTML Frames (frameset), ele também pode ser descrito como XHTML 1.1, mas não ''estritamente conforme'' o XHTML 1.1. Ao invés disso, ele deve ser descrito como um XHTML Host Language Conforming Document,<ref>[http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/conformance.html#s_conform_document XHTML Host Language Conforming Document]</ref> se a ferramenta for relevante e necessária.
Linha 175:
* HTML frames will be replaced by [[XFrames]].
* The [[DOM Events]] will be replaced by [[XML Events]], which uses the XML [[Document Object Model]].
* A new list element type, the
* Any element will be able to act as a [[hyperlink]], e.g.,
* Any element will be able to reference alternative media with the
</nowiki></code> is the same as
London Bridge
</object></nowiki></code>.
* The
* A single heading element (<code>h</code>) will be added. The level of these headings will be indicated by the nested
* The remaining presentational elements
* The addition of RDF triple with the
-->
=== HTML5 (esboço) ===
Em [[10 de abril]] de [[2007]], a [[Fundação Mozilla]], [[Apple Inc.]] e [[Opera Software]] propuseram<ref>{{citar web
|url=http://lists.w3.org/Archives/Public/public-html/2007Apr/0429.html
|titulo=Proposal to Adopt HTML5 from Maciej Stachowiak on 2007-04-10 (public-html@w3.org from April 2007)
Linha 220:
; XHTML 1.0 Strict
:
; XHTML 1.0 Transitional
:
; XHTML 1.0 Frameset
:
; XHTML 1.1
:
; XHTML5
XHTML5 does not require a doctype, and XHTML5 validation is not DTD-based.
; XHTML 2.0
XHTML 2.0, [[As of August 2006]], is in a draft phase. If an XHTML 2.0 Recommendation is published with the same document type declaration as in the current Working Draft, the declaration will appear as:
:
/>"<nowiki>http://www.w3.org/MarkUp/DTD/xhtml2.dtd</nowiki>"></code>
A placeholder DTD schema exists at the corresponding URI, though it currently only includes the character reference entities from previous recommendations. XHTML 2 contemplates both a
==== XML namespaces and schemas ====
In addition to the DOCTYPE, all XHTML elements must be in the appropriate [[XML namespace]] for the version being used. This is usually done by declaring a default namespace on the root element using
For XHTML 1.0, XHTML 1.1 and XHTML5, this is
:
XHTML 2.0 requires both a namespace and an [[XML Schema]] instance declaration. These might be declared as
:
/>xmlns:xsi="<nowiki>http://www.w3.org/2001/XMLSchema-instance</nowiki>"<br
/>xsi:schemaLocation="<nowiki>http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd</nowiki>"></code>
This example for XHTML 2.0 also demonstrates the use of multiple namespaces within a document. The first
Similar to the case of DOCTYPE above, the actual URL to the [[XML Schema]] file can be changed, as long as the [[Universal Resource Identifier]] (URI) before it (which indicates the XHTML 2.0 namespace) remains the same. The namespace URI is intended to be a persistent and universally unique identifier for the particular version of the specification. If treated as a URL, the actual content located at the site is of no significance.
==== XML Declaration ====
A [[character encoding]] may be specified at the beginning of an XHTML document in the XML declaration when the document is served using the
For example:
:
The declaration may be optionally omitted because it declares as its encoding the default encoding. However, if the document instead makes use of XML 1.1 or another character encoding, a declaration is necessary. [[Internet Explorer]] prior to version 7 enters [[quirks mode]] if it encounters an XML declaration in a document served as
=== Common errors ===
Linha 264:
* Failing to realize that documents won’t be treated as XHTML unless they are served with an appropriate XML [[Internet media type|MIME type]]
* Not closing empty elements (elements without closing tags in HTML4)
** Incorrect:
** Correct:
* Not closing non-empty elements
** Incorrect:
This is a paragraph.
This is another paragraph.</nowiki></code>
** Correct:
This is a paragraph.
Linha 280:
</nowiki></code>
* Improperly nesting elements (elements must be closed in reverse order)
** Incorrect:
** Correct:
* Not putting quotation marks around attribute values
** Incorrect:
** Correct:
** Correct:
* Using the ampersand outside of entities (use
** Incorrect:
** Correct:
* Using the ampersand outside of entities in [[Uniform Resource Locator|URL]]s (use
** Incorrect:
** Correct:
* Failing to recognize that XHTML elements and attributes are case sensitive
** Incorrect:
</BODY></nowiki></code>
** Correct:
</body></nowiki></code>
* Using attribute minimization
** Incorrect:
** Correct:
* Mis-using CDATA, script-comments and xml-comments when embedding scripts and stylesheets.
** This problem can be avoided altogether by putting all script and stylesheet information into separate files and referring to them as follows in the XHTML
<pre>
<link rel="stylesheet" href="/style/screen.css" type="text/css" />
Linha 309:
</pre>
:: Note: The format
** If an author chooses to include script or style data inline within an XHTML document, different approaches are recommended depending whether the author intends to serve the page as
:: In the fully conformant
<pre><nowiki>
p { color: green; }
]]>
function nothing() { }
]]>
</nowiki></pre>
:: If the same file may be served or processed as both XML (<code>application/xhtml+xml</code>) and HTML compatible
<pre><nowiki>
p { color: green; }
/*]]>*/-- >
function nothing() { }
//-- ><!]]>
</nowiki></pre>
Linha 347:
<pre><nowiki>
/*<![CDATA[*/
p { color: green; }
/*]]>*/
//<![CDATA[
function nothing() { }
//]]>
</nowiki></pre>
== Backward compatibility ==
XHTML 1.0 documents are mostly backward compatible with HTML — that is, processible as HTML by a web browser that does not know how to properly handle XHTML — when authored according to certain guidelines given in the specification and served as
Documents following the compatibility guidelines are still not truly compatible with HTML user agents that support the [[SGML]] ''NET'' (Null End Tag) construct, although very few user agents support it in practice. [[OpenSP]] is one such user agent.
Linha 396:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
function loadpdf() {
document.getElementById("pdf-object").src="http://www.w3.org/TR/xhtml1/xhtml1.pdf";
}
//-- ><!]]>
This is an example of an
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" /><br />
name="pdf-object"
type="application/pdf"
Linha 421:
width="100%"
height="500">
</html>
</source>
Linha 434:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
function loadpdf() {
document.getElementById("pdf-object").src="http://www.w3.org/TR/xhtml1/xhtml1.pdf";
}
]]>
This is an example of an
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict"/><br />
name="pdf-object"
type="application/pdf"
Linha 460:
</html>
</source>
Linha 466:
Notes:
# For further information on the media type recommendation, please refer to [http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/ XHTML Media Types], a W3C Note issued on 2002-08-01.
# The "loadpdf" function is actually a workaround for Internet Explorer. It can be replaced by adding
# The
-->
Linha 493:
{{Referências}}
==
* [[HTML]]
* [[XML]]
Linha 499:
* [[Cascading Style Sheets]]
==
{{Wikilivros|Curso de HTML}}
* {{link|en|http://www.w3.org/MarkUp/|W3C's XHTML}}
|