Share your knowledge and create a knowledgebase.
Claiming to make accessible the same APIs that it uses for iPhone development, Apple today announced that the object-oriented application programming environment that will be used for the iPhone SDK. Accessible features include:
* Core Animation — letting developers build animations, ala CoverFlow
* OpenGL in an iPhone-optimized edition
* Core Audio
* SQLLite
The iPhone’s Core OS uses the same kernel as Mac OS X in a scaled-down, power-optimized version.
Apple also announced that Xcode will be the development tool of choice for the iPhone. A revised edition for the Mac OS X development environment will include an interface builder for the iPhone, performance testing tools and a remote debugger that can connect to an iPhone.
There will also be an iPhone simulator which runs on Macs and emulates the iPhone.
Apple CEO Steve Jobs unlocked the iPhone’s true capabilities. Apple put out a beta version of an iPhone SDK, or software development kit, which allows third-party programmers to create applications for the iPhone.
The program will go live for the public in June, when Apple releases version 2.0 of the iPhone’s system software. The new capabilities will go out to all iPhones for free.
That is, in a few months’ time, everyone’s iPhone will be able to run programs made by a software developers across the world, not just those in Cupertino. Firefox for the iPhone — not to mention Quicken for the iPhone, 3-D games for iPhone, maybe even Skype for the iPhone — is no longer a dream. It’s a reality.
I have to admit, I’ve been skeptical that Apple would do the right thing here. Last year, it didn’t treat third-party apps — created without Apple’s approval — very kindly when it issued an iPhone software update.
Jobs, in defending keeping other people’s programs off the iPhone, often suggested that security was the problem — if just anyone could create programs for the iPhone, he said, AT&T’s cellular network would be made vulnerable to iPhone viruses.
This claim seemed specious: Surely Apple could find a way to keep malware off the phone while allowing useful apps an entry? So what was the real reason for the lock? Was it money? Was it Jobs being a control-freak — did he want to personally approve everything that got on to the phone?
There was also the worry that Apple would allow third-party apps, but would demand a huge licensing fee from anyone who wanted to create iPhone programs. This would limit developer interest: If they have to pay Apple to make software for the iPhone, the best developers were likely to choose a more hospitable mobile platform. Like, say, Google’s Android phone.
Though he didn’t mention the competition during his announcement at Apple’s headquarters today, it seems reasonable to guess that Google’s entry into the phone market helped prompt Jobs’ change of tune. Today’s announcement goes far in cementing the iPhone as the leading mobile platform — Apple’s SDK looks so powerful, and its licensing terms are so reasonable, that mobile developers would be crazy not to adopt the iPhone as their main focus.
Under the new system, Apple has created something called the iPhone App Store. The store, which you access through the phone itself, lets you browse through all third-party applications available for the phone. You can buy and start using them instantly. Developers will be able to choose the sales price; they’ll keep 70 percent of the revenues, and Apple will get 30 percent (which is similar to the the sharing model Apple uses for music sales on iTunes).
But here’s the best part: If you want to "sell" your program for free, Apple will charge no fee to developers. This is an obvious boon to free software projects like Firefox.
You can expect many big software companies to get into the iPhone applications business. At the presentation today, EA Games, Sega, Salesforce.com, AOL, and others showed off some great iPhone sample programs they’d created in just a few weeks’ time.
Apple says that the SDK is the very same system that its own developers use to make iPhone programs, meaning that third-party developers will be able to do everything that Apple’s programs do. (There are some exceptions: Voice-over IP programs like Skype will only work on the iPhone’s Wi-Fi network, not its AT&T cellular network. Presumably, this limitation is an AT&T demand.)
But not only big companies will make iPhone programs. Today Kleiner Perkins, the huge Silicon Valley venture capital firm, announced a $100-million fund to invest in new companies looking to create programs for the iPhone.
At the Apple event, Kleiner partner John Doerr hailed Steve Jobs as the "world’s greatest entrepreneur."
In making the iPhone accessible to other entrepreneurs — software developers everywhere with with bright, useful ideas — Jobs may have proven Doerr right. The iPhone, now that it’s open, could really be huge.
iPhone SDK exceeds developer expectations
Apple SDK should please three core constituencies: Developers, enterprise IT and consumers.
Here are few major things which goes towards happy devloper base:
Developers get a solid database and a familiar API tool set
What pleased developers was a set of functionality that will let them write native iPhone applications through access to the iPhone APIs.
In addition, Apple hit the right note by offering SQL Lite as the built-in database layer. SQL Lite, an open-source database, is widely used by the mobile developer community and runs well on small devices. "It will make it easy to store data".
Cocoa Touch, the built-in set of APIs that re-creates the Cocoa tool set used to handle the user-interface-generated events in Mac OS X is targeted at the iPhone’s and iPod Touch’s unique touchscreen as well as their gesture-based UI. "It’s an elegant way to deal with the interface paradigm".
IT gets better, more secure connections
Also garnering praise from mobile industry watchers is the planned inclusion of Microsoft Exchange ActiveSync, the technology required to synchronize mail, calendar, and other data directly with Microsoft Exchange rather than use third-party gateways or synchronization services. Apple licensed the technology from Microsoft and will include it in the iPhone 2.0 software planned for release this June. (All the additional features described here will be released with that software update, Apple said.)
The iPhone also will gain remote wipe and lock and on-device data encryption, two features that caused much IT criticism. Plus, Apple will enhance the VPN capabilities it added to the iPhone in late 2007, adding support for Cisco IPsec and two-factor authentication, certificates, and identities. Information Builders’ Kotorov said he was particularly enthusiastic about iPhone’s deepened support for VPNs. Apple will also provide a way for IT to enforce security policies on the iPhone, though the mechanism was not described at the Apple press conference.
Users get push messaging and desktop equivalency
The licensing of ActiveSync benefits not just IT but users in Microsoft Exchange-based environments. They not only can access the same calendar, contacts, e-mail, and other data as they can from their desktop, but they also gain push e-mail. In push e-mail, the iPhone gets a new message almost as soon as it is sent — a feature beloved by users of the BlackBerry, which pioneered the concept. Previously, the iPhone had to poll the server periodically, typically at 15-minute intervals, so unless users manually polled the server, an urgent message might not be seen for some time.
Still, IT won’t be completely happy
As welcome as the SDK and enhanced business-oriented features are, people still have more they want Apple to offer.
A common request is availability from more than one carrier. Currently, the iPhone only works on the AT&T network. "Companies don’t want a single carrier for voice and data" according to Forrester’s Yates.
Second, the iPhone isn’t supported by management tools like LanDesk and lacks a consistent set of management tools like those from Credant Technologies and LanDesk, which support BlackBerry, Windows Mobile, and Palm OS devices. This means that IT has to manage the iPhone separately from other devices as well as separately from PCs. "What [Apple] needs to do is natively integrate into management tools that companies already use for their other mobile devices," Yates said.
Perhaps worse, the iPhone requires IT and developers to push applications to users through the Apple iPhone store. Apple says it is doing so in a way that will be IT-friendly, though it did not specify any details: "We’re working on a model for enterprises for them to distribute applications to their end-users, specifically with a program for them to target their end-users. We have a model we’re building for that," said Phil Schiller, a product marketing exec at Apple.
The following example illustrates how to use an external entity reference handler to include and parse other documents, as well as how PIs can be processed, and a way of determining "trust" for PIs containing code.
Consider the following XML’s
< ?xml version=’1.0′?>
< !DOCTYPE chapter SYSTEM "/just/a/test.dtd" [
<!ENTITY plainEntity "FOO entity">
< !ENTITY systemEntity SYSTEM "xmltest2.xml">
]>
<chapter>
<title>Title &plainEntity;</title>
<para>
<informaltable>
<tgroup cols="3">
<tbody>
<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row>
<row><entry>a2</entry><entry>c2</entry></row>
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
&systemEntity;
<section id="about">
<title>About this Document</title>
<para>
<!– this is a comment –>
< ?php echo ‘Hi! This is PHP version ‘ . phpversion(); ?>
</para>
</section>
</chapter>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY testEnt "test entity">
]>
<foo>
<element attrib="value"/>
&testEnt;
<?php echo "This is some more PHP code being executed."; ?>
</foo>
The following code shows how we can parse the above XML file using PHP
< ?php
$file = "xmltest.xml";
function trustedFile($file)
{
// only trust local files owned by ourselves
if (!eregi("^([a-z]+)://", $file)
&& fileowner($file) == getmyuid()) {
return true;
}
return false;
}
function startElement($parser, $name, $attribs)
{
echo "<<font color=\"#0000cc\">$name";
if (count($attribs)) {
foreach ($attribs as $k => $v) {
echo " <font color=\"#009900\">$k</font>=\"<font color=\"#990000\">$v</font>\"";
}
}
echo ">";
}
function endElement($parser, $name)
{
echo "</<font color=\"#0000cc\">$name</font>>";
}
function characterData($parser, $data)
{
echo "<b>$data</b>";
}
function PIHandler($parser, $target, $data)
{
switch (strtolower($target)) {
case "php":
global $parser_file;
// If the parsed document is "trusted", we say it is safe
// to execute PHP code inside it. If not, display the code
// instead.
if (trustedFile($parser_file[$parser])) {
eval($data);
} else {
printf("Untrusted PHP code: <i>%s</i>",
htmlspecialchars($data));
}
break;
}
}
function defaultHandler($parser, $data)
{
if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
printf(’<font color="#aa00aa">%s</font>’,
htmlspecialchars($data));
} else {
printf(’<font size="-1">%s</font>’,
htmlspecialchars($data));
}
}
function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId,
$publicId) {
if ($systemId) {
if (!list($parser, $fp) = new_xml_parser($systemId)) {
printf("Could not open entity %s at %s\n", $openEntityNames,
$systemId);
return false;
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($parser, $data, feof($fp))) {
printf("XML error: %s at line %d while parsing entity %s\n",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser), $openEntityNames);
xml_parser_free($parser);
return false;
}
}
xml_parser_free($parser);
return true;
}
return false;
}
function new_xml_parser($file)
{
global $parser_file;
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
xml_set_processing_instruction_handler($xml_parser, "PIHandler");
xml_set_default_handler($xml_parser, "defaultHandler");
xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
if (!($fp = @fopen($file, "r"))) {
return false;
}
if (!is_array($parser_file)) {
settype($parser_file, "array");
}
$parser_file[$xml_parser] = $file;
return array($xml_parser, $fp);
}
if (!(list($xml_parser, $fp) = new_xml_parser($file))) {
die("could not open XML input");
}
echo "<pre>";
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d\n",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
echo "</pre>";
echo "parse complete\n";
xml_parser_free($xml_parser);
?>
I hope this will help. Your comments are welcome.
By handling mime-types and using browser detection, CodeHelp has already shown how to export XML using a PHP script. PHP can also receive XML as input - using the XML parser:
if (!($fp=@fopen("./contactsbare.xml", "r")))
die ("Couldn’t open XML.");
$usercount=0;
$userdata=array();
$state=”;
if (!($xml_parser = xml_parser_create()))
die("Couldn’t create parser.");
Each XML file can have it’s own DTD or structure. The PHP file using the XML parser must be tailored to one particular structure or DTD - it will then be able to read all files that are valid under that DTD. This example will use an over-simplified contacts format for XML - you will need to adapt the details of the tags (or nodes) for your own DTD. To follow the construction of the XML parser, load the example XML file into another window using the link in the Navigation Bar. (If the file doesn’t open in a new window in your browser, right click the link and choose Open in a New Window.) Multiple contacts can be specified by repeating the CONTACT tag and the PHP file therefore needs to keep track of the number of contacts used in this example. In the above code, $usercount is set to zero ready to hold the number of contacts found. $userdata will later be filled with data for each contact and $state is used to keep track of which node the parser is dealing with for each contact.
The PHP XML parser now needs two functions to be declared, one to handle the element data and one to handle the character data within the elements. This is where you need to change the code to reflect your own XML files - change the element and attribute names. I’ll start with the Element Handler. This is in two parts, a function to detect the start of real data and a function to detect when an element comes to an end - in this case to register when more than one contact is specified. Each function is called once for each node - use a switch statement to decide what action to take depending on which node is being processed. The parser will take care of the $name and $attrib variables.
function startElementHandler ($parser,$name,$attrib){
global $usercount;
global $userdata;
global $state;
switch ($name) {
case $name=="NAME" : {
$userdata[$usercount]["first"] = $attrib["FIRST"];
$userdata[$usercount]["last"] = $attrib["LAST"];
$userdata[$usercount]["nick"] = $attrib["NICK"];
$userdata[$usercount]["title"] = $attrib["TITLE"];
break;
}
}
}
function endElementHandler ($parser,$name){
global $usercount;
global $userdata;
global $state;
$state=”;
if($name=="CONTACT") {$usercount++;}
}
The function "startElementHandler()" has been abbreviated here by removing the other case $name=="" : {} statements, the full file will be looked at later.
Next, we need the character handler:
function characterDataHandler ($parser, $data) {
global $usercount;
global $userdata;
global $state;
if (!$state) {return;}
if ($state=="COMPANY") { $userdata[$usercount]["bcompany"] = $data;}
if ($state=="GENDER") { $userdata[$usercount]["gender"] = $data;}
}
Finally, tell the parser which functions to use, read the data from the opened file and parse the contents.
xml_set_element_handler($xml_parser,"startElementHandler","endElementHandler");
xml_set_character_data_handler( $xml_parser, "characterDataHandler");
while( $data = fread($fp, 4096)){
if(!xml_parse($xml_parser, $data, feof($fp))) {
break;}}
xml_parser_free($xml_parser);
The data from the XML file is now held in $userdata and can be accessed using a standard PHP loop:
for ($i=0;$i<$usercount; $i++) {
echo "Name: ".$userdata[$i]["title"]." ".
ucfirst($userdata[$i]["first"])." ". ucfirst($userdata[$i]["last"]);
}
Extensible Markup Language (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 elements. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet, and it is used both to encode documents and to serialize data.
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 start-tag and a corresponding end-tag. The following is a "well-formed" XML document:
<book>This is a book…. </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 dependencies.
<?xml version="1.0" encoding="UTF-8"?>
Here is an example of a structured XML document:
<recipe name="bread" prep_time="5 mins" cook_time="3 hours">
<title>Basic bread</title>
<ingredient amount="3" unit="cups">Flour</ingredient>
<ingredient amount="0.25" unit="ounce">Yeast</ingredient>
<ingredient amount="1.5" unit="cups" state="warm">Water</ingredient>
<ingredient amount="1" unit="teaspoon">Salt</ingredient>
<instructions>
<step>Mix all ingredients together.</step>
<step>Knead thoroughly.</step>
<step>Cover with a cloth, and leave for one hour in warm room.</step>
<step>Knead again.</step>
<step>Place in a bread baking tin.</step>
<step>Cover with a cloth, and leave for one hour in warm room.</step>
<step>Bake in the oven at 350°F for 30 minutes.</step>
</instructions>
</recipe>
Entity references
An entity in XML is a named body of data, usually text. Entities are often used to represent single characters that cannot easily be entered on the keyboard; they are also used to represent pieces of standard ("boilerplate") text that occur in many documents, especially if there is a need to allow such text to be changed in one place only.
Special characters can be represented either using entity references, or by means of numeric character references. An example of a numeric character reference is "€", which refers to the Euro symbol by means of its Unicode codepoint in hexadecimal.
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:
& & ampersand
< < less than
> > greater than
' ‘ apostrophe
" " quotation mark
Here is an example using a predeclared XML entity to represent the ampersand in the name "AT&T":
<company_name>AT&T</company_name>
Additional entities (beyond the predefined ones) can be declared in the document’s Document Type Definition (DTD). 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.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE example [
<!ENTITY copy "©">
<!ENTITY copyright-notice "Copyright © 2006, hurricanesoftwares.com">
]>
<example>
©right-notice;
</example>
When viewed in a suitable browser, the XML document above appears as:
<example> Copyright © 2006, Hurricanesoftwares.com </example>
Numeric character references
Numeric character references look like entity references, but instead of a name, they contain the "#" 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 character in a document produced on a European computer. The ampersand in the "AT&T" example could also be escaped like this (decimal 38 and hexadecimal 26 both represent the Unicode code point for the "&" character):
<company_name>AT&T</company_name>
<company_name>AT&T</company_name>
Well-formed documents
In XML, a well-formed document must conform to the following rules, among others:
* Non-empty elements are delimited 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 HTTP, 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>
By carefully choosing the names of the XML elements one may convey the meaning of the data in the markup. 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 Firefox or Internet Explorer
* use a tool like xmlwf (usually bundled with expat)
* parse the document, for instance in Ruby:
irb> require "rexml/document"
irb> include REXML
irb> doc = Document.new(File.new("test.xml")).root
Displaying XML on the web
XML documents do not carry information about how to display the data. Without using CSS or XSL, a generic XML document is rendered as raw XML text by most web browsers. Some display it with ‘handles’ (e.g. + and - signs in the margin) that allow parts of the structure to be expanded or collapsed with mouse-clicks.
In order to style the rendering in a browser with CSS, the XML document must include a reference to the stylesheet:
<?xml-stylesheet type="text/css" href="myStyleSheet.css"?>
Note that this is different from specifying such a stylesheet in HTML, which uses the <link> 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 Transformation (XSLT), the following processing instruction is required in the XML:
<?xml-stylesheet type="text/xsl" href="myTransform.xslt"?>
Client-side XSLT is supported by many web browsers. Alternatively, one may use XSL to convert XML into a displayable format on the server rather than being dependent on the end-user’s browser capabilities. The end-user is not aware of what has gone on ‘behind the scenes’; all they see is well-formatted, displayable data.
Processing XML files
Three traditional techniques for processing XML files are:
* Using a programming language and the SAX API.
* Using a programming language and the DOM API.
* Using a transformation engine and a filter
More recent and emerging techniques for processing XML files are:
* Pull Parsing
* Data binding
Simple API for XML (SAX)
SAX is a lexical, event-driven interface in which a document is read serially and its contents are reported as "callbacks" to various methods 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
DOM is an interface-oriented Application Programming Interface that allows for navigation of the entire document as if it were a tree of "Node" 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. DOM is supported in Java by several packages that usually come with the standard libraries. As the DOM specification is regulated by the World Wide Web Consortium, the main interfaces (Node, Document, etc.) are in the package org.w3c.dom.*, as well as some of the events and interfaces for other capabilities like serialization (output). The package com.sun.org.apache.xml.internal.serialize.* provides the serialization (output capacities) by implementing the appropriate interfaces, while the javax.xml.parsers.* package parses data to create DOM XML documents for manipulation.
Transformation engines and filters
A filter in the Extensible Stylesheet Language (XSL) family can transform an XML file for displaying or printing.
* 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.
Pull parsing
Pull parsing [6] treats the document as a series of items which are read in sequence using the Iterator design pattern. This allows for writing of recursive-descent parsers 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. Examples of pull parsers include StAX in the Java programming language, SimpleXML in PHP and System.Xml.XmlReader in .NET.
A pull parser creates an iterator that 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 move the iterator to the ‘next’ item. The code can thus extract information from the document as it traverses it. The recursive-descent approach tends to lend itself 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. Pull-parsing code can be more straightforward to understand and maintain than SAX parsing code.
Data binding
Another form of XML Processing API is 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 include the Java Architecture for XML Binding (JAXB).
Non-extractive XML Processing API
Non-extractive XML Processing API is a new and emerging category of parsers that aim to overcome the fundamental limitations of DOM and SAX. 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, ASIC implementation, incremental update, and native XML indexing .
Specific XML applications and editors
The native file format of OpenOffice.org, AbiWord, and Apple’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.
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 common computer science data structures: records, lists and trees.
* Its self-documenting format describes structure and field names as well as specific values.
* The strict syntax and parsing requirements make the necessary parsing algorithms 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 hierarchical structure is suitable for most (but not all) types of documents.
* 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, especially with tabular data.
* The redundancy may affect application efficiency through higher storage, transmission and processing costs.
* XML syntax is verbose, especially for human readers, relative to other alternative ‘text-based’ data transmission formats.
* The hierarchical model for representation is limited in comparison to an object oriented graph.
* Expressing overlapping (non-hierarchical) node relationships requires extra effort.
* XML namespaces are problematic to use and namespace support can be difficult to correctly implement in an XML parser.
* XML is commonly depicted as "self-documenting" but this depiction ignores critical ambiguities.
* The distinction between content and attributes in XML seems unnatural to some and makes designing XML data structures harder