[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: DOM fix from Chris

Kaffe CVS cvs-commits at kaffe.org
Mon Mar 21 08:41:30 PST 2005


PatchSet 5579 
Date: 2005/03/21 16:36:56
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: DOM fix from Chris

2005-03-21  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-03-17  Chris Burdess  <dog at gnu.org>

        * gnu/xml/dom/html2/DomHTMLDocument.java: Fixed element creation and
        check for HTML/XHTML namespace.

Members: 
	ChangeLog:1.3753->1.3754 
	libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3753 kaffe/ChangeLog:1.3754
--- kaffe/ChangeLog:1.3753	Mon Mar 21 14:01:04 2005
+++ kaffe/ChangeLog	Mon Mar 21 16:36:56 2005
@@ -2,6 +2,15 @@
 
 	Resynced with GNU Classpath.
 
+	2005-03-17  Chris Burdess  <dog at gnu.org>
+
+        * gnu/xml/dom/html2/DomHTMLDocument.java: Fixed element creation and
+        check for HTML/XHTML namespace.
+
+2005-03-21  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-03-16  Archie Cobbs  <archie at dellroad.org>
 
         * native/jni/java-nio/java_nio_VMDirectByteBuffer.c: use
Index: kaffe/libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java
diff -u kaffe/libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java:1.2 kaffe/libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java:1.3
--- kaffe/libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java:1.2	Tue Mar 15 01:57:26 2005
+++ kaffe/libraries/javalib/gnu/xml/dom/html2/DomHTMLDocument.java	Mon Mar 21 16:36:59 2005
@@ -44,7 +44,9 @@
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -139,11 +141,33 @@
     ELEMENT_CLASSES = Collections.unmodifiableMap(map);
   }
 
+  private static Set HTML_NS_URIS;
+  static
+  {
+    Set set = new HashSet();
+    set.add("http://www.w3.org/TR/html4/strict");
+    set.add("http://www.w3.org/TR/html4/loose");
+    set.add("http://www.w3.org/TR/html4/frameset");
+    set.add("http://www.w3.org/1999/xhtml");
+    set.add("http://www.w3.org/TR/xhtml1/strict");
+    set.add("http://www.w3.org/TR/xhtml1/loose");
+    set.add("http://www.w3.org/TR/xhtml1/frameset");
+    HTML_NS_URIS = Collections.unmodifiableSet(set);
+  }
+
+  /**
+   * Convenience constructor.
+   */
+  public DomHTMLDocument()
+  {
+    this(new DomHTMLImpl());
+  }
+
   /**
    * Constructor.
-   * This is called by the implementation.
+   * This is called by the DOMImplementation.
    */
-  protected DomHTMLDocument(DomHTMLImpl impl)
+  public DomHTMLDocument(DomHTMLImpl impl)
   {
     super(impl);
   }
@@ -366,6 +390,11 @@
 
   public Element createElementNS(String uri, String qName)
   {
+    /* If a non-HTML element, use the default implementation. */
+    if (uri != null && !HTML_NS_URIS.contains(uri))
+      {
+        return super.createElementNS(uri, qName);
+      }
     String localName = qName.toLowerCase();
     int ci = qName.indexOf(':');
     if (ci != -1)
@@ -373,13 +402,14 @@
         localName = qName.substring(ci + 1);
       }
     Class t = (Class) ELEMENT_CLASSES.get(localName);
+    /* If a non-HTML element, use the default implementation. */
     if (t == null)
       {
         return super.createElementNS(uri, qName);
       }
     try
       {
-        Constructor c = t.getConstructor(ELEMENT_PT);
+        Constructor c = t.getDeclaredConstructor(ELEMENT_PT);
         Object[] args = new Object[] { this, uri, qName };
         return (Element) c.newInstance(args);
       }




More information about the kaffe mailing list