{"id":243,"date":"2024-05-21T10:04:23","date_gmt":"2024-05-21T08:04:23","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=243"},"modified":"2024-05-21T10:04:23","modified_gmt":"2024-05-21T08:04:23","slug":"52-html-vs-xhtml","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/html5\/html5-manual\/52-html-vs-xhtml\/","title":{"rendered":"52. HTML VS XHTML"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Qu\u00e9 es XHTML<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>XHTML<\/strong> significa <strong>Lenguaje de marcado de hipertexto EXtensible<\/strong><\/li>\n\n\n\n<li><strong>XHTML<\/strong> es una versi\u00f3n de <strong>HTML<\/strong> m\u00e1s estricta y m\u00e1s basada en <strong>XML<\/strong>.<\/li>\n\n\n\n<li><strong>XHTML<\/strong> es <strong>HTML<\/strong> definido como una aplicaci\u00f3n <strong>XML<\/strong><\/li>\n\n\n\n<li><strong>XHTML<\/strong> es compatible con todos los principales navegadores<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Por qu\u00e9 XHTML?<\/h2>\n\n\n\n<p><strong>XML<\/strong> es un lenguaje de marcas en el que todos los documentos deben marcarse correctamente (estar \u00abbien formados\u00bb).<\/p>\n\n\n\n<p><strong>XHTML<\/strong> fue desarrollado para hacer <strong>HTML<\/strong> m\u00e1s extensible y flexible para trabajar con otros formatos de datos (como <strong>XML<\/strong>). Adem\u00e1s, los navegadores ignoran los errores en las p\u00e1ginas <strong>HTML<\/strong> e intentan mostrar el sitio web incluso si tiene algunos errores en el marcado. Entonces <strong>XHTML<\/strong> viene con un manejo de errores mucho m\u00e1s estricto.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Las m\u00e1s importantes diferencias entre HTML y XHTML<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><em>&lt;!DOCTYPE><\/em><\/strong> es obligatorio<\/li>\n\n\n\n<li>El atributo <strong><em>xmlns<\/em> <\/strong>en <strong><em>&lt;html><\/em><\/strong> es obligatorio<\/li>\n\n\n\n<li><strong><em>&lt;html><\/em><\/strong>, <strong><em>&lt;head><\/em><\/strong>, <strong><em>&lt;title><\/em><\/strong> y <strong><em>&lt;body><\/em><\/strong> son obligatorios<\/li>\n\n\n\n<li>Los elementos siempre deben estar correctamente anidados<\/li>\n\n\n\n<li>Los elementos siempre deben estar cerrados.<\/li>\n\n\n\n<li>Los elementos siempre deben estar en min\u00fasculas<\/li>\n\n\n\n<li>Los nombres de los atributos siempre deben estar en min\u00fasculas<\/li>\n\n\n\n<li>Los valores de los atributos siempre se deben citar<\/li>\n\n\n\n<li>La minimizaci\u00f3n de atributos est\u00e1 prohibida.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">XHTML &#8211; &lt;!DOCTYPE &#8230;.&gt; es obligatorio<\/h2>\n\n\n\n<p>Un documento <strong>XHTML<\/strong> debe tener una declaraci\u00f3n XHTML <strong><em>&lt;!DOCTYPE&gt;<\/em><\/strong>.<\/p>\n\n\n\n<p>Los elementos <strong><em>&lt;html&gt;<\/em><\/strong>, <strong><em>&lt;head&gt;<\/em><\/strong>, <strong><em>&lt;title&gt;<\/em><\/strong> y <strong><em>&lt;body&gt;<\/em><\/strong> tambi\u00e9n deben estar presentes, y el atributo <em><strong>xmlns<\/strong> <\/em>en <strong><em>&lt;html&gt;<\/em><\/strong> debe especificar el espacio de nombres <strong>xml<\/strong> para el documento.<\/p>\n\n\n\n<p><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;!DOCTYPE&nbsp;html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.1\/\/EN\"\n\"http:\/\/www.w3.org\/TR\/xhtml11\/DTD\/xhtml11.dtd\"&gt;\n&lt;html&nbsp;xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"&gt;\n&lt;head&gt;\n&nbsp;&nbsp;&lt;title&gt;Title of document&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&nbsp;&nbsp;<em>some content here...<\/em>\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Los elementos <strong>XHTML<\/strong> deben estar correctamente anidados<\/li>\n\n\n\n<li>En <strong>XHTML<\/strong> los elementos deben cerrarse obligatoriamente<\/li>\n\n\n\n<li>Los elementos <strong>XHTML<\/strong> vac\u00edos tambi\u00e9n deben cerrarse obligatoriamente<\/li>\n\n\n\n<li>Los elementos <strong>XHTML<\/strong> deben escribirse en min\u00fasculas<\/li>\n\n\n\n<li>Los atributos de los elementos <strong>XHTML<\/strong> deben escribirse obligatoriamente en min\u00fascula<\/li>\n\n\n\n<li>Los valores de los atributos en <strong>XHTML<\/strong> deben estar acotados<\/li>\n\n\n\n<li>La minimizaci\u00f3n de atributos <strong>XHTML<\/strong> est\u00e1 prohibida<\/li>\n<\/ul>\n\n\n\n<p>Para el \u00faltimo apartado la sintaxis correcta ser\u00eda<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;input&nbsp;type=\"checkbox\"&nbsp;name=\"vehicle\"&nbsp;value=\"car\"&nbsp;checked=\"checked\"&nbsp;\/&gt;\n&lt;input&nbsp;type=\"text\"&nbsp;name=\"lastname\"&nbsp;disabled=\"disabled\"&nbsp;\/&gt;<\/pre>\n\n\n\n<p>Y la incorrecta ser\u00eda<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;input&nbsp;type=\"checkbox\"&nbsp;name=\"vehicle\"&nbsp;value=\"car\"&nbsp;checked \/&gt;\n&lt;input&nbsp;type=\"text\"&nbsp;name=\"lastname\"&nbsp;disabled \/&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Qu\u00e9 es XHTML Por qu\u00e9 XHTML? XML es un lenguaje de marcas en el que todos los documentos deben marcarse [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":41,"menu_order":51,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-243","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Sutil Web","author_link":"https:\/\/sutilweb.eu\/index.php\/author\/sutilweb\/"},"uagb_comment_info":0,"uagb_excerpt":"Qu\u00e9 es XHTML Por qu\u00e9 XHTML? XML es un lenguaje de marcas en el que todos los documentos deben marcarse [&hellip;]","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":2,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/243\/revisions"}],"predecessor-version":[{"id":245,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/243\/revisions\/245"}],"up":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/41"}],"wp:attachment":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/media?parent=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}