|
TROIKA.ASP - the MVC framework | |||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||
Contains XPathParser class.
This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0. Please visit www.troika-asp.com for more details.
| Class Summary | |
| XPathParser | This is XPathParser class for extracting XML nodesets by xpath. |
/** * @fileoverview Contains <tt>XPathParser</tt> class. * * <p> * This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0. * Please visit {@link http://www.troika-asp.com www.troika-asp.com} for more details. * </p> * * @author Pavel Chuchev pav@troika-asp.com * @version $Revision: 1.3 $ */ /** * Constructs a new instance of XPathParser class. * * @class This is <tt>XPathParser</tt> class for extracting XML nodesets by xpath. * * @constructor * @param {String} xmlFile The XML file to load from. * @param {String} xml The XML to use, optional. If not specified the XML will be loaded using xmlFile parameter. */ function XPathParser(xmlFile, xml) { if (arguments.length) { this.init(xmlFile, xml); } } /** * Initializes <tt>XPathParser</tt>. * * @return <tt>XPathParser</tt> object instance itself. * @param {String} xmlFile The XML file to load from. * @param {String} xml The XML to use, optional. If not specified the XML will be loaded using xmlFile parameter. * @type XPathParser */ XPathParser.prototype.init = function (xmlFile, xml) { this.parser = new ActiveXObject("MSXML2.DOMDocument"); this.parser.async = false; this.parser.resolveExternals = true; this.parser.setProperty("SelectionLanguage", "XPath"); if (xml) { this.parser.loadXML(xml); } else { this.parser.load(xmlFile); } var errCode = this.parser.parseError.errorCode; if (errCode) { throw new Error(errCode); } return this; }; /** * Selects a list of nodes matching the XPath expression. * * @param {String} query The XPath expression. * @return The list of nodes matching the XPath expression. */ XPathParser.prototype.apply = function (query) { return this.parser.selectNodes(query); };
|
TROIKA.ASP - the MVC framework | |||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||