4.0.0-beta.16 • Published 5 years ago

@lightweightform/xml v4.0.0-beta.16

Weekly downloads
1
License
Apache2.0
Repository
bitbucket
Last release
5 years ago

LF-XML

styled with prettier Travis Coveralls

A LF plugin to transform both js value to xml and xml to js value.

Instalation

npm install @lightweightform/xml

Usage

import LfXml from '@lightweightform/xml';
const initialConfiguration: Configuration = {
  xmlVersion: '1.0',
  encoding: 'UTF-8',
  rootName: 'lf-xml',
  lfStorage: ${LF_STORAGE},
  rowSuffix: 'row',
  rowAttribute: 'index',
  formListAttributeSuffix: 'id',
  lfI18n: ${LF_I18N},
  mappings: { xmlName: {'/a/b': B}, jsName: {'/a/B': b} }
};
...
const converter = new LfXml(initialConfiguration);
...
const xml = converter.js2xml(jsValue);
const xmlString = converter.js2xmlString(jsValue);
const js = converter.xml2Js(xmlString);

Methods

MethodDescriptionParametersReturn Type
js2XmlConverts a js object to an equivalent xml representation wrapped by a xml header elementjs: anyXMLElementOrXMLNode
js2XmlStringConverts a js object to an equivalent xml stringjs: anystring
xml2JsConverts a xml string to js object equivalent with lf schemaComplete representationxml: stringjs: any

Configuration

  • encoding: Encoding of the xml object (default="UTF-8")
  • xmlVersion: Version displayed in the xml object (default="1.0")
  • rootName: Root element of the xml object (default="lf-xml")
  • headerAttributes: Map with header attributes added into the root element of the xml object
  • rowSuffix: Every list elements have a suffix name added into each table's row in the xml object. (default="row")
  • rowAttribute: Every list elements have an additional attribute added into each table's row in the xml object. (default="index")
  • formListAttributeSuffix: Every list elements of type "formList" have an additional attribute added to each formList entry in the xml object (default="id")
  • lfStorage: Storage of the lf application
  • lfI18n: Lf's i18n service of the lf application
  • mappings: Map with element's path and name, needs two way mapping to rename element when converting js2xml and xml2js

Contributing

Contributions are always welcome. Please read our contributing guide on how to contribute.

License

LF-XML is released under the Apache License 2.0.

4.0.0-beta.16

5 years ago

4.0.0-beta.15

5 years ago

4.0.0-beta.14

5 years ago

4.0.0-beta.13

5 years ago

4.0.0-beta.12

5 years ago

4.0.0-beta.10

5 years ago

4.0.0-beta.9

5 years ago

4.0.0-beta.8

5 years ago

4.0.0-beta.7

5 years ago

4.0.0-beta.5

5 years ago

4.0.0-beta.6

5 years ago

4.0.0-beta.4

5 years ago

4.0.0-beta.3

5 years ago

4.0.0-beta.2

5 years ago

4.0.0-beta.1

5 years ago

4.0.0-beta.0

5 years ago

4.0.0-alpha.7

6 years ago

4.0.0-alpha.6

6 years ago

4.0.0-alpha.5

6 years ago

4.0.0-alpha.4

6 years ago

4.0.0-alpha.3

6 years ago

4.0.0-alpha.2

6 years ago

4.0.0-alpha.1

6 years ago