Shopping on line can be easy, simple and save you lots of money. It can also take a lot of your time, frustrate you, and result in unwanted purchases. Now the same can be said for regular high street shopping, but with the vast opportunity presented by the Internet it will pay you to spend a few minutes reading this and understanding how to better optimize your Xml shopping experience:
1. Compare - without doubt the biggest advantage that the Xml offers shoppers today is the ability to compare thousands of Xml at a time. This is a great thing, but not necessarily all the time! Too much can be daunting at times so take advantage of the great comparison sites and where possible let them do the hard work for you.
2. Research - if it has been said it will be on the internet. Ignorance is no longer a justifiable reason for buying the wrong thing. Take the time to research in detail everything that you could possible want to know about
3. Testimonials - don't know anybody that has bought a Xml? Wrong! If the Xml is good the internet will let you know. Use the Internet as a friend and get testimonials before you buy.
4. Questions - Got a question about Xml then search the Forums, FAQ's, Blogs etc. Don't be afraid to ask .....
5. Reputation - Never heard of the company selling Xml? Don't worry, no reason why you should know every company in the world, but you know someone that does! Use the internet to find out what people are saying about Xml and build up a picture of their reputation for sales, returns, customer service, delivery etc.
6. Returns - still worried that even after all of the above your Xml wont be what you want? Check out the returns policy. There is so much competition now that someone, somewhere is bound to offer the terms that you are comfortable with.
7. Feedback - happy with your Xml then let people know, after all you are depending on others people input in your buying decision, so why not give a little back.
8. Security - check for the yellow padlock on the Xml site before you buy, and the s after http:/ /i.e. https:// = a secure site
9. Contact - got a question about Xml, or want to leave a comment then check out the sites contact page. Reputable companies have them and respond.
10. Payment - ready to pay for your Xml, then use your credit card or PayPal! Be aware of companies that don't accept them, there may be genuine reasons but given the huge amount of choice you have when buying online there is no reason at all not to buy via credit card or PayPal.
{{Infobox file format| name = Extensible Markup Language| icon =| logo =| screenshot = | extension = .xml| mime = application/xml, text/xml (deprecated)| type code =| uniform type = public.xml| magic =| owner = World Wide Web Consortium| container for =| contained by =| extended from = [Standard Generalized Markup Language| extended to =
XHTML,
RSS,
Atom (standard), ...| standard = 1.0 (Fourth Edition) 1.1 (Second Edition)-->The
Extensible Markup Language (
XML) is a general-purpose
markup language.More precisely, XML is a general-purpose
specification for creating custom markup languages. It is classified as an
extensible language because it allows its users to define their own tags. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the
Internet. It is used both to encode documents and
Serialization data. In the latter context, it is comparable with other text-based serialization languages such as JSON and
YAML.JSON and YAML are among other alternative text-based formats commonly described as lighter-weight and less verbose in comparison to XML. See
#Critique of XML in this article.
It started as a simplified subset of the Standard Generalized Markup Language (SGML), and is designed to be relatively human-legible. By adding semantic constraints, application languages can be implemented in XML. These include
XHTML,XHTML is an attempt to simplify and improve the consistency of
HTML, which was based on SGML.
RSS (file format),
MathML,
GraphML, Scalable Vector Graphics,
MusicXML, and thousands of others. Moreover, XML is sometimes used as the specification language for such application languages.
XML is W3C recommendation by the World Wide Web Consortium. It is a fee-free open standard.The W3C recommendation specifies both the
lexical grammar, and the requirements for
parsing.
Well-formed and valid XML documents
There are two levels of correctness of an XML document:
- Well-formed. A well-formed document conforms to all of XML's syntax rules. For example, if an element has an opening tag with no closing tag and is not self-closing, it is not well-formed. A document that is not well-formed is not considered to be XML; a conforming parser is not allowed to process it.
- Valid. A valid document additionally conforms to some semantic rules. These rules are either user-defined, or included as an XML schema or Document Type Definition. For example, if a document contains an undefined tag, then it is not valid; a validating parser is not allowed to process it.
Well-formed documents: XML syntax
As long as only well-formedness is required, XML is a generic framework for storing any amount of text or any data whose structure can be represented as a tree.The only indispensable syntactical requirement is that the document has exactly one
root element (alternatively called the
document element). This means that the text must be enclosed between a root opening tag and a corresponding closing tag.The following is a well-formed XML document:This is a book....
The root element can be preceded by an optional
XML declaration. This element states what version of XML is in use (normally 1.0); it may also contain information about
character encoding and external
Coupling (computer science).
The specification
requires that processors of XML support the pan-
Unicode character encodings
UTF-8 and
UTF-16/UCS-2 (UTF-32/UCS-4 is not mandatory). The use of more limited encodings, such as those based on ISO/IEC 8859, is acknowledged and is widely used and supported.
Comments can be placed anywhere in the tree, including in the text if the content of the element is text or #PCDATA.
XML comments start with
<!-- and end with
-->. Two dashes (--) may not appear anywhere in the text of the comment.
In any meaningful application, additional markup is used to structure the contents of the XML document. The text enclosed by the root tags may contain an arbitrary number of XML elements.The basic syntax for one
element is:contentHere, »content« is some text which may again contain XML elements. So, a generic XML document contains atree (data structure). In this respect, it is similar to the Lisp (programming language) programming language's S-expressions, which describe tree structures wherein each node may have its own property list.Here is an example of a structured XML document:
Basic bread
Flour
Yeast
Water
Salt
Mix all ingredients together.
Knead thoroughly.
Cover with a cloth, and leave for one hour in warm room.
Knead again.
Place in a bread baking tin.
Cover with a cloth, and leave for one hour in warm room.
Bake in the oven at 350° for 30 minutes.
Attribute values must always be quoted, using single or double quotes, and each attribute name should appear only once in any element.XML requires that elements be properly nested — elements may never overlap. For example, the code below is not well-formed XML, because the
EM and
strong elements overlap:Normal
emphasized strong emphasized strongXML provides special syntax for representing an element with empty content. Instead of writing a start tag followed immediately by an end tag, a document may contain an empty-element tag. An empty-element tag resembles a start tag but contains a slash just before the closing angle bracket. The following three examples are equivalent in XML:An empty-element tag may contain attributes:
Entity references
XML provides two methods for referring to special characters:
character entity references and
numeric character references.
An
SGML entity in XML is a named body of data, usually text, such as an unusual character.
An entity reference is a
placeholder that represents that entity. It consists of the entity's name preceded by an ampersand ("&") and followed by a
semicolon (";"). XML has five
predeclared entities:{]. A basic example of doing so in a minimal internal DTD follows. Declared entities can describe single characters or pieces of text, and can reference each other.
]> ©right-notice;
When viewed in a suitable browser, the XML document above appears as:
Copyright © 2006, XYZ Enterprises
Numeric character references
Numeric character references look like entity references, but instead of a name, they contain the "number sign" character followed by a number. The number (in decimal or "x"-prefixed
hexadecimal) represents a Unicode code point. Unlike entity references, they are neither predeclared nor do they need to be declared in the document's DTD. They have typically been used to represent characters that are not easily encodable, such as an
Arabic language character in a document produced on a European computer. The ampersand in the "AT&T" example could also be
escape character like this (decimal 38 and hexadecimal 26 both represent the Unicode code point for the "&" character):AT&TAT&TThere are many more rules necessary to be sure of writing well-formed XML documents, such as the use of XML Namespace and the exact characters allowed in an XML name, but this quick tour provides the basics necessary to read and understand many XML documents.
Well-formed documents
A well-formed document must conform to the following rules, among others:
- Non-empty elements are delimiter by both a start-tag and an end-tag.
- Empty elements may be marked with an empty-element (self-closing) tag, such as <IAmEmpty />. This is equal to <IAmEmpty></IAmEmpty>.
- All attribute values are quoted with either single (') or double (") quotes. Single quotes close a single quote and double quotes close a double quote.
- Tags may be nested but must not overlap. Each non-root element must be completely contained in another element.
- The document complies with its declared character encoding. The encoding may be declared or implied externally, such as in "Content-Type" headers when a document is transported via Hypertext Transfer Protocol, or internally, using explicit markup at the very beginning of the document. When no such declaration exists, a Unicode encoding is assumed, as defined by a Unicode Byte-order mark before the document's first character. If the mark does not exist, UTF-8 encoding is assumed.
Element names are case-sensitive. For example, the following is a well-formed matching pair:
<Step> ... </Step>
whereas this is not
<Step> ... </step>
The careful choice of names for XML elements will convey the meaning of the data in the Markup language. This increases human readability while retaining the rigor needed for software parsing.
Choosing meaningful names implies the semantics of elements and attributes to a human reader without reference to external documentation. However, this can lead to verbosity, which complicates
authoring and increases file size.
Automatic verification
It is relatively simple to verify that a document is well-formed or validated XML, because the rules of well-formedness and validation of XML are designed for portability of tools. The idea is that any tool designed to work with XML files will be able to work with XML files written in any XML language (or XML application). One example of using an independent tool follows:
- load it into an XML-capable browser, such as Mozilla Firefox or Internet Explorer
- use a tool like xmlwf (usually bundled with Expat (XML))
- parse the document, for instance in Ruby:
irb> require "rexml/document"
irb> include REXML
irb> doc = Document.new(File.new("test.xml")).root
Valid documents: XML semantics
By leaving the names, allowable hierarchy, and meanings of the elements and attributes open and definable by a customizable
XML schema or Document Type Definition, XML provides a syntactic foundation for the creation of purpose specific, XML-based markup languages. The general syntax of such languages is rigid — documents must adhere to the general rules of XML, ensuring that all XML-aware software can at least read and understand the relative arrangement of information within them. The schema merely supplements the syntax rules with a set of constraints. Schemas typically restrict element and attribute names and their allowable containment hierarchies, such as only allowing an element named 'birthday' to contain 1 element named 'month' and 1 element named 'day', each of which has to contain only character data. The constraints in a schema may also include data type assignments that affect how information is processed; for example, the 'month' element's character data may be defined as being a month according to a particular schema language's conventions, perhaps meaning that it must not only be formatted a certain way, but also must not be processed as if it were some other type of data.
An XML document that complies with a particular schema/DTD, in addition to being well-formed, is said to be
valid.
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic constraints imposed by XML itself. A number of standard and proprietary XML schema languages have emerged for the purpose of formally expressing such schemas, and some of these languages are XML-based, themselves.
Before the advent of generalised data description languages such as SGML and XML, software designers had to define special file formats or small languages to share data between programs. This required writing detailed
specifications and special-purpose parsers and writers.
XML's regular structure and strict parsing rules allow software designers to leave parsing to standard tools, and since XML provides a general, data model-oriented framework for the development of application-specific languages, software designers need only concentrate on the development of rules for their data, at relatively high levels of abstraction.
Well-tested tools exist to validate an XML document "against" a schema: the tool automatically verify whether the document conforms to constraints expressed in the schema. Some of these validation tools are included in XML parsers, and some are packaged separately.
Other usages of schemas exist: XML editors, for instance, can use schemas to support the editing process (by suggesting valid elements and attributes names, etc).
DTD
The oldest schema format for XML is the Document Type Definition (DTD), inherited from SGML. While DTD support is ubiquitous due to its inclusion in the XML 1.0 standard, it is seen as limited for the following reasons:
- It has no support for newer features of XML, most importantly XML Namespace.
- It lacks expressiveness. Certain formal aspects of an XML document cannot be captured in a DTD.
- It uses a custom non-XML syntax, inherited from SGML, to describe the schema.
DTD is still used in many applications because it is considered the easiest to read and write.
XML Schema
A newer
XML schema language, described by the W3C as the successor of DTDs, is
XML Schema (W3C), or more informally referred to by the acronym and initialism for XML Schema instances, XSD (XML Schema Definition). XSDs are far more powerful than DTDs in describing XML languages. They use a rich datatype system, allow for more detailed constraints on an XML document's logical structure, and must be processed in a more
robust validation framework. XSDs also use an XML-based format which makes it possible to use ordinary XML tools to help process them, although XSD implementations require much more than just the ability to read XML.
Criticisms of XSD include the following:
- The specification is very large, which makes it difficult to understand and implement.
- The XML-based syntax leads to verbosity in schema description, which makes XSDs harder to read and write.
- Schema validation can be an expensive addition to XML parsing, especially for high volume systems.
- The modeling capabilities are very limited, with no ability to allow attributes to influence content models.
- The type derivation model is very limited, in particular that derivation by extension is rarely useful.
- Database-related data transfer has been supported with arcane ideas such as nillability but the requirements of industrial publishing are under-supported.
- The key/keyref/uniqueness mechanisms are not type aware
- The PSVI concept (Post Schema Validation Infoset) does not have a standard XML representation or Application Programming Interface, thus it works against vendor independence unless revalidation is performed.
RELAX NG
Another popular schema language for XML is RELAX NG. Initially specified by
OASIS (organization), RELAX NG is now also an ISO international standard (as part of
DSDL). It has two formats: an XML based syntax and a non-XML compact syntax. The compact syntax aims to increase readability and writability but, since there is a well-defined way to translate the compact syntax to the XML syntax and back again by means of
James Clark (XML expert)'s Trang conversion tool, the advantage of using standard XML tools is not lost. RELAX NG has a simpler definition and validation framework than XML Schema, making it easier to use and implement. It also has the ability to use
datatype framework plug-ins; a RELAX NG schema author, for example, can require values in an XML document to conform to definitions in XML Schema Datatypes.
ISO DSDL and Other Schema Languages
The ISO DSDL (Document Schema Description Languages) standard brings together a comprehensive set of small schema languages, each targeted at specific problems. DSDL includes RELAX NG full and compact syntax,
Schematron assertion language, and languages for defining datatypes, character repertoire constraints, renaming and entity expansion, and namespace-based
routing of document fragments to different validators. DSDL schema languages do not have the vendor support of XML Schemas yet, and are to some extent a grassroots reaction of industrial publishers to the lack of utility of XML Schemas for
publishing.
Some schema languages not only describe the structure of a particular XML format but also offer limited facilities to influence processing of individual XML files that conform to this format. DTDs and XSDs both have this ability; they can for instance provide attribute defaults. RELAX NG and Schematron intentionally do not provide these; for example the infoset augmentation facility.
International use
XML supports the direct use of almost any Unicode character (other than the ones that have special symbolic meaning in XML, itself, such as the open corner bracket, " element.
Extensible Stylesheet Language (XSL) can be used to alter the format of XML data, either into HTML or other formats that are suitable for a browser to display.
To specify client-side XSL Transformations (XSLT), the following processing instruction is required in the XML:
Client-side XSLT is supported by many
web browsers, but not
Opera (web browser) before version 9.0. An alternative, rather than being dependent on the end-user's browser capabilities, is to use XSL to convert XML into a displayable format
on the Server (computing). The end-user is not aware of what has gone on 'behind the scenes'; all they see is well-formatted, displayable data.
See the XSLT article
XSL Transformations#Examples.
XML extensions
- XPath makes it possible to refer to individual parts of an XML document. This provides random access to XML data for other technologies, including XSLT, XSL-FO, XQuery etc. XPath expressions can refer to all or part of the text, data and values in XML elements, attributes, processing instructions, comments etc. They can also access the names of elements and attributes. XPaths can be used in both valid and well-formed XML, with and without defined namespaces.
- XInclude defines the ability for XML files to include all or part of an external file. When processing is complete, the final XML infoset has no XInclude elements, but instead has copied the documents or parts thereof into the final infoset. It uses XPath to refer to a portion of the document for partial inclusions.
- XQuery is to XML what SQL and PL/SQL are to relational databases: ways to access, manipulate and return XML.
- XML Namespaces enable the same document to contain XML elements and attributes taken from different vocabularies, without any naming collisions occurring.
- XML Signature defines the syntax and processing rules for creating digital signatures on XML content.
- XML Encryption defines the syntax and processing rules for encryption XML content.
- XPointer is a system for addressing components of XML-based internet media.
XML files may be served with a variety of
MIME. RFC 3023 defines the types "application/xml" and "text/xml", which say only that the data is in XML, and nothing about its semantics. The use of "text/xml" has been criticized as a potential source of encoding problems but is now in the process of being deprecated.http://lists.xml.org/archives/xml-dev/200407/msg00208.html RFC 3023 also recommends that XML-based languages be given media types beginning in "application/" and ending in "+xml"; for example "application/atom+xml" for
Atom (standard). This page discusses further XML and MIME.
Processing XML files
Three traditional techniques for processing XML files are:
More recent and emerging techniques for processing XML files are:
- Push Parsing
- Data binding
- Non-extractive XML Processing API such as VTD-XML
Simple API for XML (SAX)
Simple API for XML is a
lexical analysis,
Event-driven programming interface in which a document is read serially and its contents are reported as "
callbacks" to various method (computer science)s on a handler object of the user's design. SAX is fast and efficient to implement, but difficult to use for extracting information at random from the XML, since it tends to burden the application author with keeping track of what part of the document is being processed. It is better suited to situations in which certain types of information are always handled the same way, no matter where they occur in the document.
DOM
Document Object Model is an
interface-oriented
Application Programming Interface that allows for navigation of the entire document as if it were a tree of "
Node (computer science)" objects representing the document's contents. A DOM document can be created by a parser, or can be generated manually by users (with limitations). Data types in DOM Nodes are abstract; implementations provide their own
programming language-specific bindings. DOM implementations tend to be memory intensive, as they generally require the entire document to be loaded into memory and constructed as a tree of objects before access is allowed.
Transformation engines and filters
A filter (software) in the Extensible Stylesheet Language (XSL) family can transform an XML file for
displaying or
Computer printering.
- XSL-FO is a declarative, XML-based page layout language. An XSL-FO processor can be used to convert an XSL-FO document into another non-XML format, such as PDF.
- XSLT is a declarative, XML-based document transformation language. An XSLT processor can use an XSLT stylesheet as a guide for the conversion of the data tree represented by one XML document into another tree that can then be serialized as XML, HTML, plain text, or any other format supported by the processor.
- XQuery is a W3C language for querying, constructing and transforming XML data.
- XPath is a DOM-like node tree data model and path expression language for selecting data within XML documents. XSL-FO, XSLT and XQuery all make use of XPath. XPath also includes a useful function library.
=== Push Parsing ===A form of XML access that has become increasingly popular in recent years is push parsing, Push, Pull, Next! by Bob DuCharme, at XML.com which treats the document as if it were a series of items which are being read in sequence. This allows for writing of recursive descent parser in which the structure of the code performing the parsing mirrors the structure of the XML being parsed, and intermediate parsed results can be used and accessed as local variables within the methods performing the parsing, or passed down (as method parameters) into lower-level methods, or returned (as method return values) to higher-level methods. For instance, in the Java (programming language) programming language, the
StAX framework can be used to create what is essentially an 'iterator' which sequentially visits the various elements, attributes, and data in an XML document. Code which uses this 'iterator' can test the current item (to tell, for example, whether it is a start or end element, or text), and inspect its attributes (local name, namespace, values of XML attributes, value of text, etc.), and can also request that the iterator be moved to the 'next' item. The code can thus extract information from the document as it traverses it. One significant advantage of push-parsing methods is that they typically are much more speed- and memory-efficient than SAX and DOM styles of parsing XML. Another advantage is that the recursive-descent approach tends to lend itself easily to keeping data as typed local variables in the code doing the parsing, while SAX, for instance, typically requires a parser to manually maintain intermediate data within a stack of elements which are parent elements of the element being parsed. This tends to mean that push-parsing code is often much more straightforward to understand and maintain than SAX parsing code. Some potential disadvantages of push parsing are that it is a newer approach which is not as well known among XML programmers (although it is by far the most common method used for writing compilers and interpreters for languages other than XML), and that most existing push parsers cannot yet perform advanced processing such as XML schema validation as they parse a document.
Data binding
Another form of XML Processing API is
XML data binding, where XML data is made available as a custom, strongly typed programming language data structure, in contrast to the interface-oriented DOM. Example data binding systems are the
Java (programming language) Architecture for XML Binding (JAXB)http://java.sun.com/xml/jaxb/ and the Strathclyde Novel Architecture for Querying XML (SNAQue).http://www.cis.strath.ac.uk/research/snaque/
Non-extractive XML Processing API
Non-extractive XML Processing API is a new and emerging category of parsers. The most representative is
VTD-XML, which abolishes the object-oriented modeling of XML hierarchy and instead uses 64-bit Virtual Token Descriptors (encoding offsets, lengths, depths, and types) of XML tokens. VTD-XML's approach enables a number of interesting features/enhancements, such as high performance, low memory usage http://www.javaworld.com/javaworld/jw-03-2006/jw-0327-simplify.html, ASIC implementation http://www.ximpleware.com/wp_SUN.pdf, incremental update http://www.javaworld.com/javaworld/jw-07-2006/jw-0724-vtdxml.html, and native XML indexing http://vtd-xml.sf.net/persistence.html.
Specific XML applications and editors
The
native file format of OpenOffice.org, AbiWord, and
Apple Computer's
iWork applications is XML. Some parts of
Microsoft Office 2007 are also able to edit XML files with a user-supplied schema (but not a DTD), and Microsoft has released a file format compatibility kit for Office 2003 that allows previous versions of Office to save in the new XML based format. There are dozens of other XML editors available.
History
The versatility of SGML for dynamic information display was understood by early digital media publishers in the late 1980s prior to the rise of the Internet. By the mid-1990s some practitioners of SGML had gained experience with the then-new
World Wide Web, and believed that SGML offered solutions to some of the problems the Web was likely to face as it grew. Dan Connolly added SGML to the list of W3C's activities when he joined the staff in 1995; work began in mid-1996 when Jon Bosak developed a charter and recruited collaborators. Bosak was well connected in the small community of people who had experience both in SGML and the Web. He received support in his efforts from Microsoft.
XML was compiled by a
working group of eleven members,The working group was originally called the "Editorial Review Board." The original members and seven who were added before the first edition was complete, are listed at the end of the first edition of the XML Recommendation, at http://www.w3.org/TR/1998/REC-xml-19980210. supported by an (approximately) 150-member Interest Group. Technical debate took place on the Interest Group mailing list and issues were resolved by consensus or, when that failed, majority vote of the Working Group. The decision record was compiled by Michael Sperberg-McQueen on December 4th 1997. Reports From the W3C SGML ERB to the SGML WG And from the W3C XML ERB to the XML SIG
James Clark (XML expert) served as Technical Lead of the Working Group, notably contributing the empty-element "" syntax and the name "XML". Other names that had been put forward for consideration included "MAGMA" (Minimal Architecture for Generalized Markup Applications), "SLIM" (Structured Language for Internet Markup) and "MGML" (Minimal Generalized Markup Language). The co-editors of the specification were originally
Tim Bray and
Michael Sperberg-McQueen. Halfway through the project Bray accepted a consulting engagement with Netscape Communications Corporation, provoking vociferous protests from Microsoft. Bray was temporarily asked to resign the editorship. This led to intense dispute in the Working Group, eventually solved by the appointment of Microsoft's
Jean Paoli as a third co-editor.
The XML Working Group never met face-to-face; the design was accomplished using a combination of email and weekly teleconferences. The major design decisions were reached in twenty weeks of intense work between July and November of 1996, when the first Working Draft of an XML specification was published.http://www.w3.org/TR/WD-xml-961114.html Further design work continued through 1997, and XML 1.0 became a
W3C Recommendation on February 10, 1998.
XML 1.0 achieved the Working Group's goals of Internet usability, general-purpose usability, SGML compatibility, facilitation of easy development of processing software, minimization of optional features, legibility, formality, conciseness, and ease of authoring.Like its antecedent SGML, XML allows for some redundant syntactic constructs and includes repetition of element identifiers. In these respects, terseness was not considered essential in its structure.
Sources
XML is a profile of an ISO standard
SGML, and most of XML comes from SGML unchanged. From SGML comes the separation of logical and physical structures (elements and entities), the availability of grammar-based validation (DTDs), the separation of data and metadata (elements and attributes), mixed content, the separation of processing from representation (processing instructions), and the default angle-bracket syntax. Removed were the SGML Declaration (XML has a fixed delimiter set and adopts
Unicode as the document
Character encoding).
Other sources of technology for XML were the Text Encoding Initiative (TEI), which used a simpler syntax than full SGML;
HTML, in which elements were synchronous with their resource, the separation of document character set from resource encoding, the xml:lang attribute, and the HTTP notion that metadata accompanied the resource rather than being needed at the declaration of a link; and the Extended Reference Concrete Syntax (ERCS), from which XML 1.0's naming rules were taken, and which had introduced hexadecimal numeric character references and the concept of references to make available all Unicode characters.
Ideas that developed during discussion which were novel in XML, were the algorithm for encoding detection and the encoding header, the processing instruction target, the xml:space attribute, and the new close delimiter for empty element tags.
Versions
There are two current versions of XML. The first,
XML 1.0, was initially defined in
1998. It has undergone minor revisions since then, without being given a new version number, and is currently in its fourth edition, as published on
August 16,
2006. It is widely implemented and still recommended for general use. The second,
XML 1.1, was initially published on February 4,
2004, the same day as XML 1.0 Third Edition, and is currently in its second edition, as published on
August 16,
2006. It contains features — some contentious — that are intended to make XML easier to use in certain cases - mainly enabling the use of line-ending characters used on
EBCDIC platforms, and the use of scripts and characters absent from Unicode 2.0. XML 1.1 is not very widely implemented and is recommended for use only by those who need its unique features. {{cite book | last = Harold
| first = Elliotte Rusty
| title = Effective XML
| publisher = Addison-Wesley
| date = 2004
| pages = 10-19
| url = http://www.cafeconleche.org/books/effectivexml/
| isbn = 0321150406-->
XML 1.0 and XML 1.1 differ in the requirements of characters used for element and attribute names: XML 1.0 only allows characters which are defined in Unicode 2.0, which includes most world scripts, but excludes those which were added in later Unicode versions. Among the excluded scripts are Mongolian language, Cambodian language, Amharic, Burmese language, and others.
Almost any Unicode character can be used in the character data and attribute values of an XML 1.1 document, even if the character is not defined, aside from having a code point, in the current version of Unicode. The approach in XML 1.1 is that only certain characters are forbidden, and everything else is allowed, whereas in XML 1.0, only certain characters are explicitly allowed, thus XML 1.0 cannot accommodate the addition of characters in future versions of Unicode.
In character data and attribute values, XML 1.1 allows the use of more
control characters than XML 1.0, but, for "robustness", most of the control characters introduced in XML 1.1 must be expressed as numeric character references. Among the supported control characters in XML 1.1 are two line break codes that must be treated as whitespace. Whitespace characters are the only control codes that can be written directly.
There are also discussions on an XML 2.0, although it remains to be seen if such will ever come about. XML-SW (SW for
skunk works), written by one of the original developers of XML, contains some proposals for what an XML 2.0 might look like: elimination of DTDs from syntax, integration of
namespace (computer science)#XMLs,
XML Base and
XML Information Set (
infoset) into the base standard.
The World Wide Web Consortium also has an XML Binary Characterization Working Group doing preliminary research into use cases and properties for a binary encoding of the XML infoset. The working group is not chartered to produce any official standards. Since XML is by definition text-based, ITU-T and ISO are using the name
Fast Infoset for their own binary infoset to avoid confusion (see ITU-T Rec. X.891 | ISO/IEC 24824-1).
Patent claims
In October 2005 the small company
Scientigo publicly asserted that two of its patents, and , apply to the use of XML. The patents cover the "modeling, storage and transfer data in a particular
non-hierarchical, non-integrated neutral form", according to their applications, which were filed in 1997 and 1999. Scientigo CEO
Doyal Bryant expressed a desire to "monetize" the patents but stated that the company was "not interested in having us against the world." He said that Scientigo was discussing the patents with several large corporations.http://news.com.com/Small+company+makes+big+claims+on+XML+patents/2100-1014_3-5905949.html
XML users and independent experts responded to Scientigo's claims with widespread skepticism and criticism. Some derided the company as a
patent troll.
Tim Bray described any claims that the patents covered XML as "ridiculous on the face of it".http://blogs.zdnet.com/BTL/?p=2052
Because there exists a large amount of
prior art relating to XML, including SGML, some legal experts believed it would be difficult for Scientigo to enforce its patents through litigation.
== Critique of XML ==Commentators have offered various critiques of XML, suggesting circumstances where XML provides both advantages and potential disadvantages.(See e.g., XML-QL Proposal discussing XML benefits, When to use XML, "XML Sucks" on c2.com, Daring to Do Less with XML)
"XML is really just data dressed up as a hooker."
-[Dave Thomas (programmer)Neal Ford, Language Oriented Programming, The Server Side's Java Symposium, 2007
Advantages of XML
- It is text-based.
- It supports Unicode, allowing almost any information in any written human language to be communicated.
- It can represent the most general computer science data structures: record (computer science)s, List (computing)s and tree data structures.
- Its self-documenting format describes structure and field names as well as specific values.
- The strict syntax and parsing requirements make the necessary parser extremely simple, efficient, and consistent.
- XML is heavily used as a format for document storage and processing, both online and offline.
- It is based on international standards.
- It can be updated incrementally.
- It allows validation using schema languages such as XSD and Schematron, which makes effective unit-testing, firewalls, acceptance testing, contractual specification and software construction easier.
- The hierarchy structure is suitable for most (but not all) types of documents.
- It manifests as plain text files, which are less restrictive than other proprietary document formats.
- It is platform-independent, thus relatively immune to changes in technology.
- Forward and backward compatibility are relatively easy to maintain despite changes in DTD or Schema.
- Its predecessor, SGML, has been in use since 1986, so there is extensive experience and software available.
- An element fragment of a well-formed XML document is also a well-formed XML document.
Disadvantages of XML
- XML syntax is redundant or large relative to binary representations of similar data.
{{cite book| last = Rusty| first = Elliotte| title = Processing XML with Java(tm): a guide to SAX, DOM, JDOM, JAXP, and TrAX| publisher = Addison-Wesley| year = 2002| id = 0201771861| ref = Reference-Rusty-2002-a-->XML documents are too verbose compared with binary equivalents.
- The redundancy may affect application efficiency through higher storage, transmission and processing costs.
{{cite book| last = Rusty| first = Elliotte| title = Xml in a Nutshell: A Desktop Quick Reference| publisher = O'Reilly| year = 2002| id = 0596002920| ref = Reference-Rusty-2002-b--> XML documents are very verbose and searching is inefficient forhigh-performance largescale database applications.However, the
Binary XML effort strives to alleviate these problems by using a binary representation for the XML document. For example, the
Java (programming language) reference implementation of the Fast Infoset standard parsing speed is better by a factor 10 compared to
Java (programming language) Xerces, and by a factor 4 compared to the Piccolo driver, one of the fastest Java-based XML parser .
- XML syntax is verbose relative to other alternative 'text-based' data transmission formats.
{{cite book| last = Bierman| first = Gavin| title = Database Programming Languages: 10th international symposium, DBPL 2005 Trondheim, Norway| publisher = Springer| year = 2005| id = 3540309519-->XML syntax is too verbose for human readers in for certain applications.Proposes a dual syntax for human readability.Although many purportedly"less verbose" text formats actually cite XML asboth inspiration and prior art.See e.g., http://yaml.org/spec/current.html,http://innig.net/software/sweetxml/index.html,http://www.json.org/xml.html.
- No intrinsic data type support: XML provides no specific notion of "integer", "string", "boolean", "date", and so on.For example, there is no provision for mandating that "3.14159" be a floating-point number rather than a seven-character string. Such conversions require processing. However, XML schema descriptions of XML documents add data-type support to XML processing.
{{cite book| last = Blanken| first = Henk M.| title = Intelligent Search on Xml Data: Applications, Languages, Models, Implementations, and Benchmarks| publisher = Springer| year = 2003| id = 3540407685-->Proposes a system for recognizing custom-defined data types.
- The hierarchical model for representation is limited in comparison to the relational model or an object oriented Graph (mathematics).A hierachical model only gives a fixed, monolithic view of the tree structure. For example, either actors under movies, or movies under actors, but not both.
{{cite book| last = Lim| first = Ee-Peng| title = Digital Libraries: People, Knowledge, and Technology| publisher = Springer| year = 2002| id = 3540002618-->Discusses some of the limitation with fixed hierarchy. Proceedings of the 5th International Conference on Asian Digitial Libraries, ICADL 2002, held in Singapore in December 2002.
- Expressing overlapping (non-hierarchical) node relationships requires extra effort.{{cite book
| last = Searle| first = Leroy F.| title = Voice, text, hypertext: emerging practices in textual studies| publisher = University of Washington Press| year = 2004| id = 0295983051--> Proposes an alternative system for encoding overlapping elements.
- XML namespaces are problematic to use and namespace support can be difficult to correctly implement in an XML parser.(See e.g., http://www-128.ibm.com/developerworks/library/x-abolns.html )
- XML is commonly depicted as "self-documenting" but this depiction ignores critical ambiguities.{{cite web
| title = The Myth of Self-Describing XML| url = http://www.oceaninformatics.biz/publications/e2.pdf| accessdate = 2007-05-12-->(See e.g., Use–mention distinction, Naming collision, Polysemy)
See also
Notes and references
External links
Specifications
- W3C XML homepage
- The XML 1.0 specification
- The XML 1.1 specification
Parsers
- VTD-XML a next generation, open-source, XML parser/indexer available in C, C# and Java
- Expat (XML) free stream-oriented XML 1.0 parser library, written in C.
- Libxml2 free XML C parser and toolkit.
- RomXML Embedded XML commercial toolkit written in ANSI-C.
Sources
- Introduction to Generalized Markup by Charles Goldfarb
- Annex A of ISO 8879:1986 (SGML)
- The Multilingual WWW by Gavin Nicol
- Retrospective on Extended Reference Concrete Syntax by Rick Jelliffe
-
{{Infobox file format| name = Extensible Markup Language| icon =| logo =| screenshot = | extension = .xml| mime = application/xml, text/xml (deprecated)| type code =| uniform type = public.xml| magic =| owner = World Wide Web Consortium| container for =| contained by =| extended from = [Standard Generalized Markup Language| extended to = XHTML, RSS, Atom (standard), ...| standard = 1.0 (Fourth Edition) 1.1 (Second Edition)-->The Extensible Markup Language (XML) is a general-purpose markup language.More precisely, XML is a general-purpose specification for creating custom markup languages. It is classified as an extensible language because it allows its users to define their own tags. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet. It is used both to encode documents and Serialization data. In the latter context, it is comparable with other text-based serialization languages such as JSON and YAML.JSON and YAML are among other alternative text-based formats commonly described as lighter-weight and less verbose in comparison to XML. See #Critique of XML in this article.
It started as a simplified subset of the Standard Generalized Markup Language (SGML), and is designed to be relatively human-legible. By adding semantic constraints, application languages can be implemented in XML. These include XHTML,XHTML is an attempt to simplify and improve the consistency of HTML, which was based on SGML. RSS (file format), MathML, GraphML, Scalable Vector Graphics, MusicXML, and thousands of others. Moreover, XML is sometimes used as the specification language for such application languages.
XML is W3C recommendation by the World Wide Web Consortium. It is a fee-free open standard.The W3C recommendation specifies both the lexical grammar, and the requirements for parsing.
Well-formed and valid XML documents
There are two levels of correctness of an XML document:
- Well-formed. A well-formed document conforms to all of XML's syntax rules. For example, if an element has an opening tag with no closing tag and is not self-closing, it is not well-formed. A document that is not well-formed is not considered to be XML; a conforming parser is not allowed to process it.
- Valid. A valid document additionally conforms to some semantic rules. These rules are either user-defined, or included as an XML schema or Document Type Definition. For example, if a document contains an undefined tag, then it is not valid; a validating parser is not allowed to process it.
Well-formed documents: XML syntax
As long as only well-formedness is required, XML is a generic framework for storing any amount of text or any data whose structure can be represented as a tree.The only indispensable syntactical requirement is that the document has exactly one root element (alternatively called the document element). This means that the text must be enclosed between a root opening tag and a corresponding closing tag.The following is a well-formed XML document:This is a book....
The root element can be preceded by an optional XML declaration. This element states what version of XML is in use (normally 1.0); it may also contain information about character encoding and external Coupling (computer science).
The specification requires that processors of XML support the pan-Unicode character encodings UTF-8 and UTF-16/UCS-2 (UTF-32/UCS-4 is not mandatory). The use of more limited encodings, such as those based on ISO/IEC 8859, is acknowledged and is widely used and supported.
Comments can be placed anywhere in the tree, including in the text if the content of the element is text or #PCDATA.
XML comments start with <!-- and end with -->. Two dashes (--) may not appear anywhere in the text of the comment.
In any meaningful application, additional markup is used to structure the contents of the XML document. The text enclosed by the root tags may contain an arbitrary number of XML elements.The basic syntax for one element is:contentHere, »content« is some text which may again contain XML elements. So, a generic XML document contains atree (data structure). In this respect, it is similar to the Lisp (programming language) programming language's S-expressions, which describe tree structures wherein each node may have its own property list.Here is an example of a structured XML document:
Basic bread
Flour
Yeast
Water
Salt
Mix all ingredients together.
Knead thoroughly.
Cover with a cloth, and leave for one hour in warm room.
Knead again.
Place in a bread baking tin.
Cover with a cloth, and leave for one hour in warm room.
Bake in the oven at 350° for 30 minutes.
Attribute values must always be quoted, using single or double quotes, and each attribute name should appear only once in any element.XML requires that elements be properly nested — elements may never overlap. For example, the code below is not well-formed XML, because the EM and strong elements overlap:Normal emphasized strong emphasized strongXML provides special syntax for representing an element with empty content. Instead of writing a start tag followed immediately by an end tag, a document may contain an empty-element tag. An empty-element tag resembles a start tag but contains a slash just before the closing angle bracket. The following three examples are equivalent in XML:An empty-element tag may contain attributes:
Entity references
XML provides two methods for referring to special characters: character entity references and numeric character references.
An SGML entity in XML is a named body of data, usually text, such as an unusual character.
An entity reference is a placeholder that represents that entity. It consists of the entity's name preceded by an ampersand ("&") and followed by a semicolon (";"). XML has five predeclared entities:{]. A basic example of doing so in a minimal internal DTD follows. Declared entities can describe single characters or pieces of text, and can reference each other.
]> ©right-notice;
When viewed in a suitable browser, the XML document above appears as:
Copyright © 2006, XYZ Enterprises
Numeric character references
Numeric character references look like entity references, but instead of a name, they contain the "number sign" character followed by a number. The number (in decimal or "x"-prefixed hexadecimal) represents a Unicode code point. Unlike entity references, they are neither predeclared nor do they need to be declared in the document's DTD. They have typically been used to represent characters that are not easily encodable, such as an Arabic language character in a document produced on a European computer. The ampersand in the "AT&T" example could also be escape character like this (decimal 38 and hexadecimal 26 both represent the Unicode code point for the "&" character):AT&TAT&TThere are many more rules necessary to be sure of writing well-formed XML documents, such as the use of XML Namespace and the exact characters allowed in an XML name, but this quick tour provides the basics necessary to read and understand many XML documents.
Well-formed documents
A well-formed document must conform to the following rules, among others:
- Non-empty elements are delimiter by both a start-tag and an end-tag.
- Empty elements may be marked with an empty-element (self-closing) tag, such as <IAmEmpty />. This is equal to <IAmEmpty></IAmEmpty>.
- All attribute values are quoted with either single (') or double (") quotes. Single quotes close a single quote and double quotes close a double quote.
- Tags may be nested but must not overlap. Each non-root element must be completely contained in another element.
- The document complies with its declared character encoding. The encoding may be declared or implied externally, such as in "Content-Type" headers when a document is transported via Hypertext Transfer Protocol, or internally, using explicit markup at the very beginning of the document. When no such declaration exists, a Unicode encoding is assumed, as defined by a Unicode Byte-order mark before the document's first character. If the mark does not exist, UTF-8 encoding is assumed.
Element names are case-sensitive. For example, the following is a well-formed matching pair:
<Step> ... </Step>
whereas this is not
<Step> ... </step>
The careful choice of names for XML elements will convey the meaning of the data in the Markup language. This increases human readability while retaining the rigor needed for software parsing.
Choosing meaningful names implies the semantics of elements and attributes to a human reader without reference to external documentation. However, this can lead to verbosity, which complicates authoring and increases file size.
Automatic verification
It is relatively simple to verify that a document is well-formed or validated XML, because the rules of well-formedness and validation of XML are designed for portability of tools. The idea is that any tool designed to work with XML files will be able to work with XML files written in any XML language (or XML application). One example of using an independent tool follows:
- load it into an XML-capable browser, such as Mozilla Firefox or Internet Explorer
- use a tool like xmlwf (usually bundled with Expat (XML))
- parse the document, for instance in Ruby:
irb> require "rexml/document"
irb> include REXML
irb> doc = Document.new(File.new("test.xml")).root
Valid documents: XML semantics
By leaving the names, allowable hierarchy, and meanings of the elements and attributes open and definable by a customizable XML schema or Document Type Definition, XML provides a syntactic foundation for the creation of purpose specific, XML-based markup languages. The general syntax of such languages is rigid — documents must adhere to the general rules of XML, ensuring that all XML-aware software can at least read and understand the relative arrangement of information within them. The schema merely supplements the syntax rules with a set of constraints. Schemas typically restrict element and attribute names and their allowable containment hierarchies, such as only allowing an element named 'birthday' to contain 1 element named 'month' and 1 element named 'day', each of which has to contain only character data. The constraints in a schema may also include data type assignments that affect how information is processed; for example, the 'month' element's character data may be defined as being a month according to a particular schema language's conventions, perhaps meaning that it must not only be formatted a certain way, but also must not be processed as if it were some other type of data.
An XML document that complies with a particular schema/DTD, in addition to being well-formed, is said to be valid.
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic constraints imposed by XML itself. A number of standard and proprietary XML schema languages have emerged for the purpose of formally expressing such schemas, and some of these languages are XML-based, themselves.
Before the advent of generalised data description languages such as SGML and XML, software designers had to define special file formats or small languages to share data between programs. This required writing detailed specifications and special-purpose parsers and writers.
XML's regular structure and strict parsing rules allow software designers to leave parsing to standard tools, and since XML provides a general, data model-oriented framework for the development of application-specific languages, software designers need only concentrate on the development of rules for their data, at relatively high levels of abstraction.
Well-tested tools exist to validate an XML document "against" a schema: the tool automatically verify whether the document conforms to constraints expressed in the schema. Some of these validation tools are included in XML parsers, and some are packaged separately.
Other usages of schemas exist: XML editors, for instance, can use schemas to support the editing process (by suggesting valid elements and attributes names, etc).
DTD
The oldest schema format for XML is the Document Type Definition (DTD), inherited from SGML. While DTD support is ubiquitous due to its inclusion in the XML 1.0 standard, it is seen as limited for the following reasons:
- It has no support for newer features of XML, most importantly XML Namespace.
- It lacks expressiveness. Certain formal aspects of an XML document cannot be captured in a DTD.
- It uses a custom non-XML syntax, inherited from SGML, to describe the schema.
DTD is still used in many applications because it is considered the easiest to read and write.
XML Schema
A newer XML schema language, described by the W3C as the successor of DTDs, is XML Schema (W3C), or more informally referred to by the acronym and initialism for XML Schema instances, XSD (XML Schema Definition). XSDs are far more powerful than DTDs in describing XML languages. They use a rich datatype system, allow for more detailed constraints on an XML document's logical structure, and must be processed in a more robust validation framework. XSDs also use an XML-based format which makes it possible to use ordinary XML tools to help process them, although XSD implementations require much more than just the ability to read XML.
Criticisms of XSD include the following:
- The specification is very large, which makes it difficult to understand and implement.
- The XML-based syntax leads to verbosity in schema description, which makes XSDs harder to read and write.
- Schema validation can be an expensive addition to XML parsing, especially for high volume systems.
- The modeling capabilities are very limited, with no ability to allow attributes to influence content models.
- The type derivation model is very limited, in particular that derivation by extension is rarely useful.
- Database-related data transfer has been supported with arcane ideas such as nillability but the requirements of industrial publishing are under-supported.
- The key/keyref/uniqueness mechanisms are not type aware
- The PSVI concept (Post Schema Validation Infoset) does not have a standard XML representation or Application Programming Interface, thus it works against vendor independence unless revalidation is performed.
RELAX NG
Another popular schema language for XML is RELAX NG. Initially specified by OASIS (organization), RELAX NG is now also an ISO international standard (as part of DSDL). It has two formats: an XML based syntax and a non-XML compact syntax. The compact syntax aims to increase readability and writability but, since there is a well-defined way to translate the compact syntax to the XML syntax and back again by means of James Clark (XML expert)'s Trang conversion tool, the advantage of using standard XML tools is not lost. RELAX NG has a simpler definition and validation framework than XML Schema, making it easier to use and implement. It also has the ability to use datatype framework plug-ins; a RELAX NG schema author, for example, can require values in an XML document to conform to definitions in XML Schema Datatypes.
ISO DSDL and Other Schema Languages
The ISO DSDL (Document Schema Description Languages) standard brings together a comprehensive set of small schema languages, each targeted at specific problems. DSDL includes RELAX NG full and compact syntax, Schematron assertion language, and languages for defining datatypes, character repertoire constraints, renaming and entity expansion, and namespace-based routing of document fragments to different validators. DSDL schema languages do not have the vendor support of XML Schemas yet, and are to some extent a grassroots reaction of industrial publishers to the lack of utility of XML Schemas for publishing.
Some schema languages not only describe the structure of a particular XML format but also offer limited facilities to influence processing of individual XML files that conform to this format. DTDs and XSDs both have this ability; they can for instance provide attribute defaults. RELAX NG and Schematron intentionally do not provide these; for example the infoset augmentation facility.
International use
XML supports the direct use of almost any Unicode character (other than the ones that have special symbolic meaning in XML, itself, such as the open corner bracket, " element.
Extensible Stylesheet Language (XSL) can be used to alter the format of XML data, either into HTML or other formats that are suitable for a browser to display.
To specify client-side XSL Transformations (XSLT), the following processing instruction is required in the XML:
Client-side XSLT is supported by many web browsers, but not Opera (web browser) before version 9.0. An alternative, rather than being dependent on the end-user's browser capabilities, is to use XSL to convert XML into a displayable format on the Server (computing). The end-user is not aware of what has gone on 'behind the scenes'; all they see is well-formatted, displayable data.
See the XSLT article XSL Transformations#Examples.
XML extensions
- XPath makes it possible to refer to individual parts of an XML document. This provides random access to XML data for other technologies, including XSLT, XSL-FO, XQuery etc. XPath expressions can refer to all or part of the text, data and values in XML elements, attributes, processing instructions, comments etc. They can also access the names of elements and attributes. XPaths can be used in both valid and well-formed XML, with and without defined namespaces.
- XInclude defines the ability for XML files to include all or part of an external file. When processing is complete, the final XML infoset has no XInclude elements, but instead has copied the documents or parts thereof into the final infoset. It uses XPath to refer to a portion of the document for partial inclusions.
- XQuery is to XML what SQL and PL/SQL are to relational databases: ways to access, manipulate and return XML.
- XML Namespaces enable the same document to contain XML elements and attributes taken from different vocabularies, without any naming collisions occurring.
- XML Signature defines the syntax and processing rules for creating digital signatures on XML content.
- XML Encryption defines the syntax and processing rules for encryption XML content.
- XPointer is a system for addressing components of XML-based internet media.
XML files may be served with a variety of MIME. RFC 3023 defines the types "application/xml" and "text/xml", which say only that the data is in XML, and nothing about its semantics. The use of "text/xml" has been criticized as a potential source of encoding problems but is now in the process of being deprecated.http://lists.xml.org/archives/xml-dev/200407/msg00208.html RFC 3023 also recommends that XML-based languages be given media types beginning in "application/" and ending in "+xml"; for example "application/atom+xml" for Atom (standard). This page discusses further XML and MIME.
Processing XML files
Three traditional techniques for processing XML files are:
- Using a programming language and the Simple API for XML Application programming interface.
- Using a programming language and the DOM (XML API) Application programming interface.
- Using a transformation engine and a filter
More recent and emerging techniques for processing XML files are:
- Push Parsing
- Data binding
- Non-extractive XML Processing API such as VTD-XML
Simple API for XML (SAX)
Simple API for XML is a lexical analysis, Event-driven programming interface in which a document is read serially and its contents are reported as "callbacks" to various method (computer science)s on a handler object of the user's design. SAX is fast and efficient to implement, but difficult to use for extracting information at random from the XML, since it tends to burden the application author with keeping track of what part of the document is being processed. It is better suited to situations in which certain types of information are always handled the same way, no matter where they occur in the document.
DOM
Document Object Model is an interface-oriented Application Programming Interface that allows for navigation of the entire document as if it were a tree of "Node (computer science)" objects representing the document's contents. A DOM document can be created by a parser, or can be generated manually by users (with limitations). Data types in DOM Nodes are abstract; implementations provide their own programming language-specific bindings. DOM implementations tend to be memory intensive, as they generally require the entire document to be loaded into memory and constructed as a tree of objects before access is allowed.
Transformation engines and filters
A filter (software) in the Extensible Stylesheet Language (XSL) family can transform an XML file for displaying or Computer printering.
- XSL-FO is a declarative, XML-based page layout language. An XSL-FO processor can be used to convert an XSL-FO document into another non-XML format, such as PDF.
- XSLT is a declarative, XML-based document transformation language. An XSLT processor can use an XSLT stylesheet as a guide for the conversion of the data tree represented by one XML document into another tree that can then be serialized as XML, HTML, plain text, or any other format supported by the processor.
- XQuery is a W3C language for querying, constructing and transforming XML data.
- XPath is a DOM-like node tree data model and path expression language for selecting data within XML documents. XSL-FO, XSLT and XQuery all make use of XPath. XPath also includes a useful function library.
=== Push Parsing ===A form of XML access that has become increasingly popular in recent years is push parsing, Push, Pull, Next! by Bob DuCharme, at XML.com which treats the document as if it were a series of items which are being read in sequence. This allows for writing of recursive descent parser in which the structure of the code performing the parsing mirrors the structure of the XML being parsed, and intermediate parsed results can be used and accessed as local variables within the methods performing the parsing, or passed down (as method parameters) into lower-level methods, or returned (as method return values) to higher-level methods. For instance, in the Java (programming language) programming language, the StAX framework can be used to create what is essentially an 'iterator' which sequentially visits the various elements, attributes, and data in an XML document. Code which uses this 'iterator' can test the current item (to tell, for example, whether it is a start or end element, or text), and inspect its attributes (local name, namespace, values of XML attributes, value of text, etc.), and can also request that the iterator be moved to the 'next' item. The code can thus extract information from the document as it traverses it. One significant advantage of push-parsing methods is that they typically are much more speed- and memory-efficient than SAX and DOM styles of parsing XML. Another advantage is that the recursive-descent approach tends to lend itself easily to keeping data as typed local variables in the code doing the parsing, while SAX, for instance, typically requires a parser to manually maintain intermediate data within a stack of elements which are parent elements of the element being parsed. This tends to mean that push-parsing code is often much more straightforward to understand and maintain than SAX parsing code. Some potential disadvantages of push parsing are that it is a newer approach which is not as well known among XML programmers (although it is by far the most common method used for writing compilers and interpreters for languages other than XML), and that most existing push parsers cannot yet perform advanced processing such as XML schema validation as they parse a document.
Data binding
Another form of XML Processing API is XML data binding, where XML data is made available as a custom, strongly typed programming language data structure, in contrast to the interface-oriented DOM. Example data binding systems are the Java (programming language) Architecture for XML Binding (JAXB)http://java.sun.com/xml/jaxb/ and the Strathclyde Novel Architecture for Querying XML (SNAQue).http://www.cis.strath.ac.uk/research/snaque/
Non-extractive XML Processing API
Non-extractive XML Processing API is a new and emerging category of parsers. The most representative is VTD-XML, which abolishes the object-oriented modeling of XML hierarchy and instead uses 64-bit Virtual Token Descriptors (encoding offsets, lengths, depths, and types) of XML tokens. VTD-XML's approach enables a number of interesting features/enhancements, such as high performance, low memory usage http://www.javaworld.com/javaworld/jw-03-2006/jw-0327-simplify.html, ASIC implementation http://www.ximpleware.com/wp_SUN.pdf, incremental update http://www.javaworld.com/javaworld/jw-07-2006/jw-0724-vtdxml.html, and native XML indexing http://vtd-xml.sf.net/persistence.html.
Specific XML applications and editors
The native file format of OpenOffice.org, AbiWord, and Apple Computer's iWork applications is XML. Some parts of Microsoft Office 2007 are also able to edit XML files with a user-supplied schema (but not a DTD), and Microsoft has released a file format compatibility kit for Office 2003 that allows previous versions of Office to save in the new XML based format. There are dozens of other XML editors available.
History
The versatility of SGML for dynamic information display was understood by early digital media publishers in the late 1980s prior to the rise of the Internet. By the mid-1990s some practitioners of SGML had gained experience with the then-new World Wide Web, and believed that SGML offered solutions to some of the problems the Web was likely to face as it grew. Dan Connolly added SGML to the list of W3C's activities when he joined the staff in 1995; work began in mid-1996 when Jon Bosak developed a charter and recruited collaborators. Bosak was well connected in the small community of people who had experience both in SGML and the Web. He received support in his efforts from Microsoft.
XML was compiled by a working group of eleven members,The working group was originally called the "Editorial Review Board." The original members and seven who were added before the first edition was complete, are listed at the end of the first edition of the XML Recommendation, at http://www.w3.org/TR/1998/REC-xml-19980210. supported by an (approximately) 150-member Interest Group. Technical debate took place on the Interest Group mailing list and issues were resolved by consensus or, when that failed, majority vote of the Working Group. The decision record was compiled by Michael Sperberg-McQueen on December 4th 1997. Reports From the W3C SGML ERB to the SGML WG And from the W3C XML ERB to the XML SIG James Clark (XML expert) served as Technical Lead of the Working Group, notably contributing the empty-element "" syntax and the name "XML". Other names that had been put forward for consideration included "MAGMA" (Minimal Architecture for Generalized Markup Applications), "SLIM" (Structured Language for Internet Markup) and "MGML" (Minimal Generalized Markup Language). The co-editors of the specification were originally Tim Bray and Michael Sperberg-McQueen. Halfway through the project Bray accepted a consulting engagement with Netscape Communications Corporation, provoking vociferous protests from Microsoft. Bray was temporarily asked to resign the editorship. This led to intense dispute in the Working Group, eventually solved by the appointment of Microsoft's Jean Paoli as a third co-editor.
The XML Working Group never met face-to-face; the design was accomplished using a combination of email and weekly teleconferences. The major design decisions were reached in twenty weeks of intense work between July and November of 1996, when the first Working Draft of an XML specification was published.http://www.w3.org/TR/WD-xml-961114.html Further design work continued through 1997, and XML 1.0 became a W3C Recommendation on February 10, 1998.
XML 1.0 achieved the Working Group's goals of Internet usability, general-purpose usability, SGML compatibility, facilitation of easy development of processing software, minimization of optional features, legibility, formality, conciseness, and ease of authoring.Like its antecedent SGML, XML allows for some redundant syntactic constructs and includes repetition of element identifiers. In these respects, terseness was not considered essential in its structure.
Sources
XML is a profile of an ISO standard SGML, and most of XML comes from SGML unchanged. From SGML comes the separation of logical and physical structures (elements and entities), the availability of grammar-based validation (DTDs), the separation of data and metadata (elements and attributes), mixed content, the separation of processing from representation (processing instructions), and the default angle-bracket syntax. Removed were the SGML Declaration (XML has a fixed delimiter set and adopts Unicode as the document Character encoding).
Other sources of technology for XML were the Text Encoding Initiative (TEI), which used a simpler syntax than full SGML; HTML, in which elements were synchronous with their resource, the separation of document character set from resource encoding, the xml:lang attribute, and the HTTP notion that metadata accompanied the resource rather than being needed at the declaration of a link; and the Extended Reference Concrete Syntax (ERCS), from which XML 1.0's naming rules were taken, and which had introduced hexadecimal numeric character references and the concept of references to make available all Unicode characters.
Ideas that developed during discussion which were novel in XML, were the algorithm for encoding detection and the encoding header, the processing instruction target, the xml:space attribute, and the new close delimiter for empty element tags.
Versions
There are two current versions of XML. The first, XML 1.0, was initially defined in 1998. It has undergone minor revisions since then, without being given a new version number, and is currently in its fourth edition, as published on August 16, 2006. It is widely implemented and still recommended for general use. The second, XML 1.1, was initially published on February 4, 2004, the same day as XML 1.0 Third Edition, and is currently in its second edition, as published on August 16, 2006. It contains features — some contentious — that are intended to make XML easier to use in certain cases - mainly enabling the use of line-ending characters used on EBCDIC platforms, and the use of scripts and characters absent from Unicode 2.0. XML 1.1 is not very widely implemented and is recommended for use only by those who need its unique features. {{cite book | last = Harold
| first = Elliotte Rusty
| title = Effective XML
| publisher = Addison-Wesley
| date = 2004
| pages = 10-19
| url = http://www.cafeconleche.org/books/effectivexml/
| isbn = 0321150406-->
XML 1.0 and XML 1.1 differ in the requirements of characters used for element and attribute names: XML 1.0 only allows characters which are defined in Unicode 2.0, which includes most world scripts, but excludes those which were added in later Unicode versions. Among the excluded scripts are Mongolian language, Cambodian language, Amharic, Burmese language, and others.
Almost any Unicode character can be used in the character data and attribute values of an XML 1.1 document, even if the character is not defined, aside from having a code point, in the current version of Unicode. The approach in XML 1.1 is that only certain characters are forbidden, and everything else is allowed, whereas in XML 1.0, only certain characters are explicitly allowed, thus XML 1.0 cannot accommodate the addition of characters in future versions of Unicode.
In character data and attribute values, XML 1.1 allows the use of more control characters than XML 1.0, but, for "robustness", most of the control characters introduced in XML 1.1 must be expressed as numeric character references. Among the supported control characters in XML 1.1 are two line break codes that must be treated as whitespace. Whitespace characters are the only control codes that can be written directly.
There are also discussions on an XML 2.0, although it remains to be seen if such will ever come about. XML-SW (SW for skunk works), written by one of the original developers of XML, contains some proposals for what an XML 2.0 might look like: elimination of DTDs from syntax, integration of namespace (computer science)#XMLs, XML Base and XML Information Set (infoset) into the base standard.
The World Wide Web Consortium also has an XML Binary Characterization Working Group doing preliminary research into use cases and properties for a binary encoding of the XML infoset. The working group is not chartered to produce any official standards. Since XML is by definition text-based, ITU-T and ISO are using the name Fast Infoset for their own binary infoset to avoid confusion (see ITU-T Rec. X.891 | ISO/IEC 24824-1).
Patent claims
In October 2005 the small company Scientigo publicly asserted that two of its patents, and , apply to the use of XML. The patents cover the "modeling, storage and transfer data in a particular non-hierarchical, non-integrated neutral form", according to their applications, which were filed in 1997 and 1999. Scientigo CEO Doyal Bryant expressed a desire to "monetize" the patents but stated that the company was "not interested in having us against the world." He said that Scientigo was discussing the patents with several large corporations.http://news.com.com/Small+company+makes+big+claims+on+XML+patents/2100-1014_3-5905949.html
XML users and independent experts responded to Scientigo's claims with widespread skepticism and criticism. Some derided the company as a patent troll. Tim Bray described any claims that the patents covered XML as "ridiculous on the face of it".http://blogs.zdnet.com/BTL/?p=2052
Because there exists a large amount of prior art relating to XML, including SGML, some legal experts believed it would be difficult for Scientigo to enforce its patents through litigation.
== Critique of XML ==Commentators have offered various critiques of XML, suggesting circumstances where XML provides both advantages and potential disadvantages.(See e.g., XML-QL Proposal discussing XML benefits, When to use XML, "XML Sucks" on c2.com, Daring to Do Less with XML)
"XML is really just data dressed up as a hooker."
-[Dave Thomas (programmer)Neal Ford, Language Oriented Programming, The Server Side's Java Symposium, 2007
Advantages of XML
- It is text-based.
- It supports Unicode, allowing almost any information in any written human language to be communicated.
- It can represent the most general computer science data structures: record (computer science)s, List (computing)s and tree data structures.
- Its self-documenting format describes structure and field names as well as specific values.
- The strict syntax and parsing requirements make the necessary parser extremely simple, efficient, and consistent.
- XML is heavily used as a format for document storage and processing, both online and offline.
- It is based on international standards.
- It can be updated incrementally.
- It allows validation using schema languages such as XSD and Schematron, which makes effective unit-testing, firewalls, acceptance testing, contractual specification and software construction easier.
- The hierarchy structure is suitable for most (but not all) types of documents.
- It manifests as plain text files, which are less restrictive than other proprietary document formats.
- It is platform-independent, thus relatively immune to changes in technology.
- Forward and backward compatibility are relatively easy to maintain despite changes in DTD or Schema.
- Its predecessor, SGML, has been in use since 1986, so there is extensive experience and software available.
- An element fragment of a well-formed XML document is also a well-formed XML document.
Disadvantages of XML
- XML syntax is redundant or large relative to binary representations of similar data.
{{cite book| last = Rusty| first = Elliotte| title = Processing XML with Java(tm): a guide to SAX, DOM, JDOM, JAXP, and TrAX| publisher = Addison-Wesley| year = 2002| id = 0201771861| ref = Reference-Rusty-2002-a-->XML documents are too verbose compared with binary equivalents.
- The redundancy may affect application efficiency through higher storage, transmission and processing costs.
{{cite book| last = Rusty| first = Elliotte| title = Xml in a Nutshell: A Desktop Quick Reference| publisher = O'Reilly| year = 2002| id = 0596002920| ref = Reference-Rusty-2002-b--> XML documents are very verbose and searching is inefficient forhigh-performance largescale database applications.However, the Binary XML effort strives to alleviate these problems by using a binary representation for the XML document. For example, the Java (programming language) reference implementation of the Fast Infoset standard parsing speed is better by a factor 10 compared to Java (programming language) Xerces, and by a factor 4 compared to the Piccolo driver, one of the fastest Java-based XML parser .
- XML syntax is verbose relative to other alternative 'text-based' data transmission formats.
{{cite book| last = Bierman| first = Gavin| title = Database Programming Languages: 10th international symposium, DBPL 2005 Trondheim, Norway| publisher = Springer| year = 2005| id = 3540309519-->XML syntax is too verbose for human readers in for certain applications.Proposes a dual syntax for human readability.Although many purportedly"less verbose" text formats actually cite XML asboth inspiration and prior art.See e.g., http://yaml.org/spec/current.html,http://innig.net/software/sweetxml/index.html,http://www.json.org/xml.html.
- No intrinsic data type support: XML provides no specific notion of "integer", "string", "boolean", "date", and so on.For example, there is no provision for mandating that "3.14159" be a floating-point number rather than a seven-character string. Such conversions require processing. However, XML schema descriptions of XML documents add data-type support to XML processing.
{{cite book| last = Blanken| first = Henk M.| title = Intelligent Search on Xml Data: Applications, Languages, Models, Implementations, and Benchmarks| publisher = Springer| year = 2003| id = 3540407685-->Proposes a system for recognizing custom-defined data types.
- The hierarchical model for representation is limited in comparison to the relational model or an object oriented Graph (mathematics).A hierachical model only gives a fixed, monolithic view of the tree structure. For example, either actors under movies, or movies under actors, but not both.
{{cite book| last = Lim| first = Ee-Peng| title = Digital Libraries: People, Knowledge, and Technology| publisher = Springer| year = 2002| id = 3540002618-->Discusses some of the limitation with fixed hierarchy. Proceedings of the 5th International Conference on Asian Digitial Libraries, ICADL 2002, held in Singapore in December 2002.
- Expressing overlapping (non-hierarchical) node relationships requires extra effort.{{cite book
| last = Searle| first = Leroy F.| title = Voice, text, hypertext: emerging practices in textual studies| publisher = University of Washington Press| year = 2004| id = 0295983051--> Proposes an alternative system for encoding overlapping elements.
- XML namespaces are problematic to use and namespace support can be difficult to correctly implement in an XML parser.(See e.g., http://www-128.ibm.com/developerworks/library/x-abolns.html )
- XML is commonly depicted as "self-documenting" but this depiction ignores critical ambiguities.{{cite web
| title = The Myth of Self-Describing XML| url = http://www.oceaninformatics.biz/publications/e2.pdf| accessdate = 2007-05-12-->(See e.g., Use–mention distinction, Naming collision, Polysemy)
See also
- XML query language
- XML schema languages:
- XML Certification Program
- XRI, XDI
- YAML
Notes and references
External links
Specifications
- W3C XML homepage
- The XML 1.0 specification
- The XML 1.1 specification
Parsers
- VTD-XML a next generation, open-source, XML parser/indexer available in C, C# and Java
- Expat (XML) free stream-oriented XML 1.0 parser library, written in C.
- Libxml2 free XML C parser and toolkit.
- RomXML Embedded XML commercial toolkit written in ANSI-C.
Sources
- Introduction to Generalized Markup by Charles Goldfarb
- Annex A of ISO 8879:1986 (SGML)
- The Multilingual WWW by Gavin Nicol
- Retrospective on Extended Reference Concrete Syntax by Rick Jelliffe
XML UK: a forum for SGML and XML users and developers
XML UK is the United Kingdom chapter of the International SGML/XML Users' Group (ISUG). It provides a forum for SGML and XML users and developers to share their experiences and ...
xml.org.uk: About
XML UK http://xml.org.uk/about Private Company Limited by Guarantee without share capital. Registered in England and Wales. Number: 05146009. Incorporated: 04 June 2004
Focus Area News | XML.org focus area community
News, education, and information about the application in industrial and commercial settings.
XML.com: XML From the Inside Out -- XML development, XML resources ...
Information, articles, and services from Seybold Publications and Songline Studios (O'Reilly and Associates). Resource guide includes links to W3C and related developments, drafts ...
XML.com: A Technical Introduction to XML
What is XML? This introduction to XML is geared towards a reader with some HTML or SGML experience, although that experience is not absolutely necessary. This article is an update ...
xml.apache.org
Different open source tools, most of which use the Xerces implementation (DOM Level 1 and 2) as a base. Xerces itself is available in Java, C++, Perl, and COM.
XML well-formedness checker and validator
XML well-formedness checker and validator. Use this form to check an XML document for well-formedness and (optionally) validity. External entity references are included, even when ...
XML Tutorial
Examples of viewing, parsing, displaying and transforming data.