<commit_before>// This part covers the ArcGIS Server at http://kart.klif.no/
var BW = BW || {};
BW.MapAPI = BW.MapAPI || {};
BW.MapAPI.Parsers = BW.MapAPI.Parsers || {};

BW.MapAPI.Parsers.GeneralXmlGml = function() {
    function parse(result) {
        var properties = {};
        var insteadOfGml = 'insteadofgml';
        result = result.replace(/:gml/g, '');
        result = result.replace(/[\n\f\r\t\0\v]/g, ' '); // replace tab & Co with space
        result = result.replace(/gml:/g, insteadOfGml);
        result = result.replace(/s:x/g, 'sx');
        result = result.replace(/xmlns\S*="\S+"/g, '');    // remove namespace tags
        result = result.replace(/ +/g, ' '); // replace multispace with space
        result = result.replace(/\s+>/g, '>'); // space inside tag
        var featureTag = $(result).find("*").first().children().last();
        if (featureTag.length > 0) {
            var tagname = featureTag[0].tagName;
            $(result).find(tagname).each(function () {
                if (typeof console === "object") {console.log("wildcard(*)=" + featureTag);}
                $(this).children().each(function () {
                    properties[this.tagName] = $(this).text();
                    if (typeof console === "object") {console.log(this.tagName + "/" + $(this).text());}
                });
            });

            return _convertToFeatureResponseXML(properties);
        }
        return _convertToFeatureResponseXML(undefined);
    }

    function _convertToFeatureResponseXML(jsonFeatures) {
        var responseFeatureCollection = [];
        var responseFeature = new BW.Domain.FeatureResponse();
        if (jsonFeatures !== undefined) {
            responseFeature.attributes = _getAttributesArrayXML(jsonFeatures);
            responseFeatureCollection.push(responseFeature);
        } else {
            var noattributes = [];
            noattributes.push(['data','no data found']);
            responseFeature.attributes = noattributes;
            responseFeatureCollection.push(responseFeature);
        }
        return responseFeatureCollection;
    }

    function _getAttributesArrayXML(properties) {
        var attributes = [];
        for (var i in properties) {
            if (i !== "INSTEADOFGMLBOUNDEDBY") {
                attributes.push([i, properties[i]]);
            }

        }
        return attributes;
    }

    return {
        Parse: parse
    };
};<commit_msg>empty attributes if no data<commit_after>// This part covers the ArcGIS Server at http://kart.klif.no/
var BW = BW || {};
BW.MapAPI = BW.MapAPI || {};
BW.MapAPI.Parsers = BW.MapAPI.Parsers || {};

BW.MapAPI.Parsers.GeneralXmlGml = function() {
    function parse(result) {
        var properties = {};
        var insteadOfGml = 'insteadofgml';
        result = result.replace(/:gml/g, '');
        result = result.replace(/[\n\f\r\t\0\v]/g, ' '); // replace tab & Co with space
        result = result.replace(/gml:/g, insteadOfGml);
        result = result.replace(/s:x/g, 'sx');
        result = result.replace(/xmlns\S*="\S+"/g, '');    // remove namespace tags
        result = result.replace(/ +/g, ' '); // replace multispace with space
        result = result.replace(/\s+>/g, '>'); // space inside tag
        var featureTag = $(result).find("*").first().children().last();
        if (featureTag.length > 0) {
            var tagname = featureTag[0].tagName;
            $(result).find(tagname).each(function () {
                if (typeof console === "object") {console.log("wildcard(*)=" + featureTag);}
                $(this).children().each(function () {
                    properties[this.tagName] = $(this).text();
                    if (typeof console === "object") {console.log(this.tagName + "/" + $(this).text());}
                });
            });

            return _convertToFeatureResponseXML(properties);
        }
        return _convertToFeatureResponseXML(undefined);
    }

    function _convertToFeatureResponseXML(jsonFeatures) {
        var responseFeatureCollection = [];
        var responseFeature = new BW.Domain.FeatureResponse();
        if (jsonFeatures !== undefined) {
            responseFeature.attributes = _getAttributesArrayXML(jsonFeatures);
            responseFeatureCollection.push(responseFeature);
        //} else {
        //    var noattributes = [];
        //    noattributes.push(['data','no data found']);
        //    responseFeature.attributes = noattributes;
        //    responseFeatureCollection.push(responseFeature);
        }
        return responseFeatureCollection;
    }

    function _getAttributesArrayXML(properties) {
        var attributes = [];
        for (var i in properties) {
            if (i !== "INSTEADOFGMLBOUNDEDBY") {
                attributes.push([i, properties[i]]);
            }

        }
        return attributes;
    }

    return {
        Parse: parse
    };
};
{'fraction_non_alphanumeric': 0.15134255492270138, 'fraction_numerical': 0.0012205044751830757, 'mean_word_length': 2.1702127659574466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3954723', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1337, 'n_words': 264}