JsonXmlFilter

This blueprint is actually fairly generic. It takes any JSON structure an input terminal argument, and executes a regexp on it which is provided from properties, then submots the result to the output terminal.



BLUEPRINT(
"~01AC345B4B245C463f9C092C42A1E22D68", 
[
 ["xml_json_in", "onXmlJson", 10]
],
[
"result_out"
],
function (Class) 
{
    Class.prototype._onInit = function(props)
    {
      this._path = props["filter_path"];
    };

    Class.prototype.onXmlJson = function(msg)
    {
      var i, f;
      var n = this._path.length, node = msg, root=true;

      for (i = 0; i < n; i ++) {
    f = this._path[i];

    if (typeof(f) == typeof(1)) { // 
      node = node.children[f];
    } else {

      node = node.attributes[f];
      break;
      /*****************************************************************/
    }
      }

      this.postMessage("result_out", node);
    };

}, "XML JSON Filter");

No comments yet. post a comment >