4.0.0-beta.16 • Published 6 years ago
@lightweightform/xml v4.0.0-beta.16
LF-XML
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
Method | Description | Parameters | Return Type |
---|---|---|---|
js2Xml | Converts a js object to an equivalent xml representation wrapped by a xml header element | js: any | XMLElementOrXMLNode |
js2XmlString | Converts a js object to an equivalent xml string | js: any | string |
xml2Js | Converts a xml string to js object equivalent with lf schemaComplete representation | xml: string | js: 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
6 years ago
4.0.0-beta.15
6 years ago
4.0.0-beta.14
6 years ago
4.0.0-beta.13
6 years ago
4.0.0-beta.12
6 years ago
4.0.0-beta.10
6 years ago
4.0.0-beta.9
6 years ago
4.0.0-beta.8
6 years ago
4.0.0-beta.7
6 years ago
4.0.0-beta.5
6 years ago
4.0.0-beta.6
6 years ago
4.0.0-beta.4
6 years ago
4.0.0-beta.3
6 years ago
4.0.0-beta.2
6 years ago
4.0.0-beta.1
6 years ago
4.0.0-beta.0
6 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