@documentica/webdav
Version:
Documentica Webdav Client
46 lines (45 loc) • 1.77 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Property_1 = __importDefault(require("../Property"));
const constants_1 = require("../constants");
function fromXML(nodeList) {
for (var j = 0; j < nodeList.length; j++) {
var principal = nodeList.item(j);
if ((principal.nodeType !== 1) || (principal.namespaceURI === null) || (principal.namespaceURI !== 'DAV:')) { // Skip if not from the right namespace
continue;
}
switch (principal.localName) {
case 'href':
return principal.childNodes.item(0).nodeValue;
case 'all':
return constants_1.WEBDAV_ACE_ALL;
case 'authenticated':
return constants_1.WEBDAV_ACE_AUTHENTICATED;
case 'unauthenticated':
return constants_1.WEBDAV_ACE_UNAUTHENTICATED;
case 'property':
for (var k = 0; k < principal.childNodes.length; k++) {
var element = principal.childNodes.item(k);
if (element.nodeType !== 1) {
continue;
}
var prop = new Property_1.default(element);
return prop;
}
break;
case 'self':
return constants_1.WEBDAV_ACE_SELF;
default:
throw 'Principal XML Node contains illegal child node: ' + principal.localName;
}
}
}
exports.fromXML = fromXML;
const codec = {
fromXML,
toXML: (value, xmlDoc) => xmlDoc
};
exports.default = codec;
;