std.xml2 (collecting features)

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Mon May 4 11:50:49 PDT 2015


On Sunday, 3 May 2015 at 17:47:15 UTC, Joakim wrote:

> My request: just skip it.  XML is a horrible waste of space for 
> a standard, better D doesn't support it well, anything to 
> discourage it's use.  I'd rather see you spend your time on 
> something worthwhile.  If data formats are your thing, you 
> could help get Ludwig's JSON stuff in, or better yet, enable 
> some nice binary data format.

Am Sun, 03 May 2015 18:44:11 +0000
schrieb "w0rp" <devw0rp at gmail.com>:

> I agree that JSON is superior through-and-through, but legacy 
> support matters, and XML is in many places. It's good to have a 
> quality XML parsing library.

You two are terrible at motivating people. "Better D doesn't
support it well" and "JSON is superior through-and-through" is
overly dismissive. To me it sounds like someone saying replace
C++ with JavaScript, because C++ is a horrible standard and
JavaScript is so much superior.  Honestly.

Remember that while JSON is simpler, XML is not just a
structured container for bool, Number and String data. It
comes with many official side kicks covering a broad range of
use cases:

XPath:
 * allows you to use XML files like a textual database
 * complex enough to allow for almost any imaginable query
 * many tools emerged to test XPath expressions against XML documents
 * also powers XSLT
   (http://www.liquid-technologies.com/xpath-tutorial.aspx)

XSL (Extensible Stylesheet Language) and
XSLT (XSL Transformations):
 * written as XML documents
 * standard way to transform XML from one structure into another
 * convert or "compile" data to XHTML or SVG for display in a browser
 * output to XSL-FO

XSL-FO (XSL formatting objects):
 * written as XSL
 * type-setting for XML; a XSL-FO processor is similar to a LaTex processor
 * reads an XML document (a "Format" document) and outputs to a PDF, RTF or similar format

XML Schema Definition (XSD):
 * written as XML
 * linked in by an XML file
 * defines structure and validates content to some extent
 * can set constraints on how often an element can occur in a list
 * can validate data type of values (length, regex, positive, etc.)
 * database like unique IDs and references

I think XML is the most eat-your-own-dog-food language ever
and nicely covers a wide range of use cases. In any case there
are many XML based file formats that we might want to parse.
Amongst them SVG, OpenDocument (Open/LibreOffics), RSS feeds,
several US Offices, XMP and other meta data formats.

When it comes to which features to support, I personally used
XSD more than XPath and the tech using it. But quite frankly
both would be expected by users. Based on XPath, XSL
transformations can be added any time then. Anything beyond
that doesn't feel quite "core" enough to be in a XML module.

-- 
Marco



More information about the Digitalmars-d mailing list