i hate xml. xml... has the optimal syntax: it compresses perfectly is much hyped, so must be...

21
I Hate XML

Post on 30-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

I Hate XML

Page 2: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

XML...

has the optimal syntax: it compresses perfectly

is much hyped, so must be excellent

is well supported in Java, so available to anyone!

... and Perl support?

is used everywhere (help!)

Page 3: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

XML...

has a complicated content describing formalism, described in schema's

is easily extensible

XML its noting more than Yet Another Syntax!!!!with an optional formalism

Page 4: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Need

XML HASHValidatingtranslation

Schema/ WSDL

file

validating complete simple fast

Page 5: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Need

XMLHASH Validatingtranslation

Schema/ WSDL

file

validating complete simple fast

Page 6: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Many (unmaintained) XML modules

XML::Smart Dec 2004WSDL::Generator Sep 2002 SOAP::Lite Jan 2006XML::asData Feb 2004 SOAP::WSDL Aug 2004XML::Generator Mar 2004XML::Quick May 2006XML::Records Nov 2001XML::Registry Oct 1998XML::Simple Jan 2005XML::Structured Apr 2006XML::Ximple Nov 2002 XML::Schema Jan 2003... more ...

Translate HASH to XML (and/or back) by

None complete, usually slow: they just DWIM

Page 7: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Examples

simpleType

<answer>42</answer>

answer => 42

Page 8: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Examples

complexType and complexType/complexContent

<zoo name=”Burgers Zoo”> <location>Arnhem</location> <animal>monkey</animal> <animal>donkey</animal></zoo>

zoo => { name => 'Burgers Zoo' , location => 'Arnhem' , animal => [ 'monkey', 'donkey' ] };

Page 9: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Examples

complexType/simpleContent

<price currency=”euro”>300</price>

price => { currency => 'euro' , _ => 300 };

Page 10: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Why another?

No run-time xpath searches: need for speed!

int should not become 1.9999, but long long 2

Integer is BigInt; must support minimal 18 digits- 121 21 363462 32461532 1

support for list, union, subtitutionGroup

Real qualified/unqualified name-space support

Page 11: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Examples

my $rules = XML::Compile::Schema->new($xml_string);my $read = $rules->compile(READER => 'mytype');my $hash = $read->($xml);

my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');my $write = $rules->compile(WRITER => 'mytype');my $xml = $write->($doc, $hash);

create a reader; XML to HASH

create a writer; HASH to XML

based on XML::LibXML

Page 12: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Complete?

No, but...

many optimizations are implemented

needs real-life testing

W3C TRs are unreadable

only newest schema spec, prepared to extend.

Page 13: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

Future

WSDL

SOAP

CPAN6

Page 14: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

I Love YAML(Syck, SOX, SLiP)

Page 15: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

What is the expected structure?

Is it documented?

Can it be checked?

Page 16: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

XML to YAML

XML HASH

Schema

YAML

Page 17: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

YAML validation

XML HASH

Schema

YAML

Page 18: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

YAML schema's

XML HASH

XML

Schema

YAML

HASH YAML

Page 19: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

I Hate XML

I Love YAML

Page 20: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

I Hate XML

I Love YAML

It's just syntax!!!!

Page 21: I Hate XML. XML... has the optimal syntax: it compresses perfectly is much hyped, so must be excellent is well supported in Java, so available to anyone!

It's just syntax!!!!

The real problem is:design the data-structure in a waythat it can last for a very long time

AND DOCUMENT THAT