/* Copyright (c) 2003 Jan-Klaas Kollhof This file is part of the JavaScript o lait library(jsolait). jsolait is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Module("xml","1.1.2",function(mod){mod.NoXMLParser=Class("NoXMLParser",mod.Exception,function(publ,supr){publ.init=function(trace){supr(this).init("Could not create an XML parser.",trace);}}) mod.ParsingFailed=Class("ParsingFailed",mod.Exception,function(publ,supr){publ.init=function(xml,trace){supr(this).init("Failed parsing XML document.",trace);this.xml=xml;} publ.xml;}) mod.parseXML=function(xml){var obj=null;var isMoz=false;var isIE=false;var isASV=false;try{var p=window.parseXML;if(p==null){throw"No ASV paseXML";} isASV=true;}catch(e){try{obj=new DOMParser();isMoz=true;}catch(e){try{obj=new ActiveXObject("Msxml2.DomDocument.4.0");isIE=true;}catch(e){try{obj=new ActiveXObject("Msxml2.DomDocument");isIE=true;}catch(e){try{obj=new ActiveXObject("microsoft.XMLDOM");isIE=true;}catch(e){throw new mod.NoXMLParser(e);}}}}} try{if(isMoz){obj=obj.parseFromString(xml,"text/xml");return obj;}else if(isIE){obj.loadXML(xml);return obj;}else if(isASV){return window.parseXML(xml,null);}}catch(e){throw new mod.ParsingFailed(xml,e);}} mod.importNode=function(importedNode,deep){deep=(deep==null)?true:deep;var ELEMENT_NODE=1;var ATTRIBUTE_NODE=2;var TEXT_NODE=3;var CDATA_SECTION_NODE=4;var ENTITY_REFERENCE_NODE=5;var ENTITY_NODE=6;var PROCESSING_INSTRUCTION_NODE=7;var COMMENT_NODE=8;var DOCUMENT_NODE=9;var DOCUMENT_TYPE_NODE=10;var DOCUMENT_FRAGMENT_NODE=11;var NOTATION_NODE=12;var importChildren=function(srcNode,parent){if(deep){for(var i=0;i\n";}else{s+=">";for(var i=0;i\n";} break;case PROCESSING_INSTRUCTION_NODE:s+="";break;case TEXT_NODE:s+=node.nodeValue;break;case CDATA_SECTION_NODE:s+="<"+"![CDATA["+node.nodeValue+"]"+"]>";break;case COMMENT_NODE:s+="";break;case ENTITY_REFERENCE_NODE:case DOCUMENT_FRAGMENT_NODE:case DOCUMENT_TYPE_NODE:case NOTATION_NODE:case ENTITY_NODE:throw new mod.Exception("Nodetype(%s) not supported.".format(node.nodeType));break;} return s;}})