@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
72 lines (71 loc) • 1.84 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: Object.getOwnPropertyDescriptor(all, name).get
});
}
_export(exports, {
get XML_NS () {
return XML_NS;
},
get XML_NS_PREFIX () {
return XML_NS_PREFIX;
},
get XML_VERSION () {
return XML_VERSION;
},
get xmlBuild () {
return xmlBuild;
},
get xmlIsValid () {
return xmlIsValid;
},
get xmlParse () {
return xmlParse;
}
});
const _fastxmlparser = require("fast-xml-parser");
const XML_NS_PREFIX = '@_';
const XML_NS = `${XML_NS_PREFIX}xmlns`;
const XML_VERSION = {
'?xml': {
[`${XML_NS_PREFIX}version`]: '1.0',
[`${XML_NS_PREFIX}encoding`]: 'utf-8',
[`${XML_NS_PREFIX}standalone`]: 'yes'
}
};
const xmlParser = new _fastxmlparser.XMLParser({
ignoreAttributes: false,
removeNSPrefix: true,
attributeNamePrefix: XML_NS_PREFIX,
ignoreDeclaration: true,
ignorePiTags: true,
processEntities: false
});
const xmlBuilder = new _fastxmlparser.XMLBuilder({
ignoreAttributes: false,
attributeNamePrefix: XML_NS_PREFIX,
format: false,
suppressEmptyNode: true
});
function xmlIsValid(content) {
return _fastxmlparser.XMLValidator.validate(content);
}
function xmlBuild(content) {
return xmlBuilder.build({
...XML_VERSION,
...content
});
}
function xmlParse(content) {
return xmlParser.parse(content);
}
//# sourceMappingURL=xml.js.map