/*
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; version 2 of the License.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** Loïc DIAS DA SILVA <mglcel@mglcel.fr>
** FOAFDrive - another FOAF wizzard
**
** $Id: ignore.js,v 1.3 2008-08-02 00:24:41 mglcel Exp $
*/

// FOAF properties ignoring management ----------------------------------------

function ignore_Definition() { }

ignore_Definition.ignores = new Array();

// ----------------------------------------------------------------------------

ignore_Definition.load = function (ignoreDefFile) {

  // Load ignoreization definition --------------------------------------------
  var xmlFile = ignoreDefFile;
  xmlDoc      = compat_importXML(xmlFile);

  if (typeof(xmlDoc) == 'undefined')
    return;

  var nodes = xmlDoc.firstChild.getElementsByTagName('item');

  for (var i = 0; i < nodes.length; i++) {
    var itemNode = nodes.item(i);

    // Get ignore field name --------------------------------------------------
    var ignore = "";
    var childNodes = itemNode.childNodes;
    if (childNodes.length == 1) {
      var childNode = childNodes.item(0);
      if (childNode.nodeType == 3) // (text node)
        ignore = childNode.nodeValue;
    }
    if (ignore.length > 1) {
      ignore_Definition.ignores[ignore] = 1;
    }
  }
}

// ----------------------------------------------------------------------------

ignore_Definition.isToIgnore = function (item) {
  item = item.substring(foaf_ns.length, item.length);

  if (typeof(ignore_Definition.ignores[item]) == 'undefined')
    return false;

  return true;
}

