Technology

3 XML Examples

XML is the acronym for Extensible Markup Language or Extensible Markup Language , but it is not really a language . It is a model that allows us to define and organize markup languages ​​such as HTML .

Related Articles

Since its birth in 1998 it has been given a language treatment, however, the most correct definition is: meta-language. Through XML, a specific use can be given to HTML and other languages, so this is a way to design and make the codes generated in the markup languages ​​more effective and reusable, providing tags that are adaptable to each case.

Elements of an XML document

XML helps improve the way in which documents on a website are viewed, stored, processed, printed and transmitted, since it generates a fairly digestible structure for all languages.

Elements : it is the data or character string that is between the labels used, although sometimes the labels do not have any elements, such is the case of <br/>, which is a line break.

Instructions : Begin with <? And they end with ?> . They are the orders that the application that processes the code must follow.

<? xml-stylesheet type = “text / css” href = “style.css”>

Comments : those that serve for the programmer (s) to describe a function or leave instructions for future editors of the code. They start with <! – and end with -> .

Type declarations : it is the header of the document that provides information about it.

<! DOCTYPE persona SYSTEM “persona.dtd”>

CDATA sections : it is a section in which we can write everything that we do not want to be processed as an instruction or simply interpreted by the servers.

<! [CDATA [anything]]>

XML examples

Example 1: RSS feed with 1 item

<? xml version = »1.0 ″ encoding =» ISO-8859-1 ″?>

<rss version = »2.0 ″>

<channel>

<title> RSS Channel Title </title>

<link> http://www.tublog.com </link>

<description> Description of your blog channel </description>

<language> en-US </language>

<image>

<title> Image Title </title>

<url> http://www.tublog.com/logotype-del-rss.png </url>

<link> http://www.tublog.com </link>

<width> 90 </width>

<height> 36 </height>

</image>

<item>

<title> Title of the first article </title>

<link> http://www.tublog.com/ruta/articulo/first.html </link>

<description>

A summary of the content of the post. It can be at least two lines. </description>

</item>

</channel>

</rss>

Example 2: Movie Database

<? xml version = ”1.0” standalone = ”no”?>

<! DOCTYPE SYSTEM series “series.dtd”>

<series>

<series type = ”comedy” system = ”PG-14” copies = ”5” year = “1987”>

<title> The Nany </title>

<producer> Fran Drescher </producer>

<director> Peter Marc Jacobson </director>

<actor> Fran Drescher </actor>

<actor> Charles Shaughnessy </actor>

</series>

Example 3: Taxonomy

<? xml version = ”1.0” standalone = ”no”?>

<! DOCTYPE taxonomy SYSTEM “taxonomy.dtd”>

<taxonomy>

<page title = »Manuals»>

<page title = »Policies and Procedures»>

<page title = »Employees» />

<page title = »Students» />

</page>

<page title = »Financial Aid» />

<page title = »Forms» />

</page>

<page title = »Library»>

<page title = »News» />

<page title = »Reference Manuals» />

<page title = »Internet access» />

</page>

<page title = »Lost Property»>

</page>

</taxonomy>

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button