diff options
Diffstat (limited to 'files/pt-pt/web/xml/xml_introduction/index.html')
-rw-r--r-- | files/pt-pt/web/xml/xml_introduction/index.html | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/files/pt-pt/web/xml/xml_introduction/index.html b/files/pt-pt/web/xml/xml_introduction/index.html new file mode 100644 index 0000000000..c4820a1245 --- /dev/null +++ b/files/pt-pt/web/xml/xml_introduction/index.html @@ -0,0 +1,204 @@ +--- +title: Introdução à XML +slug: Web/XML/Introducao_a_XML +tags: + - Introdução + - Principiante + - XML +translation_of: Web/XML/XML_introduction +--- +<p><span class="seoSummary">XML é uma linguagem de marcação similar à HTML. It stands for Extensible Markup Language and is a <a class="external" href="/web/20150905131205/http://www.w3.org/">W3C recommended</a> specification as a general purpose markup language. This means, unlike other markup languages, XML is not predefined so you must define your own tags. The primary purpose of the language is the sharing of data across different systems, such as the Internet.</span></p> + +<p>There are many languages based on XML; Some examples are <a href="/en-US/docs/Glossary/XHTML" title="en/XHTML">XHTML</a>, <a href="/en-US/docs/Web/MathML" title="en/MathML">MathML</a>, <a href="/en-US/docs/Web/SVG" title="en/SVG">SVG</a>, <a href="/en-US/docs/Mozilla/Tech/XUL" title="en/XUL">XUL</a>, <a href="/en-US/docs/Mozilla/Tech/XBL" title="en/XBL">XBL</a>, <a href="/en-US/docs/Web/RSS" title="en/RSS">RSS</a>, and <a href="/en-US/docs/Web/RDF" title="en/RDF">RDF</a>. You can also create your own.</p> + +<h2 id="Correct_XML_(valid_and_well-formed)">"Correct" XML (valid and well-formed)</h2> + +<p>For an XML document to be correct it must be a well-formed document, conforming to all of XML's syntax rules, and valid, conforming to a specific language's rules. An example of a document that is not well formed is one with an element that has an opening tag with no closing tag and is not self-closing.</p> + +<h3 id="Exemplo">Exemplo</h3> + +<p>In the below example, we see a document in which a tag that isn't self-closing has no closing tag.</p> + +<pre class="brush: xml"><message> + <warning> + Hello World + <!--missing </warning> --> +</message> +</pre> + +<p>Now let's look at a corrected version of that same document:</p> + +<pre class="brush: xml"><message> + <warning> + Hello World + </warning> +</message> +</pre> + +<p>To be valid, an XML document needs to conform to some semantic rules which are usually set in an XML schema or a <strong><a href="/en-US/docs/Glossary/DTD" title="en/DTD">Document Type Definition</a></strong> (DTD). A document that contains an undefined tag is invalid. For example, if we never defined the <code><warning></code> tag, the document above wouldn't be valid.</p> + +<div class="note"> +<p>Most browsers offer a debugger that can identify poorly-formed XML documents.</p> +</div> + +<h2 id="Entities" name="Entities">Entidades</h2> + +<p>Like HTML, XML offers methods (called entities) for referring to some special reserved characters (such as a greater than sign which is used for tags). There are five of these characters that you should know:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Entidade</th> + <th scope="col">Cárater</th> + <th scope="col">Descrição</th> + </tr> + </thead> + <tbody> + <tr> + <td>&lt;</td> + <td><</td> + <td>Less than sign</td> + </tr> + <tr> + <td>&gt;</td> + <td>></td> + <td>Greater than sign</td> + </tr> + <tr> + <td>&amp;</td> + <td>&</td> + <td>Ampersand</td> + </tr> + <tr> + <td>&quot;</td> + <td>"</td> + <td>One double-quotation mark</td> + </tr> + <tr> + <td>&apos;</td> + <td>'</td> + <td>One apostrophe (or single-quotation mark)</td> + </tr> + </tbody> +</table> + +<p>Even though there are only 5 declared entities, more can be added using the document's <a href="/en-US/docs/Glossary/DTD" title="en/DTD">Document Type Definition</a>. For example, to create a new <code>&warning;</code> entity, you can do this:</p> + +<pre><?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE body [ + <!ENTITY warning "Warning: Something bad happened... please refresh and try again."> +]> +<body> + <message> &warning; </message> +</body> +</pre> + +<p>You can also use numeric character references to specify special characters; for example, &#xA9; is the "©" symbol.</p> + +<h2 id="Exibir_XML">Exibir XML</h2> + +<p>XML is usually used for descriptive purposes, but there are ways to display XML data. If you don't define a specific way for the XML to be rendered, the raw XML is displayed in the browser.</p> + +<p>One way to style XML output is to specify <a href="/en-US/docs/Web/CSS" title="en/CSS">CSS</a> to apply to the document using the <code>xml-stylesheet</code> processing instruction.</p> + +<pre><?xml-stylesheet type="text/css" href="stylesheet.css"?></pre> + +<p>There is also another more powerful way to display XML: the <strong>Extensible Stylesheet Language Transformations</strong> (<a href="/en-US/docs/Web/XSLT" title="en/XSLT">XSLT</a>) which can be used to transform XML into other languages such as HTML. This makes XML incredibly versatile.</p> + +<pre><?xml-stylesheet type="text/xsl" href="transform.xsl"?></pre> + +<h2 id="Recommendations" name="Recommendations">Recomendações</h2> + +<p>This article is obviously only a very brief introduction to what XML is, with a few small examples and references to get you started. For more details about XML, you should look around on the Web for more in-depth articles.</p> + +<p>Learning the HyperText Markup Language (<a href="/en-US/docs/Web/HTML" title="en/HTML">HTML</a>) will help you better understand XML.</p> + +<h2 id="Consulte_também">Consulte também</h2> + +<ul> + <li><a class="external" href="http://www.xml.com/">XML.com</a></li> + <li><a class="external" href="https://www.w3.org/XML/">Extensible Markup Language (XML) @ W3.org</a></li> + <li><a class="external" href="http://www.alistapart.com/d/usingxml/xml_uses_a.html">XML Example: A List Apart</a></li> + <li><a class="external" href="http://www.alistapart.com/articles/usingxml/">Using XML: A List Apart</a></li> +</ul> + +<p>O artigo <a href="http://www.alistapart.com/articles/usingxml/"><em>Using</em> XML</a> acima, é um grande recurso de informação para transformar e criar a sua própria linguagem.</p> + +<div id="SL_balloon_obj" style="display: block;"> +<div class="SL_ImTranslatorLogo" id="SL_button" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%; opacity: 0; display: none; left: -8px; top: -25px; transition: visibility 2s ease 0s, opacity 2s linear 0s;"> </div> + +<div id="SL_shadow_translation_result2" style="display: none;"> </div> + +<div id="SL_shadow_translator" style="display: none;"> +<div id="SL_planshet"> +<div id="SL_arrow_up" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;"> </div> + +<div id="SL_Bproviders"> +<div class="SL_BL_LABLE_ON" id="SL_P0" title="Google">G</div> + +<div class="SL_BL_LABLE_ON" id="SL_P1" title="Microsoft">M</div> + +<div class="SL_BL_LABLE_ON" id="SL_P2" title="Translator">T</div> +</div> + +<div id="SL_alert_bbl" style="display: none;"> +<div id="SLHKclose" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;"> </div> + +<div id="SL_alert_cont"> </div> +</div> + +<div id="SL_TB"> +<table id="SL_tables"> + <tbody><tr> + <td class="SL_td"><input></td> + <td class="SL_td"><select><option value="auto">Detectar idioma</option><option value="af">Africâner</option><option value="sq">Albanês</option><option value="de">Alemão</option><option value="ar">Arabe</option><option value="hy">Armênio</option><option value="az">Azerbaijano</option><option value="eu">Basco</option><option value="bn">Bengali</option><option value="be">Bielo-russo</option><option value="my">Birmanês</option><option value="bs">Bósnio</option><option value="bg">Búlgaro</option><option value="ca">Catalão</option><option value="kk">Cazaque</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh-CN">Chinês (Simp)</option><option value="zh-TW">Chinês (Trad)</option><option value="si">Cingalês</option><option value="ko">Coreano</option><option value="ht">Crioulo haitiano</option><option value="hr">Croata</option><option value="da">Dinamarquês</option><option value="sk">Eslovaco</option><option value="sl">Esloveno</option><option value="es">Espanhol</option><option value="eo">Esperanto</option><option value="et">Estoniano</option><option value="fi">Finlandês</option><option value="fr">Francês</option><option value="gl">Galego</option><option value="cy">Galês</option><option value="ka">Georgiano</option><option value="el">Grego</option><option value="gu">Gujarati</option><option value="ha">Hauça</option><option value="iw">Hebraico</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="nl">Holandês</option><option value="hu">Húngaro</option><option value="ig">Igbo</option><option value="id">Indonésio</option><option value="en">Inglês</option><option value="yo">Ioruba</option><option value="ga">Irlandês</option><option value="is">Islandês</option><option value="it">Italiano</option><option value="ja">Japonês</option><option value="jw">Javanês</option><option value="kn">Kannada</option><option value="km">Khmer</option><option value="lo">Laosiano</option><option value="la">Latim</option><option value="lv">Letão</option><option value="lt">Lituano</option><option value="mk">Macedônico</option><option value="ml">Malaiala</option><option value="ms">Malaio</option><option value="mg">Malgaxe</option><option value="mt">Maltês</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongol</option><option value="ne">Nepalês</option><option value="no">Norueguês</option><option value="fa">Persa</option><option value="pl">Polonês</option><option value="pt">Português</option><option value="pa">Punjabi</option><option value="ro">Romeno</option><option value="ru">Russo</option><option value="sr">Sérvio</option><option value="st">Sesotho</option><option value="so">Somália</option><option value="sw">Suaíli</option><option value="su">Sudanês</option><option value="sv">Sueco</option><option value="tg">Tadjique</option><option value="tl">Tagalo</option><option value="th">Tailandês</option><option value="ta">Tâmil</option><option value="cs">Tcheco</option><option value="te">Telugo</option><option value="tr">Turco</option><option value="uk">Ucraniano</option><option value="ur">Urdu</option><option value="uz">Uzbeque</option><option value="vi">Vietnamita</option><option value="yi">Yiddish</option><option value="zu">Zulu</option></select></td> + <td class="SL_td"> + <div id="SL_switch_b" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Alternar Idiomas"> </div> + </td> + <td class="SL_td"><select><option value="af">Africâner</option><option value="sq">Albanês</option><option value="de">Alemão</option><option value="ar">Arabe</option><option value="hy">Armênio</option><option value="az">Azerbaijano</option><option value="eu">Basco</option><option value="bn">Bengali</option><option value="be">Bielo-russo</option><option value="my">Birmanês</option><option value="bs">Bósnio</option><option value="bg">Búlgaro</option><option value="ca">Catalão</option><option value="kk">Cazaque</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh-CN">Chinês (Simp)</option><option value="zh-TW">Chinês (Trad)</option><option value="si">Cingalês</option><option value="ko">Coreano</option><option value="ht">Crioulo haitiano</option><option value="hr">Croata</option><option value="da">Dinamarquês</option><option value="sk">Eslovaco</option><option value="sl">Esloveno</option><option value="es">Espanhol</option><option value="eo">Esperanto</option><option value="et">Estoniano</option><option value="fi">Finlandês</option><option value="fr">Francês</option><option value="gl">Galego</option><option value="cy">Galês</option><option value="ka">Georgiano</option><option value="el">Grego</option><option value="gu">Gujarati</option><option value="ha">Hauça</option><option value="iw">Hebraico</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="nl">Holandês</option><option value="hu">Húngaro</option><option value="ig">Igbo</option><option value="id">Indonésio</option><option selected value="en">Inglês</option><option value="yo">Ioruba</option><option value="ga">Irlandês</option><option value="is">Islandês</option><option value="it">Italiano</option><option value="ja">Japonês</option><option value="jw">Javanês</option><option value="kn">Kannada</option><option value="km">Khmer</option><option value="lo">Laosiano</option><option value="la">Latim</option><option value="lv">Letão</option><option value="lt">Lituano</option><option value="mk">Macedônico</option><option value="ml">Malaiala</option><option value="ms">Malaio</option><option value="mg">Malgaxe</option><option value="mt">Maltês</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongol</option><option value="ne">Nepalês</option><option value="no">Norueguês</option><option value="fa">Persa</option><option value="pl">Polonês</option><option value="pt">Português</option><option value="pa">Punjabi</option><option value="ro">Romeno</option><option value="ru">Russo</option><option value="sr">Sérvio</option><option value="st">Sesotho</option><option value="so">Somália</option><option value="sw">Suaíli</option><option value="su">Sudanês</option><option value="sv">Sueco</option><option value="tg">Tadjique</option><option value="tl">Tagalo</option><option value="th">Tailandês</option><option value="ta">Tâmil</option><option value="cs">Tcheco</option><option value="te">Telugo</option><option value="tr">Turco</option><option value="uk">Ucraniano</option><option value="ur">Urdu</option><option value="uz">Uzbeque</option><option value="vi">Vietnamita</option><option value="yi">Yiddish</option><option value="zu">Zulu</option></select></td> + <td class="SL_td"> + <div id="SL_TTS_voice" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Ouça"> </div> + </td> + <td class="SL_td"> + <div class="SL_copy" id="SL_copy" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Copiar"> </div> + </td> + <td class="SL_td"> + <div id="SL_bbl_font_patch"> </div> + + <div class="SL_bbl_font" id="SL_bbl_font" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Tamanho da fonte"> </div> + </td> + <td class="SL_td"> + <div id="SL_bbl_help" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Ajuda"> </div> + </td> + <td class="SL_td"> + <div class="SL_pin_off" id="SL_pin" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Fixar a janela de pop-up"> </div> + </td> + </tr> +</tbody></table> +</div> +</div> + +<div id="SL_shadow_translation_result" style=""> </div> + +<div class="SL_loading" id="SL_loading" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;"> </div> + +<div id="SL_player2"> </div> + +<div id="SL_alert100">A função de fala é limitada a 200 caracteres</div> + +<div id="SL_Balloon_options" style="background: rgb(255, 255, 255) repeat scroll 0% 0%;"> +<div id="SL_arrow_down" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;"> </div> + +<table id="SL_tbl_opt" style="width: 100%;"> + <tbody><tr> + <td><input></td> + <td> + <div id="SL_BBL_IMG" style="background: rgba(0, 0, 0, 0) repeat scroll 0% 0%;" title="Mostrar o botão do ImTranslator 3 segundos"> </div> + </td> + <td><a class="SL_options" title="Mostrar opções">Opções</a> : <a class="SL_options" title="Histórico de tradução">Histórico</a> : <a class="SL_options" title="Comentários">Comentários</a> : <a class="SL_options" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GD9D8CPW8HFA2" title="Faça sua contribuição">Donate</a></td> + <td><span id="SL_Balloon_Close" title="Encerrar">Encerrar</span></td> + </tr> +</tbody></table> +</div> +</div> +</div> |