////// JSXML XML Tools - REXML ///////////// ////// Regular Expression-based XML parser ///////////// ////// Ver 1.2 Jun 18 2001 ///////////// ////// Copyright 2000 Peter Tracey ///////////// ////// http://jsxml.homestead.com/ ///////////// function REXML(XML) { this.XML = XML; this.rootElement = null; this.parse = REXML_parse; if (this.XML && this.XML != "") this.parse(); } function REXML_parse() { var reTag = new RegExp("<([^>/ ]*)([^>]*)>","g"); // matches that tag name $1 and attribute string $2 var reTagText = new RegExp("<([^>/ ]*)([^>]*)>([^<]*)","g"); // matches tag name $1, attribute string $2, and text $3 var strType = ""; var strTag = ""; var strText = ""; var strAttributes = ""; var strOpen = ""; var strClose = ""; var iElements = 0; var xmleLastElement = null; if (this.XML.length == 0) return; var arrElementsUnparsed = this.XML.match(reTag); var arrElementsUnparsedText = this.XML.match(reTagText); var i=0; if (arrElementsUnparsed[0].replace(reTag, "$1") == "?xml") i++; for (; i -1) strText = arrElementsUnparsedText[i]; else { for (; i"; if (str.indexOf(Attribute + "='")>-1) var Attr = new RegExp(".*" + Attribute + "='([^']*)'.*>"); else if (str.indexOf(Attribute + '="')>-1) var Attr = new RegExp(".*" + Attribute + '="([^"]*)".*>'); return str.replace(Attr, "$1"); }