What you read, in this first part is a collection of information taken from several links. You can find them in the References section.
Introduction to XML
Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879).XML code is similar to Hypertext Markup Language (HTML). Both XML and HTML contain markup symbols to describe page or file contents. HTML code describes Web page content (mainly text and graphic images) only in terms of how it is to be displayed and interacted with.
Also, while HTML is not case-sensitive, XML it is.
The basic building block of an XML document is an element, defined by tags. An element has a beginning and an ending tag. All elements in an XML document are contained in an outermost element known as the root element. XML can also support nested elements or elements within elements. This ability allows XML to support hierarchical structures. Element names describe the content of the element, and the structure describes the relationship between the elements.
XML is much more accurate than HTML when it comes to closing tags: each one always has a closure.
Tags can also be defined as empty tags but their syntax is <TAG/>
Elements can be better characterized by specifying a list of attributes.
So we have a "start-tag" (STag), an "end-tag" (ETag) and a "tags for for Empty Elements" (EmptyElemTag). We can define them as
STag ::= <Name (Attribute)>
ETag ::= </Name>
EmptyElemTag ::= <Name (Attribute)/>
(As DBA, common queries do not use the EmptyElemTag, but I report it because it is a simple concept and it shows the difference against HTML).
There is always a prologue and is very important: it contains useful guidelines for programs that will use the document. Specifically, the XML document begins with '<' ?xml version=“1.0”? '>'
XML example:
The text: "Rex Stout was an American author of many yellow novels featuring famous Nero Wolfe and his aide and storyteller Archie Goodwin."
become
<?xml version=“1.0”?><author nationality="US" ><name>Rex</name> <surname>Stout</surname> </author> was an American author of many<genere> yellow novels </genere>featuring famous <protagonist><name>Nero</name> <surname>Wolfe&</surname></ protagonist> and his aide and storyteller <storyteller> <protagonist><name>Archie</name> <surname>Goodwin</surname></protagonist></storyteller>.
Graphic view of an XML tree |
Nessun commento:
Posta un commento