@adobe/asset-compute-xmp
Metadata XMP serialization used by custom Adobe Asset Compute serverless actions
Last updated 3 months ago by adobe-admin .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @adobe/asset-compute-xmp 
SYNC missed versions from official npm registry.

Version License codecov Travis

asset-compute-xmp

Metadata XMP serialization used by custom Adobe Asset Compute serverless actions.

Installation

npm install @adobe/asset-compute-xmp

API Details

Limitations

  • Alternative arrays, rdf:Alt, are not supported
  • Nested arrays are not supported
  • Qualifiers, including xml:lang, are not supported
  • Resource references are not supported

Serialize simple name/value pairs

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key1": true,
  "ns1:key2": false,
  "ns1:key3": new Date(),
  "ns1:key4": 123,
  "ns1:key5": "text",
  "ns1:key6": "http://www.adobe.com"
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key1>True</ns1:key1>
    <ns1:key2>False</ns1:key2>
    <ns1:key3>2020-08-26T17:38:29.991Z</ns1:key3>
    <ns1:key4>123</ns1:key4>
    <ns1:key5>text</ns1:key5>
    <ns1:key6 rdf:resource="http://www.adobe.com"/>
  </rdf:Description>
</rdf:RDF>

Serialize an ordered sequence of values

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key": [ "value1", "value2", "value3" ]
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key>
      <rdf:Seq>
        <rdf:li>value1</rdf:li>
        <rdf:li>value2</rdf:li>
        <rdf:li>value3</rdf:li>
      </rdf:Seq>
    </ns1:key>
  </rdf:Description>
</rdf:RDF>

Serialize an unordered set of values

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key": [ "value1", "value2", "value3" ]
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  },
  xmpBags: [ "ns1:key" ]
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key>
      <rdf:Bag>
        <rdf:li>value1</rdf:li>
        <rdf:li>value2</rdf:li>
        <rdf:li>value3</rdf:li>
      </rdf:Bag>
    </ns1:key>
  </rdf:Description>
</rdf:RDF>

Serialize a nested structure

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key1": {
    "ns1:key2": "value"
  }
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key1>
      <rdf:Description>
        <ns1:key2>value</ns1:key2>
      </rdf:Description>
    </ns1:key1>
  </rdf:Description>
</rdf:RDF>

License and Contributing Guidelines

Current Tags

  • 1.0.0                                ...           latest (3 months ago)

1 Versions

  • 1.0.0                                ...           3 months ago

Copyright 2014 - 2016 © taobao.org |