|
From: <et...@us...> - 2011-05-19 20:58:30
|
Revision: 4358
http://mxquery.svn.sourceforge.net/mxquery/?rev=4358&view=rev
Author: etterth
Date: 2011-05-19 20:58:22 +0000 (Thu, 19 May 2011)
Log Message:
-----------
- Removed dependency on third party tidy library.
- New tidy function uses iframes with document.write to use the browser's integrated parser (drawback: js code in the document will be executed)
Modified Paths:
--------------
trunk/MXQuery/xqib_NOTICE
trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml
trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HttpIO.java
Added Paths:
-----------
trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HtmlParser.java
Removed Paths:
-------------
trunk/MXQuery/xqib_src/nu/
Modified: trunk/MXQuery/xqib_NOTICE
===================================================================
--- trunk/MXQuery/xqib_NOTICE 2011-05-19 18:41:47 UTC (rev 4357)
+++ trunk/MXQuery/xqib_NOTICE 2011-05-19 20:58:22 UTC (rev 4358)
@@ -13,103 +13,4 @@
- Apache Software Foundation (Java helper classes, Xerces)
- Robert Hanson (Regular Expressions from GWT widgets) for XQIB-JS
- GWT calendar project (time and calendar support) for XQIB-JS
- - Validator.nu HTML Parser for XQIB-JS
-License for Validator.nu HTML Parser:
-
-This is for the HTML parser as a whole except the rewindable input stream,
-the named character classes and the Live DOM Viewer.
-For the copyright notices for individual files, please see individual files.
-
-/*
- * Copyright (c) 2005, 2006, 2007 Henri Sivonen
- * Copyright (c) 2007-2011 Mozilla Foundation
- * Portions of comments Copyright 2004-2007 Apple Computer, Inc., Mozilla
- * Foundation, and Opera Software ASA.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-The following license is for the WHATWG spec from which the named character
-data was extracted.
-
-/*
- * Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and Opera
- * Software ASA.
- *
- * You are granted a license to use, reproduce and create derivative works of
- * this document.
- */
-
-The following license is for the rewindable input stream.
-
-/*
- * Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Thai Open Source Software Center Ltd nor
- * the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-The following license applies to the Live DOM Viewer:
-
-Copyright (c) 2000, 2006, 2008 Ian Hickson and various contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml 2011-05-19 18:41:47 UTC (rev 4357)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml 2011-05-19 20:58:22 UTC (rev 4358)
@@ -15,7 +15,6 @@
<inherits name="ch.ethz.mxquery"/>
<inherits name="java"/>
<inherits name="com.google.gwt.xml.XML" />
-<inherits name="nu.validator.htmlparser.HtmlParser" />
<!-- <inherits name="nu.validator.htmlparser.HtmlParser" /> -->
<!-- <set-property name="user.agent" value="ie6" /> -->
Added: trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HtmlParser.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HtmlParser.java (rev 0)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HtmlParser.java 2011-05-19 20:58:22 UTC (rev 4358)
@@ -0,0 +1,20 @@
+package ch.ethz.mxquery.extensionsModules.expathhttp;
+
+import ch.ethz.mxquery.util.browser.dom.Document;
+
+public class HtmlParser {
+ public static Document tidyAndParse(String html){
+ return nativeTidyAndParse(html);
+ }
+
+ static protected native Document nativeTidyAndParse(String html)/*-{
+ var a = $doc.createElement('iframe');
+ a.style.visibility = 'hidden';
+ $doc.documentElement.appendChild(a);
+ a.contentWindow.document.write(html);
+ var doc = a.contentWindow.document;
+ a.parentNode.removeChild(a);
+ return doc;
+ }-*/;
+
+}
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HttpIO.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HttpIO.java 2011-05-19 18:41:47 UTC (rev 4357)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HttpIO.java 2011-05-19 20:58:22 UTC (rev 4358)
@@ -22,8 +22,6 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.IFrameElement;
-import nu.validator.htmlparser.gwt.HtmlParser;
-
import ch.ethz.mxqjs.client.Environment;
import ch.ethz.mxqjs.client.QnameAndArity;
import ch.ethz.mxquery.bindings.WindowFactory;
@@ -770,19 +768,14 @@
// Document doc = DOMImpl.impl.getIFrameDocument(iframe);
// doc.write(conn.responseAsString());
- Document doc = Document.createDocument();
+// Document doc = Document.createDocument();
// Element el = doc.getAsGwtDocument().getDocumentElement();
// el.removeFromParent();
// el = doc.getAsGwtDocument().getDocumentElement();
- nu.validator.htmlparser.gwt.HtmlParser tidyparser = new HtmlParser(doc);
- try {
- tidyparser.parse(conn.responseAsString(), null);
- } catch (SAXException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+// HtmlParser tidyparser = new HtmlParser(doc);
+ Document doc = HtmlParser.tidyAndParse(conn.responseAsString());
+
-
resIts[resIts.length - 1] = new NodeStoreIterator(
doc);
// Element el = doc.getAsGwtDocument().getDocumentElement();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|