/* File: jstree.xml.js This plugin makes it possible for jstree to use XML data sources. */ /* Group: jstree xml plugin */ (function ($) { var xsl = { 'nest' : '' + '<' + '?xml version="1.0" encoding="utf-8" ?>' + '' + '' + '' + ' ' + ' ' + ' ' + '' + '' + ' ' + ' ' + '' + '', 'flat' : '' + '<' + '?xml version="1.0" encoding="utf-8" ?>' + '' + '' + '' + '
    ' + ' ' + /* the last `or` may be removed */ ' ' + ' ' + ' ' + ' ' + '
' + '
' + '' + ' ' + ' ' + '
  • ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
      ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
    ' + '
    ' + '
  • ' + '
    ' + '
    ' }, escape_xml = function(string) { return string .toString() .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); }; $.jstree.plugin("xml", { defaults : { xsl : "flat", data : false, ajax : false }, _fn : { _append_xml_data : function (dom, data) { data = $.vakata.xslt(data, xsl[this.get_settings().xml.xsl]); if(data === false) { return false; } data = $(data); if(!data || !data.length || !data.is('ul, li')) { return false; } dom = this.get_node(dom); if(dom === -1) { dom = this.get_container(); } if(!dom.length) { return false; } if(!dom.children('ul').length) { dom.append('