lib/utils/xml-utils.js
function getChildNode(node, tagName, errorMsgIfAbsent) {
    if (node && node.childNodes) {
        for (var i = 0, cn = node.childNodes, len = cn.length; i < len; i++) {
            if (cn[i].tagName === tagName) {
                return cn[i];
            }
        }
    }
    if (errorMsgIfAbsent) {
        throw new KdbxError(Consts.ErrorCodes.FileCorrupt, errorMsgIfAbsent);
    } else {
        return null;
    }
}
function getChildNode(node, tagName, errorMsgIfAbsent) {
    if (node && node.childNodes) {
        for (var i = 0, cn = node.childNodes, len = cn.length; i < len; i++) {
            if (cn[i].tagName === tagName) {
                return cn[i];
            }
        }
    }
    if (errorMsgIfAbsent) {
        throw new KdbxError(Consts.ErrorCodes.FileCorrupt, errorMsgIfAbsent);
    } else {
        return null;
    }
}
function getChildNode ( node , tagName , errorMsgIfAbsent ) { if ( node && node . childNodes ) { for ( var i = 0 , cn = node . childNodes , len = cn . length ; i < len ; i ++ ) { if ( cn [ i ] . tagName === tagName ) { return cn [ i ] ; } } } if ( errorMsgIfAbsent ) { throw new KdbxError ( Consts . ErrorCodes . FileCorrupt , errorMsgIfAbsent ) ; } else { return null ; } }
Gets first child node from xml
@param {Node} node - parent node for search
@param {string} tagName - child node tag name
@param {string} [errorMsgIfAbsent] - if set, error will be thrown if node is absent
@returns {Node} - first found node, or null, if there's no such node
Gets first child node from xml