Table of Contents
The basics of the XML language is contained in many notes and books, so we will not cover in details here, we just turn the key points. Necessary to know the basic structure and the field of meta-modeling used to process XML documents. We need to know which center on XML technologies and feel to know that a given context is created, or rather with a combination of technologies built around XML into the language. These skills are now only a schematic overview will be described in what you start with , what are the objectives of the XML :
be easy to use in (web)applications,
support a wide range of applications,
be compatible with SGML,
be easy to write programs for processing XML documents,
human -readable , structured documents are clear ,
be easy to create XML documents .
Of course, these goals are not only blind to the world appeared , but many - are still existing - problems were brought to life. These include identified by the W3C (World Wide Web Consortium) problem areas , such as the rapidly growing content , and versus a content access methods , which are still more focused on the appearance rather than the content itself . This created the need for a new Web, which is capable of understanding the content , supporting efficient access to information. The same has been passed more than a decade, the Semantic Web idea to conception, unfortunately, still has not been a widely accepted technology. The opportunity lies hidden in it, but have to wait for the accomplishment. However, the rise of computers power of increasing growth, can open the way for a brute-force search length of survival.
Equally problematic content, the structure structural handling of documents. XML is here to provide substantial progress since the 80’s SGML (ISO) standard also provides a free grammar, but the implementation is complicated and expensive. Conversely, XML is considered for simplification of SGML and therefore 'less expensive' item.
Which in turn should not draw parallels to HTML. Even if it is so similar to an HTML and XML documents, there are huge differences between them. The HTML:
concentrate on display,
can not be expanded notation
loose (non-standard) syntax treatment.
In contrast, XML:
strict syntax verification,
expandable,
content-oriented notation.
After that, if you are a little broader attempt to interpret what is XML, the format is simple text document but include such meta-language family of standards and technology as well. Attention for a number of document formats to XML:
de facto: DOCX, PDF, RDF, ...
de jure: HTML, SGML, XML, ODF, ...
We can see that either text or structured documents can be created. While the former focuses on the presentation (word processing and presentation), while the structural focuses on content and access to information (for the transmission, and storage). Here is an example of a text format:
<section>
<head>A major section</head>
<subsection>
<head>A cute little section</head>
<paragraph>
<para>
<person>R. Buckminster Fuller</person>
once said,
<quote>When people learned to do <emphasis>more</emphasis> with
<emphasis>less</emphasis>, it was their lever to industrial success.
</quote>
</para>
</paragraph>
</subsection>
</section>
We can see in the example that the document has some kind of structuring, but where the content itself appears it shows no structuring anymore. In contrast, documents that are for data interchange always have a strict structure. This way they can be processed with a computer. (The example is a very stripped edition. In reality many extra pieces of information appear in each item’s description.
XML, as a meta language,can be used to describe languages which is determined by tags and structures (vocabulary and grammar). The most common examples are DTD (Document Type Definition) and XML Schema. These are discussed later.
XML, as a family of standards, is made up of basic standards by several standardization organizations. Let’s see a few examples of these standards without attempting to be comprehensive:
ISO/IEC JTC 1 standards:
Standard Generalized Markup Language (SGML)
Document Schema Definition Languages (DSDL) - defining the DTD and XML Schema-t
HyperText Markup Language (HTML)
Open Document Format for Office Applications (ODT) v1.0
Organization for the Advancement of Structured Information Standards (OASIS)
Business Centric-Methodology (BCM), base for SOA
Universal Description Discovery and Integration (UDDI)
Web Services Business Process Execution Language (WS-BPEL)
Security Assertion Markup Language (SAML) - to replace LDAP
DocBook - a format used to create this note
World Wide Web Consortium (W3C)
Extensible Markup Language (XML) (1998, 2004, 2008)
Resource Description Framework (RDF) (2004)
XML Namespaces (1999, 2004, 2009)
XML Schema (2001, 2004, 2012)
DOM (1998, 2000, 2004, 2008)
XML Path Language (XPath) (1999, 2007, 2010)
XSL Transformations (XSLT) (1999, 2007, 2010)
XHTML (2000, 2001, 2007, 2010)
XQuery: An XML Query Language (2007, 2010)
XML, as a technology, gives tools and methods for solving tasks in a variety of areas. Technology, because it contains standards, products for making, processing and displaying structured documents. The land of uses can be:
web presence (server and client side transformation)
interchange (format, transformation) – e-Business
text representation and processing
document formats in Office Applications (OpenOffice, MS Office)
Web 2.0
technical document’s language
configuring software (ant, maven)
defining user interfaces (XUL)
Curriculum Vitae in the EU (Europass)
…
Based on this list we can see that it points back to the previously seen properties of the XML, as a document format and as a metalanguage. Moreover, there are technologies to display and transform it, language bindings to make it available for programming languages (like JAXB for Java) and technologies to store and query it.
Before we discuss the important factors for XML storage, we need to see what are the possibilities for reuse. XML solves this by introducing namespaces. This makes possible to utilize foreign tools and to avoid name conflicts which could became reality if we use multiple sources and some of them use the same naming convention for different terms. It can only be resolved by clearly stating which element belongs to which namespace.
Namespaces are syntactic
mechanism’s. It can be used to distinguish a name
in different environments. It allows us to use elements of several markup
languages in one file. Every namespace is an infinite set of qualified names,
where the qualified name is a <namespace, local_name> pair,
where the namespace name could be empty.
The XML standard uses the xmlns (XML Namespace) attribute to the
introduce namespaces. This attribute associates a given namespaces to a
specified name - as a prefix. So the defined elements in the namespace can be
used after declaration with the help of the prefix.
<?xml version="1.0" encoding="utf-8"?> <account:persons xmlns:account="http://example.org/schema"> <account:person name="John Doe" age="23"> <account:favourite number="4" dish="jacket potato" /> </account:person> <account:person name="Gipsz Jakab" age="54"> <account:favourite number="4" movie="Matrix" /> </account:person> <account:person name="Hommer Tekla" age="41" /> </account:persons>
When using namespaces the readability is degraded and could be very difficult for humans to read it. One solution could be the usage of default namespaces (lack of the prefix) if the utilized parser (processor) allows it. In that case we do not have to use prefixes because the element and all children are placed into that namespace by default:
<account xmlns="http://example.org/schema">
Adding only a default namespace declaration to an XML document in question eliminates the need to write a namespace prefix for each and every element, so it saves a lot of time.
On the other hand, there are drawbacks. First, omitting the namespace prefix makes it more difficult to understand which element belongs to which namespace, and which namespace is applicable. In addition, programmers should remember that when a default namespace is declared, the namespace is applied only to the element, and not to any attributes!
Notation to cancel a default namespace
The xmlns attribute must specify an URI (Uniform Resource
Identifier). Every element in the hierarchy must follow the specified structure
introduced by the namespace. However, we can also delete a prefix like
this:
<person xmlns:account="">
We can use several namespaces with different prefixes to avoid name collisions:
<?xml version="1.0" encoding="utf-8"?> <account:persons xmlns:information="http://example.org/information" xmlns:account="http://example.org/schema/person"> <account:person name="John Doe" age="23"> <account:favourite number="4" dish="jacket potato" /> <account:favouriteWebPage> <account:address>http://www.w3.org</account:address> </account:favouriteWebPage> <information:address> <information:city>Debrecen</information:city> <information:street>Vasvari Pal</information:street> </information:address> </account:person> </account:persons>
Both
of them contains an address type, which is a simple type in the
account namespace, but in the other case it is a complex type.
If we use them without namespaces, the XML processor would not be able to decide
whether that given type can occur at the given place or not, moreover whether it
contains valid data or not.