philipnaparan

XML – Video Tutorial Basic



Description: XML – Video Tutorial Basic

Topics: Variables and Code for Calculations

 

01 Introduction

XML stands for Extensible Markup Language and is a language used for describing data. Moreover, XML was not designed to do anything. Instead, it is used by other languages to structure, store, and exchange data. The markup tags in XML are not predefined as they are in HTML. This is why it’s called an extensible language, because you can create your own markup tags. By defining valid tags and semantic – either using a document type definition (DTD) or its successor the XML Schema – it’s possible to create new languages with XML. Some examples of languages specified in XML are: XHTML, SOAP, and RSS.


02 Syntax Rules I


To make an XML document create an empty text file and give it a .xml file extension. The first line in the document must be the XML declaration. This line defines the XML version and the character encoding used in the document.

<?xml version="1.0" encoding="UTF-8"?>

This XML document will describe a book so the first tag is called book. Just as in XHTML the tags are recognized by the angle brackets and all tags must have a closing tag (except for the XML declaration). Unlike HTML, XML tags are not predefined. Any tag names can be used, but they shouldn’t contain spaces or start with numbers or punctuations. Either upper or lower case letters can be used, as long as the opening and closing tags have same casing.

<?xml version="1.0" encoding="UTF-8"?>
<book></book>

This first element is called the root element and each XML document can have only one of them. Inside the root two child elements are included: title and chapter. These are sister elements to each other, because they have the same parent element. All elements can contain both text and child elements.

<?xml version="1.0" encoding="UTF-8"?>
<book>
  <title>Learning XML</title>

  <chapter>What is XML</chapter>
</book>



03 Syntax Rules II

 

XML documents use a very simple and self-describing syntax. If you open up the document created in the previous section in a browser it will be displayed as a tree without any stylistic formatting. It is just data wrapped in tags. To make any use of the file a program has to be written that accesses the data.

<?xml version="1.0" encoding="UTF-8"?>

<book>
  <title>Learning XML</title>
  <chapter>What is XML</chapter>
</book>

Keep in mind that XML has very strict rules regarding its structure. If there is an error in the document, for example if a closing tag has been nested improperly, the browser will report the error and won’t display the document.

<a></a><b>Allowed</b>
<a><b>Allowed</b></a>
<a><b>Invalid</a></b>

Content types


Elements can have four different content types. Below the title element has simple content, which is also called text content. Book has element content, because it contains only elements and no text. Chapter has mixed content, because it contains both text and elements. Finally, the para tag has empty content. Elements with empty content can also be shortened as in XHTML, by removing the end tag and including a slash before the closing bracket of the start tag.

<?xml version="1.0" encoding="UTF-8"?>
<book>

  <title>Text content</title>
  <chapter>Mixed content
    <para></para>
    <para />
  </chapter>

</book>







Rate this topic:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Popularity: 636 views
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment



XML – Video Tutorial Basic Copyright: You should confirm all information about XML – Video Tutorial Basic full version edition(freeware/shareware) before downloading or relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators or key gen, cd key, hacks, dvd rip is illegal and prevent future development of XML – Video Tutorial Basic full version edition. Download links are directly from our publisher sites or from the link provided by users, torrent files or links from rapidshare.com, yousendit.com, megaupload.com, netload.in, storage.to or depositfiles.com are not allowed.