var parseXMLNode = new Class ({
	Implements: [Options, Events],
	options: {
		recursivo:true,
		limite:-1
	},
	initialize: function(options){
		this.setOptions(options);
	},
	node2json: function(node){
		switch ($type(node)){
			case 'element':
				var attributes = node.attributes;
				var attributesLength = attributes.length;
 				var nodoRespuesta={};
				
				for (var j = 0; j < attributesLength; j++)
				{
					var attribute = attributes[j];
					if (attribute.nodeValue && attribute.nodeValue != 'inherit')
					{
						nodoRespuesta[attribute.nodeName] = attribute.nodeValue;
					}
				}
				for ( var i = 0; i < node.childNodes.length; ++i )
				{
					if ( $type(node.childNodes[i]) == 'element' )
					{
						nodoRespuesta[node.childNodes[i].nodeName] = this.node2json(node.childNodes[i]);
					}
					else if ( $type(node.childNodes[i]) == 'textnode' )
					{
						nodoRespuesta['value'] = node.childNodes[i].nodeValue;
					}
				}
				return nodoRespuesta;
				break;
 
			case 'textnode':
				return {text: node.nodeValue};
				break;
 
			default:
				return null;
				break;
		}
	}
});
