Status of std.xml (D2/Phobos)

Justin Johansson no at spam.com
Mon Jun 28 06:13:11 PDT 2010


Ellery Newcomer wrote:
> On 06/27/2010 10:16 AM, Justin Johansson wrote:
>>
>> OTOH, there are some really significant W3C specs that you may
>> or may not be aware of and these are really difficult to implement
>> in regular imperative languages like C/C++ and Java. Java,
>> being all that is the following of Java I guess, has had the most
>> success in implementing these specs.
>>
>> IMHO, the two most fundamental and significant W3C specs that
>> D libraries could well address are as follows. These form a
>> large amount of the (formal) XML ecosystem.
>>
>> XML Schema Part 2: Datatypes Second Edition
>> http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/
>>
>> and
>>
>> XQuery 1.0 and XPath 2.0 Data Model (XDM)
>> http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/
>>
>> I can tell you for sure that XPath 2.0, which is the basis
>> for XSLT 2.0 and XQuery 1.0, is truly a challenge to implement
>> in languages like C++ and Java. Others have succeeded with
>> implementations in languages like Eiffel. I would hope though,
>> that D2 would be up to the task (is that is wishful thinking?).
>>
>> Cheers
>> Justin Johansson
> 
> For the sake of us uninformed spectators, could you give a little taste 
> of the challenges to which you refer?

Writing an XML parser in itself is pretty much basic CS101 stuff.  The
tough challenges come with implementing the other W3C specs in the XML
ecosystem, such as XSchema and XPath 2.0 for reason that these are such
humongous and complex beasts.

An XSchema implementation forms the basis for writing an XML content
validator and that's a pretty important tool to have for a lot of
XML processing.

An XPath 2.0 implementation forms the core of XSLT 2.0 and XQuery which
are XML transformation languages.  Again these are very useful tools.

The most successful implementations of XSchema and XPath 2.0 are written
in Java.  This is probably mostly due to the widespread popularity of
Java and there being very many open source volunteers to do the grunt.

If you look at any of the Java sources for these XML projects, you will
be astounded just how big they are, like the Saxon Java XSLT processor
by Michael Kay for example*.  Of course you will be secretly thinking to
yourself that the size these works would be considerably smaller if they
were written in D :-)

(*Michael Kay has spent the last ten years working on it.)

In the C++ world of Qt, there is the Qt XmlPatterns library which
implements XPath 2.0 which is also quite sizable and currently
incomplete (implementing only about 70% of the W3C spec) and there
are a whole bunch of (former TrollTech?) people at Nokia working on it,
again demonstrating that implementing these W3C specs is no simple feat.

If you are really interested, try downloading a copy of the Qt source
from Nokia and take a look at the C++ code in the XmlPatterns library.
 From that you will surely get more than just a taste of the challenges,
you will get a whole mouthful!  :-)

http://qt.nokia.com/downloads/

Cheers
Justin Johansson



More information about the Digitalmars-d mailing list