|
From: <et...@us...> - 2011-05-08 16:32:37
|
Revision: 4325
http://mxquery.svn.sourceforge.net/mxquery/?rev=4325&view=rev
Author: etterth
Date: 2011-05-08 16:32:28 +0000 (Sun, 08 May 2011)
Log Message:
-----------
- Tidy support for XQIB
Modified Paths:
--------------
trunk/MXQuery/build.xml
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
trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/DOMImpl.java
trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Document.java
trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Element.java
Added Paths:
-----------
trunk/MXQuery/gwt-2.3.0/
trunk/MXQuery/gwt-2.3.0/gwt-dev.jar
trunk/MXQuery/gwt-2.3.0/gwt-user.jar
trunk/MXQuery/xqib_samples/data/
trunk/MXQuery/xqib_samples/data/test.html
trunk/MXQuery/xqib_samples/tidy.html
trunk/MXQuery/xqib_src/nu/
trunk/MXQuery/xqib_src/nu/validator/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/HtmlParser.gwt.xml
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Auto.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/CharacterName.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Const.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/IdType.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Inline.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Literal.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Local.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NoLength.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NsUri.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Prefix.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/QName.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Virtual.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/package.html
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/ByteReadable.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/CharacterHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DoctypeExpectation.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentMode.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentModeHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/EncodingDeclarationHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/Heuristics.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/Interner.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/TokenHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/TransitionHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/XmlViolationPolicy.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/package.html
trunk/MXQuery/xqib_src/nu/validator/htmlparser/gwt/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/gwt/BrowserTreeBuilder.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/gwt/HtmlParser.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/gwt/HtmlParserModule.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/gwt/ParseEndListener.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/AttributeName.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/CoalescingTreeBuilder.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/ElementName.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/ErrorReportingTokenizer.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/HotSpotWorkaround.txt
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/HtmlAttributes.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/LocatorImpl.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/MetaScanner.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/NCName.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/NamedCharacters.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/NamedCharactersAccel.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/Portability.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/PushedLocation.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/StackNode.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/StateSnapshot.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/TaintableLocatorImpl.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/Tokenizer.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/Tokenizer.java.orig
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/TreeBuilder.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/TreeBuilderState.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/UTF16Buffer.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/impl/package.html
trunk/MXQuery/xqib_src/nu/validator/htmlparser/public/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/java/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/java/io/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/java/io/IOException.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/Attributes.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/ErrorHandler.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/Locator.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/SAXException.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/SAXParseException.java
trunk/MXQuery/xqib_src/nu/validator/htmlparser/translatable/org/xml/sax/package.html
trunk/MXQuery/xqib_src/nu/validator/saxtree/
trunk/MXQuery/xqib_src/nu/validator/saxtree/CDATA.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/CharBufferNode.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Characters.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Comment.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/DTD.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Document.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/DocumentFragment.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Element.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Entity.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/IgnorableWhitespace.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/LocatorImpl.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/Node.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/NodeType.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/NullLexicalHandler.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/ParentNode.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/PrefixMapping.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/ProcessingInstruction.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/SkippedEntity.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/TreeBuilder.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/TreeParser.java
trunk/MXQuery/xqib_src/nu/validator/saxtree/package.html
Removed Paths:
-------------
trunk/MXQuery/gwt-2.1.0/
Modified: trunk/MXQuery/build.xml
===================================================================
--- trunk/MXQuery/build.xml 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/build.xml 2011-05-08 16:32:28 UTC (rev 4325)
@@ -522,14 +522,15 @@
<pathelement location="lib/junit.jar"/>
<!--<pathelement location="${ECLIPSE_HOME}/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar"/>-->
</path>
- <path id="GWT SDK [GWT (1) - 2.1.0].libraryclasspath">
- <pathelement location="gwt-2.1.0/gwt-user.jar"/>
- <pathelement location="gwt-2.1.0/gwt-dev.jar"/>
+
+ <path id="GWT SDK.libraryclasspath">
+ <pathelement location="gwt-2.3.0/gwt-user.jar"/>
+ <pathelement location="gwt-2.3.0/gwt-dev.jar"/>
</path>
<path id="MXQueryJS.classpath">
<pathelement location="${gwt_webclasses.dir}"/>
<path refid="JUnit 4.libraryclasspath"/>
- <path refid="GWT SDK [GWT (1) - 2.1.0].libraryclasspath"/>
+ <path refid="GWT SDK.libraryclasspath"/>
</path>
<path id="run.MXQueryJS.classpath">
<pathelement location="${xqibtmp.dir}"/>
@@ -842,7 +843,7 @@
<path id="run.XQTS all.classpath">
<path refid="MXQueryJS.classpath"/>
- <path refid="GWT SDK [GWT (1) - 2.1.0].libraryclasspath"/>
+ <path refid="GWT SDK.libraryclasspath"/>
<pathelement location="${xqibjunit.dir}"/>
<!--<pathelement location="xqib_test"/>-->
<pathelement location="${xqibtmp.dir}"/>
Added: trunk/MXQuery/gwt-2.3.0/gwt-dev.jar
===================================================================
(Binary files differ)
Property changes on: trunk/MXQuery/gwt-2.3.0/gwt-dev.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/MXQuery/gwt-2.3.0/gwt-user.jar
===================================================================
(Binary files differ)
Property changes on: trunk/MXQuery/gwt-2.3.0/gwt-user.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/MXQuery/xqib_NOTICE
===================================================================
--- trunk/MXQuery/xqib_NOTICE 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_NOTICE 2011-05-08 16:32:28 UTC (rev 4325)
@@ -13,4 +13,103 @@
- 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.
Added: trunk/MXQuery/xqib_samples/data/test.html
===================================================================
--- trunk/MXQuery/xqib_samples/data/test.html (rev 0)
+++ trunk/MXQuery/xqib_samples/data/test.html 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8'>
+<title>Test doc</title>
+</head>
+<body>
+<ul>
+<li>B</li>
+<li>A
+<ul>
+<li>3</li>
+<li>1</li>
+<li>2</li>
+</ul>
+</li>
+<li>C</li>
+</ul>
+</body>
+</html>
Added: trunk/MXQuery/xqib_samples/tidy.html
===================================================================
--- trunk/MXQuery/xqib_samples/tidy.html (rev 0)
+++ trunk/MXQuery/xqib_samples/tidy.html 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>XQIB: Sample page</title>
+ <meta charset="UTF-8"/>
+ <link href="style.css" rel="stylesheet" type="text/css">
+ <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
+ <script type="application/xquery">
+ import module namespace http-client = "http://expath.org/ns/http-client";
+
+ declare updating function local:getWeather($loc, $evtObj) {
+ let $forecast := http-client:send-request(
+ <http-client:request href="data/test.html" method="get"/>
+ )[2]
+ return
+
+ insert node
+ <div>{$forecast//li/ul}</div>
+ as last into b:dom()//body,
+
+ delete node b:dom()//div
+ };
+
+
+ b:addEventListener(b:dom()//input[@name="button"], "onclick", xs:QName("local:getWeather"))
+
+ </script>
+ </head>
+ <body>
+ <a href="index.html"><< Index</a>
+ <h1>Weather forecast</h1>
+ <a href="WeatherREST.html">Page</a> | <a href="WeatherREST_source.html">Source</a>
+ <p/>
+ <input type="text" value="" style="font-size: 30pt; font-weight: bold" name="city"/>
+ <input type="button" value="Go!" style="font-size: 30pt; font-weight: bold" name="button"/>
+ <div><img src="JupiterZeus.gif"/></div>
+ </body>
+</html>
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxqjs/MXQueryJS.gwt.xml 2011-05-08 16:32:28 UTC (rev 4325)
@@ -14,7 +14,9 @@
<inherits name="ch.ethz.mxquery"/>
<inherits name="java"/>
-<inherits name="com.google.gwt.xml.XML" />
+ <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" /> -->
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-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/extensionsModules/expathhttp/HttpIO.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -15,31 +15,27 @@
package ch.ethz.mxquery.extensionsModules.expathhttp;
-import java.io.BufferedInputStream;
-import java.io.DataOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
+import java.util.Vector;
+import org.xml.sax.SAXException;
+
+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.util.Hashtable;
-import java.util.Vector;
-
import ch.ethz.mxquery.bindings.WindowFactory;
import ch.ethz.mxquery.contextConfig.CompilerOptions;
import ch.ethz.mxquery.contextConfig.Context;
import ch.ethz.mxquery.datamodel.Identifier;
import ch.ethz.mxquery.datamodel.IdentifierFactory;
-import ch.ethz.mxquery.datamodel.MXQueryBinary;
import ch.ethz.mxquery.datamodel.QName;
import ch.ethz.mxquery.datamodel.Source;
import ch.ethz.mxquery.datamodel.XQName;
import ch.ethz.mxquery.datamodel.types.Type;
import ch.ethz.mxquery.datamodel.types.TypeInfo;
-import ch.ethz.mxquery.datamodel.xdm.BinaryToken;
import ch.ethz.mxquery.datamodel.xdm.ElementToken;
import ch.ethz.mxquery.datamodel.xdm.NamedToken;
import ch.ethz.mxquery.datamodel.xdm.TextToken;
@@ -63,21 +59,18 @@
import ch.ethz.mxquery.query.PreparedStatement;
import ch.ethz.mxquery.query.XQCompiler;
import ch.ethz.mxquery.query.impl.CompilerImpl;
-import ch.ethz.mxquery.update.store.domImpl.NodeStore;
import ch.ethz.mxquery.util.Base64;
-import ch.ethz.mxquery.util.LineReader;
+import ch.ethz.mxquery.util.Hashtable;
import ch.ethz.mxquery.util.LogLevel;
import ch.ethz.mxquery.util.Logger;
-import ch.ethz.mxquery.util.StringReader;
-import ch.ethz.mxquery.util.browser.AsyncXmlHttpRequest;
import ch.ethz.mxquery.util.browser.AsyncXmlHttpRequestWrapper;
import ch.ethz.mxquery.util.browser.CachedDownloader;
-import ch.ethz.mxquery.util.browser.SyncXmlHttpRequest;
import ch.ethz.mxquery.util.browser.SyncXmlHttpRequestWrapper;
-import ch.ethz.mxquery.util.browser.XmlHttpRequest;
import ch.ethz.mxquery.util.browser.XmlHttpRequestWrappedHandler;
import ch.ethz.mxquery.util.browser.XmlHttpRequestWrapper;
-import ch.ethz.mxquery.xdmio.XDMInputFactory;
+import ch.ethz.mxquery.util.browser.dom.DOMImpl;
+import ch.ethz.mxquery.util.browser.dom.Document;
+import ch.ethz.mxquery.util.browser.dom.Node;
import ch.ethz.mxquery.xdmio.XDMSerializer;
import ch.ethz.mxquery.xdmio.XDMSerializerSettings;
@@ -761,19 +754,51 @@
// resIts[resIts.length - 1] = XDMInputFactory.createXMLInput(
// context, new StringReader(result.toString()), false,
// context.getInputValidationMode(), loc);
- } else if (contentType.indexOf("html") >= 0) {
- resIts[resIts.length - 1] = new TokenIterator(context,
- new TextToken(Type.TEXT_NODE_UNTYPED_ATOMIC,
- createNextTokenId(3), conn.responseAsString(),
- curNsScope), loc, false);
+ } else {
+ String responseString = conn.responseAsString();
+ if (contentType.indexOf("html") >= 0) {
+// resIts[resIts.length - 1] = new TokenIterator(context,
+// new TextToken(Type.TEXT_NODE_UNTYPED_ATOMIC,
+// createNextTokenId(3), conn.responseAsString(),
+// curNsScope), loc, false);
// TODO tidy input
+
+// IFrameElement iframe = com.google.gwt.dom.client.Document.get().createIFrameElement();
+// iframe.setInnerHTML( );
+
+
+
+// Document doc = DOMImpl.impl.getIFrameDocument(iframe);
+// doc.write(conn.responseAsString());
+ 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();
+ }
+
+
+ resIts[resIts.length - 1] = new NodeStoreIterator(
+ doc);
+// Element el = doc.getAsGwtDocument().getDocumentElement();
+// int crap =0;
+
+// Element el = com.google.gwt.dom.client.Document.get().createDivElement();
+// el.setInnerHTML(responseString);
+// resIts[resIts.length - 1] = new NodeStoreIterator(
+// Node.createFromGwtNode(el));
// resIts[resIts.length - 1] = XDMInputFactory.createTidyInput(
// context, new StringReader(result.toString()), loc);
- } else if (contentType.startsWith("text/")
+ } else if (contentType.startsWith("text/")
|| contentType.equalsIgnoreCase("application/xml-dtd")) {
resIts[resIts.length - 1] = new TokenIterator(context,
new TextToken(Type.TEXT_NODE_UNTYPED_ATOMIC,
- createNextTokenId(3), conn.responseAsString(),
+ createNextTokenId(3), responseString,
curNsScope), loc, false);
// TODO
@@ -781,7 +806,7 @@
// new TextToken(Type.TEXT_NODE_UNTYPED_ATOMIC,
// createNextTokenId(3), result
// .toString(), curNsScope), loc, false);
- } else { // not identified => binary
+ } else { // not identified => binary
// TODO
// resIts[resIts.length - 1] = new TokenIterator(context,
// new BinaryToken(
@@ -789,6 +814,7 @@
// createNextTokenId(3),
// new MXQueryBinary(data, Type.BASE64_BINARY),
// curNsScope), loc, false);
+ }
}
}
}
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/DOMImpl.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/DOMImpl.java 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/DOMImpl.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -7,6 +7,7 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
+import com.google.gwt.dom.client.IFrameElement;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.TextAreaElement;
@@ -173,4 +174,13 @@
return document.createElementNS(nameSpaceURI, localName);
}-*/;
+ public native Document createDocument() /*-{
+ return $doc.implementation.createDocument('http://www.w3.org/1999/xhtml', '', null);
+}-*/;
+
+// public native Document getIFrameDocument(IFrameElement iframe) /*-{
+//// $wnd.ifr = iframe;
+// return iframe.contentDocument.document;
+//}-*/;
+
}
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Document.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Document.java 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Document.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -1,5 +1,6 @@
package ch.ethz.mxquery.util.browser.dom;
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Window;
public class Document extends Node{
@@ -25,4 +26,12 @@
public final native Node createComment(String value) /*-{
return this.createComment(value);
}-*/;
+
+ public static Document createDocument() {
+ return DOMImpl.impl.createDocument();
+ }
+
+ public final native void write(String str)/*-{
+ this.write(str);
+ }-*/;
}
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Element.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Element.java 2011-05-06 22:35:11 UTC (rev 4324)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/util/browser/dom/Element.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -10,6 +10,9 @@
}
+ public static Element createFromGwtNode(com.google.gwt.dom.client.Node n){
+ return (Element)(Object)n;
+ }
public final com.google.gwt.dom.client.Element getAsGwtElement() {
return (com.google.gwt.dom.client.Element)(Object)this;
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/HtmlParser.gwt.xml
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/HtmlParser.gwt.xml (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/HtmlParser.gwt.xml 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,11 @@
+<module>
+ <inherits name="com.google.gwt.core.Core"/>
+ <inherits name="com.google.gwt.user.User"/>
+ <super-source path="translatable"/>
+ <source path="annotation"/>
+ <source path="common"/>
+ <source path="impl"/>
+ <source path="gwt"/>
+ <entry-point class="nu.validator.htmlparser.gwt.HtmlParserModule"/>
+ <add-linker name="sso"/>
+</module>
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Auto.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Auto.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Auto.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+public @interface Auto {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/CharacterName.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/CharacterName.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/CharacterName.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+public @interface CharacterName {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Const.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Const.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Const.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * Marker for translating into the C++ const keyword on the declaration in
+ * question.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Const {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/IdType.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/IdType.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/IdType.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The type for attribute IDness. (In Java, an interned string
+ * <code>"CDATA"</code> or <code>"ID"</code>.)
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface IdType {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Inline.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Inline.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Inline.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2009-2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * Translates into the C++ inline keyword.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Inline {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Literal.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Literal.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Literal.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2009-2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * Marks a string type as being the literal string type (typically const char*)
+ * in C++.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Literal {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Local.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Local.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Local.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The local name of an element or attribute. Must be comparable with
+ * <code>==</code> (interned <code>String</code> in Java).
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Local {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NoLength.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NoLength.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NoLength.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The array type marked with this annotation won't have its
+ * <code>.length</code> read.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface NoLength {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NsUri.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NsUri.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/NsUri.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The namespace URI type. (In Java, an interned <code>String</code>.)
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface NsUri {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Prefix.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Prefix.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Prefix.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The type for namespace prefixes. (In Java, an interned <code>String</code>.)
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Prefix {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/QName.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/QName.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/QName.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * The type for qualified names. (In Java, an interned <code>String</code>.)
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface QName {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Virtual.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Virtual.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/Virtual.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.annotation;
+
+/**
+ * Marks a method as virtualy in C++.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public @interface Virtual {
+
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/package.html
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/package.html (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/annotation/package.html 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head><title>Package Overview</title>
+<!--
+ Copyright (c) 2008 Mozilla Foundation
+
+ 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.
+-->
+</head>
+<body bgcolor="white">
+<p>This package provides annotations for facilitating automated translation
+of the source code into other programming languages.</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/ByteReadable.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/ByteReadable.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/ByteReadable.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ * Copyright (c) 2010 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.common;
+
+import java.io.IOException;
+
+/**
+ * An interface for providing a method for reading a stream of bytes one byte at
+ * a time.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public interface ByteReadable {
+ /**
+ * Returns the value of the next byte as an integer from 0 to 0xFF or -1 if
+ * the stream has ended.
+ *
+ * @return integer from 0 to 0xFF or -1 on EOF
+ * @throws IOException
+ */
+ public int readByte() throws IOException;
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/CharacterHandler.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/CharacterHandler.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/CharacterHandler.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007-2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.common;
+
+import org.xml.sax.SAXException;
+
+/**
+ * An interface for receiving notifications of UTF-16 code units read from a character stream.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public interface CharacterHandler {
+
+ /**
+ * Receive notification of a run of UTF-16 code units.
+ * @param ch the buffer
+ * @param start start index in the buffer
+ * @param length the number of characters to process starting from <code>start</code>
+ * @throws SAXException if things go wrong
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException;
+
+ /**
+ * Signals the end of the stream. Can be used for cleanup. Doesn't mean that the stream ended successfully.
+ *
+ * @throws SAXException if things go wrong
+ */
+ public void end() throws SAXException;
+
+ /**
+ * Signals the start of the stream. Can be used for setup.
+ *
+ * @throws SAXException if things go wrong
+ */
+ public void start() throws SAXException;
+
+}
\ No newline at end of file
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DoctypeExpectation.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DoctypeExpectation.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DoctypeExpectation.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.common;
+
+/**
+ * Used for indicating desired behavior with legacy doctypes.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public enum DoctypeExpectation {
+ /**
+ * Be a pure HTML5 parser.
+ */
+ HTML,
+
+ /**
+ * Require the HTML 4.01 Transitional public id. Turn on HTML4-specific
+ * additional errors regardless of doctype.
+ */
+ HTML401_TRANSITIONAL,
+
+ /**
+ * Require the HTML 4.01 Transitional public id and a system id. Turn on
+ * HTML4-specific additional errors regardless of doctype.
+ */
+ HTML401_STRICT,
+
+ /**
+ * Treat the doctype required by HTML 5, doctypes with the HTML 4.01 Strict
+ * public id and doctypes with the HTML 4.01 Transitional public id and a
+ * system id as non-errors. Turn on HTML4-specific additional errors if the
+ * public id is the HTML 4.01 Strict or Transitional public id.
+ */
+ AUTO,
+
+ /**
+ * Never enable HTML4-specific error checks. Never report any doctype
+ * condition as an error. (Doctype tokens in wrong places will be
+ * reported as errors, though.) The application may decide what to log
+ * in response to calls to <code>DocumentModeHanler</code>. This mode
+ * in meant for doing surveys on existing content.
+ */
+ NO_DOCTYPE_ERRORS
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentMode.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentMode.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentMode.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ * Copyright (c) 2008 Mozilla Foundation
+ *
+ * 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.
+ */
+
+package nu.validator.htmlparser.common;
+
+/**
+ * Represents the HTML document compatibility mode.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public enum DocumentMode {
+ /**
+ * The Standards Mode
+ */
+ STANDARDS_MODE,
+
+ /**
+ * The Limited Quirks Mode aka. The Almost Standards Mode
+ */
+ ALMOST_STANDARDS_MODE,
+
+ /**
+ * The Quirks Mode
+ */
+ QUIRKS_MODE
+}
Added: trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentModeHandler.java
===================================================================
--- trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentModeHandler.java (rev 0)
+++ trunk/MXQuery/xqib_src/nu/validator/htmlparser/common/DocumentModeHandler.java 2011-05-08 16:32:28 UTC (rev 4325)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ *
+ * 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, EXPR...
[truncated message content] |