summaryrefslogtreecommitdiff
path: root/javax/swing/text
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2005-03-23 21:00:01 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2005-03-23 21:00:01 +0000
commit04584c32ab98eb03c4d5306697133ebfc77707da (patch)
tree6bc467b1a7d1c233bf3985948239572fb02a26cc /javax/swing/text
parentc55b14bbb27567f21b6aba788fbb935fa07de7b4 (diff)
downloadclasspath-04584c32ab98eb03c4d5306697133ebfc77707da.tar.gz
2005-03-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
Merged HEAD --> generics for 2005-03-13 to 2005-03-23. 2005-03-23 Andrew John Hughes <gnu_andrew@member.fsf.org> * gnu/xml/dom/html2/DomHTMLParser.java Changed 'enum' references to become 'enumeration'. 2005-03-22 Archie Cobbs <archie@dellroad.org> * configure.ac: Generate scripts/classpath.spec. * scripts/classpath.spec.in: New file. 2005-03-21 Audrius Meskauskas <audriusa@bluewin.ch> * gnu/xml/dom/html2/DomHTMLParser.java: New file. * gnu/classpath/examples/html/Demo.java: New example. 2005-03-21 Sven de Marothy <sven@physto.se> * gnu/classpath/SystemProperties.java, Add missing aliases for "UnicodeBigUnmarked" and UnicodeLittleUnmarked". 2005-03-21 Mark Wielaard <mark@klomp.org> * doc/www.gnu.org/events/escape_fosdem05.wml: Add link to kaffe presentation. 2005-03-19 Archie Cobbs <archie@dellroad.org> * vm/reference/java/lang/VMClassLoader.java: handle ZIP files on the boot loader class path in getResources() 2005-03-19 Audrius Meskauskas <audriusa@bluewin.ch> * org/omg/CORBA/AnySeqHolder.java, org/omg/CORBA/AnySeqHelper.java, org/omg/CORBA/CompletionStatusHelper.java: New files. 2005-03-18 Mark Wielaard <mark@klomp.org> * doc/www/downloads/downloads.wml: Add 0.14. * doc/www/announce/20050226.wml: New file. 2005-03-18 Sven de Marothy <sven@physto.se> * java/util/zip/GZIPInputStream.java: (GZIPInputStream): Read header in constructor. 2005-03-18 Audrius Meskauskas <audriusa@bluewin.ch> * ChangeLog.usermap: New file (replacing). 2005-03-18 Audrius Meskauskas <audriusa@bluewin.ch> * javax/swing/text/html/parser/Entity.java (getType): New method. * javax/swing/text/html/parser/DocumentParser.java: Inherit from javax.swing.text.html.parser.Parser. 2005-03-18 Robert Schuster <thebohemian@gmx> * native/jni/java-nio/gnu_java_nio_VMSelector.c: Added important return statement after throwing exception. 2005-03-18 Robert Schuster <thebohemian@gmx> * native/jni/java-nio/gnu_java_nio_VMSelector.c: Implemented Java_gnu_java_nio_VMSelector_select. * configure.ac: Added check for sys/select.h and strerro_r(). 2005-03-17 Mark Wielaard <mark@klomp.org> * doc/www.gnu.org/newsitems.txt: Add 0.14 release announcement and link for the dead of the gui branch. 2005-03-17 Chris Burdess <dog@gnu.org> * gnu/xml/dom/html2/DomHTMLDocument.java: Fixed element creation and check for HTML/XHTML namespace. 2005-03-16 Tom Tromey <tromey@redhat.com> * gnu/java/lang/MainThread.java (MainThread): Load main class using system class loader. 2005-03-16 Archie Cobbs <archie@dellroad.org> * native/jni/java-nio/java_nio_VMDirectByteBuffer.c: use global native reference to wrap persistent jclass variable. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c: use DeleteLocalRef() to avoid exhausting local native references. 2005-03-16 Mark Wielaard <mark@klomp.org> * doc/vmintegration.texinfo: Change input start to \input. 2005-03-16 Robert Schuster <thebohemian@gmx.net> * doc/vmintegration.texinfo: Added explanation of gnu.classpath.boot.library.path property. 2005-03-16 Robert Schuster <thebohemian@gmx.net> * java/lang/Runtime.java: Added support for gnu.classpath.boot.library.path system property. 2005-03-14 Chris Burdess <dog@gnu.org> * gnu/xml/dom/DomImpl.java, gnu/xml/dom/html2/DomHTMLAnchorElement.java, gnu/xml/dom/html2/DomHTMLDocument.java, gnu/xml/dom/html2/DomHTMLElement.java, gnu/xml/dom/html2/DomHTMLFormElement.java, gnu/xml/dom/html2/DomHTMLFrameElement.java, gnu/xml/dom/html2/DomHTMLIFrameElement.java, gnu/xml/dom/html2/DomHTMLImpl.java, gnu/xml/dom/html2/DomHTMLInputElement.java, gnu/xml/dom/html2/DomHTMLObjectElement.java, gnu/xml/dom/html2/DomHTMLOptionElement.java, gnu/xml/dom/html2/DomHTMLSelectElement.java, gnu/xml/dom/html2/DomHTMLTableCellElement.java, gnu/xml/dom/html2/DomHTMLTableElement.java, gnu/xml/dom/html2/DomHTMLTableRowElement.java, gnu/xml/dom/html2/DomHTMLTableSectionElement.java, gnu/xml/dom/html2/DomHTMLTextAreaElement.java: JAXP integration, UI events, and tree utility functions. 2005-03-14 Patrik Reali <reali@acm.org> * doc/www.gnu.org/newsitems.txt: news on gui branch and calientra * doc/www.gnu.org/docs/docs.wml: link to the wiki added * doc/www.gnu.org/faq/faq.wml: entry on tainted developers 2005-03-14 Audrius Meskauskas <audriusa@bluewin.ch> * javax/swing/text/html/parser/Parser.java, javax/swing/text/html/parser/Entity.java: Inheriting from DTDConstants. * javax/swing/text/html/parser/AttributeList.java (getValues): Changed return type. * javax/swing/text/html/parser/DocumentParser (parse): Adding the callback parameter that receives the parsing events. 2005-03-13 Mark Wielaard <mark@klomp.org> * configure.ac: Set version to 0.14+cvs. 2005-03-13 Audrius Meskauskas <audriusa@bluewin.ch> * org/omg/CORBA/BAD_CONTEXT.java, org/omg/CORBA/BAD_INV_ORDER.java, org/omg/CORBA/BAD_OPERATION.java, org/omg/CORBA/BAD_TYPECODE.java, org/omg/CORBA/COMM_FAILURE.java, org/omg/CORBA/DATA_CONVERSION.java, org/omg/CORBA/FREE_MEM.java, org/omg/CORBA/IMP_LIMIT.java, org/omg/CORBA/INITIALIZE.java, org/omg/CORBA/INTERNAL.java, org/omg/CORBA/INTF_REPOS.java, org/omg/CORBA/INVALID_TRANSACTION.java, org/omg/CORBA/INV_FLAG.java, org/omg/CORBA/INV_IDENT.java, org/omg/CORBA/INV_OBJREF.java, org/omg/CORBA/INV_POLICY.java, org/omg/CORBA/NO_IMPLEMENT.java, org/omg/CORBA/NO_MEMORY.java, org/omg/CORBA/NO_PERMISSION.java, org/omg/CORBA/NO_RESPONSE.java, org/omg/CORBA/OBJECT_NOT_EXIST.java, org/omg/CORBA/OBJ_ADAPTER.java, org/omg/CORBA/PERSIST_STORE.java, org/omg/CORBA/TRANSACTION_REQUIRED.java, org/omg/CORBA/TRANSACTION_ROLLEDBACK.java, org/omg/CORBA/TRANSIENT.java: making constructors public. 2005-03-13 Audrius Meskauskas <audriusa@bluewin.ch> * org/omg/CORBA/StringSeqHolder.java, org/omg/CORBA/WStringSeqHolder.java: replacing replacing CR CR LF by CR LF. * org/omg/CORBA/BAD_PARAM.java: making constructors public. 2005-03-13 Michael Koch <konqueror@gmx.de> * org/omg/CORBA/ARG_IN.java: Removed redundant modifiers. * org/omg/CORBA/ARG_INOUT.java: Likewise. * org/omg/CORBA/ARG_OUT.java: Likewise. * org/omg/CORBA/Any.java: Fixed HTML tags. * org/omg/CORBA/Principal.java: Likewise. * org/omg/CORBA/BAD_PARAM.java: Reordered modifiers. * org/omg/CORBA/FixedHolder.java: Reworked imports. * org/omg/CORBA/StringSeqHolder.java: Likewise. * org/omg/CORBA/TypeCode.java: Likewise. * org/omg/CORBA/TypeCodePackage/BadKind.java: Likewise. * org/omg/CORBA/TypeCodePackage/Bounds.java: Likewise. * org/omg/CORBA/WStringSeqHolder.java: Likewise. * org/omg/CORBA/portable/OutputStream.java: Likewise. 2005-03-13 Michael Koch <konqueror@gmx.de> * gnu/java/net/protocol/https/Handler.java: Reworked import statements. 2005-03-13 Michael Koch <konqueror@gmx.de> * gnu/javax/swing/text/html/parser/HTML_401F.java, gnu/javax/swing/text/html/parser/gnuDTD.java, gnu/javax/swing/text/html/parser/models/node.java: Reworked import statements. 2005-03-13 Michael Koch <konqueror@gmx.de> * gnu/xml/aelfred2/XmlParser.java: Fixed typo. And from the previous merge... 2005-03-13 Andrew John Hughes <gnu_andrew@member.fsf.org> * gnu/javax/swing/text/html/parser/htmlAttributeSet.java: (getAttributeNames()): Replaced 'enum' with 'enumeration'. * gnu/javax/swing/text/html/parser/htmlValidator.java: (validateParameters(TagElement,htmlAttributeSet)): Replaced 'enum' with 'enumeration'. (validateAttribute(TagElement,htmlAttributeSet, Enumeration,Enumeration)): Likewise.
Diffstat (limited to 'javax/swing/text')
-rw-r--r--javax/swing/text/html/parser/AttributeList.java5
-rw-r--r--javax/swing/text/html/parser/DocumentParser.java129
-rw-r--r--javax/swing/text/html/parser/Entity.java12
-rw-r--r--javax/swing/text/html/parser/Parser.java3
4 files changed, 134 insertions, 15 deletions
diff --git a/javax/swing/text/html/parser/AttributeList.java b/javax/swing/text/html/parser/AttributeList.java
index faf3ae8b1..70934c0a0 100644
--- a/javax/swing/text/html/parser/AttributeList.java
+++ b/javax/swing/text/html/parser/AttributeList.java
@@ -43,6 +43,7 @@ import gnu.javax.swing.text.html.parser.support.gnuStringIntMapper;
import java.io.Serializable;
import java.util.Vector;
+import java.util.Enumeration;
/**
* <p>
@@ -250,9 +251,9 @@ public class AttributeList
/**
* Get the allowed values of this attribute.
*/
- public Vector getValues()
+ public Enumeration getValues()
{
- return values;
+ return values.elements();
}
/**
diff --git a/javax/swing/text/html/parser/DocumentParser.java b/javax/swing/text/html/parser/DocumentParser.java
index 26abe8bf7..8f7d213b3 100644
--- a/javax/swing/text/html/parser/DocumentParser.java
+++ b/javax/swing/text/html/parser/DocumentParser.java
@@ -38,9 +38,15 @@ exception statement from your version. */
package javax.swing.text.html.parser;
+import gnu.javax.swing.text.html.parser.htmlAttributeSet;
+import javax.swing.text.html.parser.Parser;
+
import java.io.IOException;
import java.io.Reader;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.html.HTMLEditorKit;
+
/**
* <p>A simple error-tolerant HTML parser that uses a DTD document
* to access data on the possible tokens, arguments and syntax.</p>
@@ -71,34 +77,135 @@ public class DocumentParser
implements DTDConstants
{
/**
+ * The enclosed working parser class.
+ */
+ private class gnuParser
+ extends gnu.javax.swing.text.html.parser.support.Parser
+ {
+ private gnuParser(DTD d)
+ {
+ super(d);
+ }
+
+ protected final void handleComment(char[] comment)
+ {
+ parser.handleComment(comment);
+ callBack.handleComment(comment, hTag.where.startPosition);
+ }
+
+ protected final void handleEmptyTag(TagElement tag)
+ throws javax.swing.text.ChangedCharSetException
+ {
+ parser.handleEmptyTag(tag);
+ callBack.handleSimpleTag(tag.getHTMLTag(), getAttributes(),
+ hTag.where.startPosition
+ );
+ }
+
+ protected final void handleEndTag(TagElement tag)
+ {
+ parser.handleEndTag(tag);
+ callBack.handleEndTag(tag.getHTMLTag(), hTag.where.startPosition);
+ }
+
+ protected final void handleError(int line, String message)
+ {
+ parser.handleError(line, message);
+ callBack.handleError(message, hTag.where.startPosition);
+ }
+
+ protected final void handleStartTag(TagElement tag)
+ {
+ parser.handleStartTag(tag);
+ htmlAttributeSet attributes = gnu.getAttributes();
+
+ if (tag.fictional())
+ attributes.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED,
+ Boolean.TRUE
+ );
+
+ callBack.handleStartTag(tag.getHTMLTag(), attributes,
+ hTag.where.startPosition
+ );
+ }
+
+ protected final void handleText(char[] text)
+ {
+ parser.handleText(text);
+ callBack.handleText(text, hTag.where.startPosition);
+ }
+
+ DTD getDTD()
+ {
+ return dtd;
+ }
+ }
+
+ /**
+ * This field is used to access the identically named
+ * methods of the outer class.
+ */
+ private DocumentParser parser = this;
+
+ /**
+ * The callback.
+ */
+ private HTMLEditorKit.ParserCallback callBack;
+
+ /**
+ * The reference to the working class of HTML parser that is
+ * actually used to parse the document.
+ */
+ private gnuParser gnu;
+
+ /**
* Creates a new parser that uses the given DTD to access data on the
* possible tokens, arguments and syntax. There is no single - step way
* to get a default DTD; you must either refer to the implementation -
* specific packages, write your own DTD or obtain the working instance
* of parser in other way, for example, by calling
* {@link javax.swing.text.html.HTMLEditorKit#getParser() }.
- * @param a_dtd A DTD to use.
+ * @param a_dtd a DTD to use.
*/
public DocumentParser(DTD a_dtd)
{
super(a_dtd);
+ gnu = new gnuParser(a_dtd);
}
/**
- * Parse the HTML text, calling various methods in response to the
- * occurence of the corresponding HTML constructions.
- * @param reader The reader to read the source HTML from.
- * @throws IOException If the reader throws one.
+ * Parses the HTML document, calling methods of the provided
+ * callback. This method must be multithread - safe.
+ * @param reader The reader to read the HTML document from
+ * @param callback The callback that is notifyed about the presence
+ * of HTML elements in the document.
+ * @param ignoreCharSet If thrue, any charset changes during parsing
+ * are ignored.
+ * @throws java.io.IOException
*/
- public synchronized void parse(Reader reader)
- throws IOException
+ public void parse(Reader reader, HTMLEditorKit.ParserCallback a_callback,
+ boolean ignoreCharSet
+ )
+ throws IOException
{
- super.parse(reader);
+ callBack = a_callback;
+ gnu.parse(reader);
+
+ callBack.handleEndOfLineString(gnu.getEndOfLineSequence());
+ try
+ {
+ callBack.flush();
+ }
+ catch (BadLocationException ex)
+ {
+ // Convert this into the supported type of exception.
+ throw new IOException(ex.getMessage());
+ }
}
/**
* Handle HTML comment. The default method returns without action.
- * @param comment The comment being handled
+ * @param comment the comment being handled
*/
protected void handleComment(char[] comment)
{
@@ -108,7 +215,7 @@ public class DocumentParser
* Handle the tag with no content, like &lt;br&gt;. The method is
* called for the elements that, in accordance with the current DTD,
* has an empty content.
- * @param tag The tag being handled.
+ * @param tag the tag being handled.
* @throws javax.swing.text.ChangedCharSetException
*/
protected void handleEmptyTag(TagElement tag)
@@ -143,7 +250,7 @@ public class DocumentParser
/**
* Handle the text section.
- * @param text A section text.
+ * @param text a section text.
*/
protected void handleText(char[] text)
{
diff --git a/javax/swing/text/html/parser/Entity.java b/javax/swing/text/html/parser/Entity.java
index bf527e7e1..ba79552c7 100644
--- a/javax/swing/text/html/parser/Entity.java
+++ b/javax/swing/text/html/parser/Entity.java
@@ -54,7 +54,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public final class Entity
- implements Serializable
+ implements DTDConstants, Serializable
{
/**
* Package level mapper between type names and they string values.
@@ -172,4 +172,14 @@ public final class Entity
return sdata;
}
+
+ /**
+ * Get the entity type.
+ * @return the value of the {@link #type}.
+ */
+ public int getType()
+ {
+ return type;
+ }
+
}
diff --git a/javax/swing/text/html/parser/Parser.java b/javax/swing/text/html/parser/Parser.java
index 68593669f..2c5ef81d9 100644
--- a/javax/swing/text/html/parser/Parser.java
+++ b/javax/swing/text/html/parser/Parser.java
@@ -72,7 +72,8 @@ import javax.swing.text.SimpleAttributeSet;
* </p>
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class Parser
+public class Parser
+ implements DTDConstants
{
/**
* The document template description that will be used to parse the documents.