⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overview-summary.html

📁 sarissa用于支持多浏览器的浏览及编程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><html><head><title>sarissa Overview</title><link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style"><script>function asd() {			parent.document.title="sarissa Overview";	}</script></head><body bgcolor="#eeeeee" onload="asd();"><!-- ========== START OF NAVBAR ========== --><a name="navbar_top"><!-- --></a><table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td colspan=2 bgcolor="#b8cade" class="NavBarCell1"><a name="navbar_top_firstrow"><!-- --></a><table border="0" cellpadding="0" cellspacing="3">  <tr align="center" valign="top">      <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>Overview</b></font>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1"> <font class="NavBarFont1">File</font>&nbsp;</td>    <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>  </tr></table></td><td bgcolor="#b8cade" align="right" valign="top"><em><b>sarissa</b></em></td></tr><tr><td bgcolor="#eeeeee" class="NavBarCell2"><font size="-2">&nbsp;PREV&nbsp;&nbsp;NEXT</font></td><td bgcolor="#eeeeee" class="NavBarCell2"><font size="-2">  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>&nbsp;&nbsp;<script>  <!--  if(window==top) {    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');  }  //--></script><noscript><a href="allclasses-noframe.html" target=""><b>All Classes</b></a></noscript></font></td></tr></table><!-- =========== END OF NAVBAR =========== --><hr><center>		   <h2>sarissa</h2>	</center>			<p>			This document is the API Specification for 			sarissa.		</p>	<h4>Summary</h4><p>			<div>	  <div class="section">	<h3>TOC</h3>    <ul>      <li>        <a href="#overview">Overview</a>      </li>      <li>        <a href="#license">License(s)</a>      </li>      <li>      	<a href="#creditspeople">Credits (People)</a>      </li>      <li>      	<a href="#creditssoftware">Credits (Software)</a>      </li>      <li>        <a href="#ecmaunit">How to test Sarissa in your browser with ECMAUnit</a>      </li>      <li>        <a href="#getxmldom">How to obtain a DOM Document Object</a>      </li>      <li>        <a href="#getxmlhttp">How to obtain a XMLHTTP Request Object</a>      </li>      <li>        <a href="#loadstring">How to load an XML Document Object from an            XML String</a>      </li>      <li>        <a href="#serializedom">How serialize an XML DOM node to a string</a>      </li>      <li>        <a href="#parseerror">How to check for parsing errors</a>      </li>      <li>        <a href="#transform">        	How to transform an XML Document Object with XSLT        </a>      </li>      <li>        <a href="#updateContentFromURI">          How to update areas in your webpage from remote (optionally transformed) XML documents or XML DOM Nodes (oneliner!)        </a>      </li>      <li>        <a href="#xpath">How to use XPath from JavaScript to select Nodes from an XML Document</a>      </li>      <li>        <a href="#nondom2xml">How to serialize <strong>non</strong>-DOM objects to XML.</a>      </li>    </ul>	</div>    <div class="section">      <h3>        <a id="overview">Overview</a>      </h3>      <p>           Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. It offers various             XML related goodies like Document instantiation, XML loading from URLs or strings, XSLT            transformations, XPath queries etc and comes especially handy for people doing what is lately            known as "AJAX" development.     </p>    <p>		Supported browsers are Mozilla - Firefox and family, Internet Explorer with MSXML3.0 and up,  		Konqueror (KDE 3.3+ for sure), Safari and Opera.		Konq, Safari and Opera offer no XSLT/XPath scripting support AFAIK.    </p>    <p>	    	This document provides an overview of Sarissa along with examples of common tasks. 	    	The API documentation follows (thanks to <a href="http://jsdoc.sourceforge.net" title="Link to JSDoc project at SourceForge">JSDoc</a>).	    	This documentation is distributed under the GNU Free Documentation License (<a href="fdl.txt">fdl.txt</a>).    </p>    <p>        The latest version of Sarissa can always be found on 		<a href="https://sourceforge.net/projects/sarissa/" title="Link to Sarissa project at SourceForge">		the Sourceforge project page.</a> Please send comments, corrections etc via email or the 		<a href="https://sourceforge.net/forum/forum.php?forum_id=256492" title="Link to Sarissa forum at SourceForge.net">Sarissa forum.</a>.       </p>    </div>    <div class="section">      <h3>        <a id="license">License(s)</a>      </h3>      <p>        Sarissa is distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher,         GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher          (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If          you make modifications under the ASL, i would appreciate it if you submitted those.         In case your copy of Sarissa does not include the license texts, you may find		them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 		<a href="http://www.apache.org">http://www.apache.org</a>.      </p>     </div>     <div class="section">      <h3>        <a id="creditspeople">Credits (People)</a>      </h3>           <p>	  See <a href="../CHANGELOG.txt">CHANGELOG.txt</a>.	  	  My deepest apologies to anyone I fail to mention (because i do); please send over an email and I will fix it :-)	  </p>	</div>		<div class="section">      <h3>        <a id="creditssoftware">Credits (Software)</a>      </h3>	  <p>	  Sarissa is documented with <a href="http://jsdoc.sourceforge.net" title="Link to JSDoc project at SourceForge">JSDoc</a>, 	  tested with <a href="http://kupu.oscom.org/download/">ECMAUnit</a> and built using <a href="http://ant.apache.org/">Apache Ant</a>. 	  In the Ant build file Sarissa scripts are also checked using some custom code and <a href="http://www.JSLint.com">JSLint</a> 	  (Cool license). If you want to use JSLint in your ant builds you might want to check out build.xml from CVS 	  and head for the <code>jslint</code> target. 	  </p>	  <p>		  Sarissa was inspired by articles and code available on the web, most notably the 		  <a href="http://webfx.eae.net/dhtml/ieemu/">IE Emu Series</a> [webfx.eae.net] at webfx and  		  <a href="http://www.webreference.com/programming/javascript/domwrapper/">Cross-Browser DOM Wrapper article</a> [webreference.com]. 		  	  </p>	  <p>Here are some projects using Sarissa, please let me know if you want yours included here:</p>	  <ul>	  	<li>Oscom's really cool <a href="http://kupu.oscom.org/">Kupu WYSIWYG Editor</a></li>	  	<li><a href="http://communitymapbuilder.org/">MapBuilder</a> is a modern standards-based web mapping client</li>	  	<li><a href="http://plone.org/">Plone</a> is a user-friendly and powerful open source Content Management System</li>	  	<li><a href="http://anyterm.org/">Anyterm</a>, a web based terminal interface for your servers (it sounds crazy at first but you quickly find yourself wondering "how come i never thought of that")</li>	  	<li><a href="http://communik8r.org/">Communik8r</a> is a new email application for phpGroupWare. communik8r uses AJAX, IMAP sockets and client side XSLT</li>		<li>The <a href="../sample-apps/minesweeper/index.html">Minesweeper game</a> featured as a sample application was written by Sean Whalen, who is also the maintainer.</li>		<li>Jay Kimble's <a href="http://codebetter.com/blogs/jay.kimble/archive/2005/08/16/130777.aspx">JAAJAX Lib for .Net</a></li>		<li>Jason Diamond's <a href="http://jason.diamond.name/weblog/category/my-ajax-dot-net">My Ajax.NET library</a></li>		<li><a href="http://www.mojoportal.com/">MojoPortal</a>, an Object Oriented web site framework written in C# that runs under ASP.NET on Windows or under Mono on Linux or Mac OS X</li>		<li><a href="http://www.taleful.com/">Taleful.com</a> is an interactive storytelling website. This website was created to give people a place where they can express themselves and share their stories. All are welcome to come, read and post stories, share 	and collaborate with others in joint story projects, receive creative writing feedback and enhance their imagination.</li>	  </ul>	  <p>	  	Nearby, Dimitri Glazkov's XPath over HTML for MSIE (html-xpath) project at 	  	<a href="http://sourceforge.net/projects/html-xpath">http://sourceforge.net/projects/html-xpath</a> 	  	can be used as a complement to Sarissa. Moz already has DOM3 XPath support for HTML. 	  </p>    </div>    <div class="section">      <h3>        <a id="ecmaunit">How to test Sarissa in your browser with ECMAUnit</a>      </h3>      <p>       Sarissa tests are written using <a href="http://kupu.oscom.org/download/">ECMAUnit</a>, a unit testing framework for ECMAScript (a.k.a. JavaScript).        You can test Sarissa against your browser <a href="test/testsarissa.html">here</a>. Please note that some tests may fail if you run those directly from your filesystem.         </p>    </div>    <div class="section">      <h3>        <a id="getxmldom">How to obtain a DOM Document object</a>      </h3>      <p>            Obtaining a DOM Document object is as easy as calling a factory            method:         </p>      <pre xml:space="preserve">// Get a browser-specific DOM Document objectvar oDomDoc = Sarissa.getDomDocument();</pre>      <p>            Additionally, you can also pass two string parameters to that            factory method. These parameters are a namespace and a local name            respectively. Their combination builds the Document Element thus:         </p>      <pre xml:space="preserve">var oDomDoc = Sarissa.getDomDocument("http://foo.org/ns/uri","foo");</pre>      <p>          will build a representation of the following into memory:	  </p>      <pre xml:space="preserve">&lt;foo xmlns="http://foo.org/ns/uri"&gt;&lt;/foo&gt;</pre>      <p>            In Mozilla, calling the <code>Sarissa.getDomDocument</code> method            as above is equivalent to:      </p>      <pre xml:space="preserve">var oDomDoc = document.implementation.createDocument("http://foo.org/ns/uri","foo", null);</pre>      <p>            In the case you are using Internet Explorer, the            <code>Sarissa.getDomDocument</code> method returns a DOM Document            object, using the most recent MSXML ProgID available in your system            for that Class. So supposing MSXML4.0 is available, the equivalent statement for IE is:         </p>      <pre xml:space="preserve">var oDomDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");</pre>      <p>        <span class="bold">If</span> the arguments to the factory method            include a namespace URI and node name, the proper DocumentElement            is built and inserted in the Document object in IE as well.         </p>    </div>    <div class="section">      <h3>        <a id="getxmlhttp">How to obtain an XMLHTTP Request object</a>      </h3>      <p>            Creating an XMLHTTP/XMLHttpRequest is as easy as          </p>      <pre xml:space="preserve">var xmlhttp = new XMLHttpRequest();</pre>      <p>            In IE 7 this works ASIS. For users under IE prior to version 7,             an XMLHTTP object is returned using the most            recent MSXML ProgID found in the client system. So, supposing that            the user has MSXML4.0 installed, the above is equal to:         </p>      <pre xml:space="preserve">var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");</pre>      <p>            Further coding on XMLHTTP objects is the same for both browsers,            so:         </p>      <pre xml:space="preserve">var xmlhttp = new XMLHttpRequest();xmlhttp.open("GET", "http://foo.org/someDocument.xml", false);// if needed set header information // using the setRequestHeader methodxmlhttp.send('');alert(new XMLSerializer().serializeToString(xmlhttp.responseXML));</pre>      <p>            will load the document from the server and then throw an alertbox            with the contents of the file to your screen. XMLHTTP objects            support both synchronous and asynchronous loading of remote XML            documents (note the third parameter of the            <code>xmlhttp.open</code> method above). In asynchronous loading,            you will probably want to call a function to handle the object readystatechange 			events, see if loading is completed and then do whatever. To do that, add your             onreadystatechange handler function before calling the <code>send</code> method. Something            like:         </p>      <pre xml:space="preserve">xmlhttp.onreadystatechange = function(){	if(xmlhttp.readyState == 4)		alert("Finished loading!");};</pre>    </div>        <div class="section">      <h3>        <a id="loadstring">How to load an XML Document Object from an XML String</a>      </h3>      <p>            You can also make a DOM Document "load" using an String            variable with XML content. It's pretty simple using the            <code>DOMParser</code> object:         </p>      <pre xml:space="preserve">var oDomDoc = Sarissa.getDomDocument();var xmlString = "&lt;root&gt;my xml!&lt;/root&gt;";oDomDoc = (new DOMParser()).parseFromString(xmlString, "text/xml");alert(new XMLSerializer().serializeToString(oDomDoc));</pre>      </div>        <div class="section">      <h3>        <a id="serializedom">How serialize an XML DOM node to a string</a>      </h3>      <p>            To serialize an XML DOM Node simply feed it to an <code>XMLSerializer</code> object:         </p>      <pre xml:space="preserve">var xmlString = new XMLSerializer().serializeToString(someXmlDomNode);</pre>      </div>    <div class="section">      <h3>        <a id="parseerror">How to check for parsing errors</a>      </h3>      	<p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -