Hacker News new | ask | show | jobs
by zeveb 3348 days ago
Wow, that's a bloated format. Here it is as XML:

    <?xpacket begin="?" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.4-c002 1.000000, 0000/00/00-00:00:00        ">
       <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:Description rdf:about=""
                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
             <xmp:CreatorTool>Picasa</xmp:CreatorTool>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/"
                xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
                xmlns:stArea="http://ns.adobe.com/xmp/sType/Area#">
             <mwg-rs:Regions rdf:parseType="Resource">
                <mwg-rs:AppliedToDimensions rdf:parseType="Resource">
                   <stDim:w>912</stDim:w>
                   <stDim:h>687</stDim:h>
                   <stDim:unit>pixel</stDim:unit>
                </mwg-rs:AppliedToDimensions>
                <mwg-rs:RegionList>
                   <rdf:Bag>
                      <rdf:li rdf:parseType="Resource">
                         <mwg-rs:Type></mwg-rs:Type>
                         <mwg-rs:Area rdf:parseType="Resource">
                            <stArea:x>0.680921052631579</stArea:x>
                            <stArea:y>0.3537117903930131</stArea:y>
                            <stArea:h>0.4264919941775837</stArea:h>
                            <stArea:w>0.32127192982456143</stArea:w>
                            <stArea:unit>normalized</stArea:unit>
                         </mwg-rs:Area>
                      </rdf:li>
                   </rdf:Bag>
                </mwg-rs:RegionList>
             </mwg-rs:Regions>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:exif="http://ns.adobe.com/exif/1.0/">
             <exif:PixelXDimension>912</exif:PixelXDimension>
             <exif:PixelYDimension>687</exif:PixelYDimension>
             <exif:ExifVersion>0220</exif:ExifVersion>
          </rdf:Description>
       </rdf:RDF>
    </x:xmpmeta>
    
    <!-- whitespace padding -->
    
    <?xpacket end="w"?>
And here it is as SXML (https://en.wikipedia.org/wiki/SXML):

    (*TOP* (*PI* |xpacket| "begin=\"?\" id=\"W5M0MpCehiHzreSzNTczkc9d\"")
     (|adobe:ns:meta/:xmpmeta|
      (@ (@ (*NAMESPACES* (|adobe:ns:meta/| "adobe:ns:meta/" . |x|)))
       (|adobe:ns:meta/:xmptk|
        "Adobe XMP Core 5.4-c002 1.000000, 0000/00/00-00:00:00        "))
      "
       "
      (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:RDF|
       (@
        (@
         (*NAMESPACES*
          (|http://www.w3.org/1999/02/22-rdf-syntax-ns#|
           "http://www.w3.org/1999/02/22-rdf-syntax-ns#" . |rdf|))))
       "
          "
       (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:Description|
        (@
         (@
          (*NAMESPACES*
           (|http://ns.adobe.com/xap/1.0/| "http://ns.adobe.com/xap/1.0/"
            . |xmp|)))
         (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:about| ""))
        "
             "
        (|http://ns.adobe.com/xap/1.0/:CreatorTool| "Picasa") "
          ")
       "
          "
       (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:Description|
        (@
         (@
          (*NAMESPACES*
           (|http://ns.adobe.com/xmp/sType/Area#|
            "http://ns.adobe.com/xmp/sType/Area#" . |stArea|)
           (|http://ns.adobe.com/xap/1.0/sType/Dimensions#|
            "http://ns.adobe.com/xap/1.0/sType/Dimensions#" . |stDim|)
           (|http://www.metadataworkinggroup.com/schemas/regions/|
            "http://www.metadataworkinggroup.com/schemas/regions/" . |mwg-rs|)))
         (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:about| ""))
        "
             "
        (|http://www.metadataworkinggroup.com/schemas/regions/:Regions|
         (@ (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:parseType| "Resource")) "
                "
         (|http://www.metadataworkinggroup.com/schemas/regions/:AppliedToDimensions|
          (@ (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:parseType| "Resource")) "
                   "
          (|http://ns.adobe.com/xap/1.0/sType/Dimensions#:w| "912") "
                   "
          (|http://ns.adobe.com/xap/1.0/sType/Dimensions#:h| "687") "
                   "
          (|http://ns.adobe.com/xap/1.0/sType/Dimensions#:unit| "pixel") "
                ")
         "
                "
         (|http://www.metadataworkinggroup.com/schemas/regions/:RegionList| "
                   "
          (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:Bag| "
                      "
           (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:li|
            (@
             (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:parseType| "Resource"))
            "
                         "
            (|http://www.metadataworkinggroup.com/schemas/regions/:Type|) "
                         "
            (|http://www.metadataworkinggroup.com/schemas/regions/:Area|
             (@
              (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:parseType| "Resource"))
             "
                            "
             (|http://ns.adobe.com/xmp/sType/Area#:x| "0.680921052631579") "
                            "
             (|http://ns.adobe.com/xmp/sType/Area#:y| "0.3537117903930131") "
                            "
             (|http://ns.adobe.com/xmp/sType/Area#:h| "0.4264919941775837") "
                            "
             (|http://ns.adobe.com/xmp/sType/Area#:w| "0.32127192982456143") "
                            "
             (|http://ns.adobe.com/xmp/sType/Area#:unit| "normalized") "
                         ")
            "
                      ")
           "
                   ")
          "
                ")
         "
             ")
        "
          ")
       "
          "
       (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:Description|
        (@
         (@
          (*NAMESPACES*
           (|http://ns.adobe.com/exif/1.0/| "http://ns.adobe.com/exif/1.0/"
            . |exif|)))
         (|http://www.w3.org/1999/02/22-rdf-syntax-ns#:about| ""))
        "
             "
        (|http://ns.adobe.com/exif/1.0/:PixelXDimension| "912") "
             "
        (|http://ns.adobe.com/exif/1.0/:PixelYDimension| "687") "
             "
        (|http://ns.adobe.com/exif/1.0/:ExifVersion| "0220") "
          ")
       "
       ")
      "
    ")
     (*COMMENT* " whitespace padding ") (*PI* |xpacket| "end=\"w\""))
The only terrible thing about the SXML is the preserved-whitespace from the XML (which of course wouldn't exist in pure SXML); otherwise it's much nicer and contains exactly as much information.
3 comments

Not the only one. Whoever decided that namespaces should have "http://" needs to be fired out of a bloody cannon.
The URI<->URL equivalence that justifies "http:// namespaces" was a neat trick insofar as it means you can use the URL of the XML schema definition file (.xsd) as the URI of the namespace in a document that contains it - thus allowing XML readers to automatically perform schema validation when encountering a new schema.

...but given how well DNS-based package names in Java have worked out (i.e. poorly) I'm surprised they went in that direction.

On the bright side - URIs (and so, XML namespaces) don't need to use the http:// scheme - they could easily switch to urn: http://stackoverflow.com/questions/4116282/when-to-use-a-urn...

RDF-XML anything is never going to look particularly nice.
That whitespace is making my head explode, though.

E.g. that shrinking tunnel under "normalized".

Yeah, it's pretty terrible. I kinda wish I'd preserved the namespace shortnames too, as it'd have made my point even better. Still, I regret nothing: XML is the JavaScript of data-interchange formats.