[kaffe] CVS kaffe (dalibor): Resynced with GNU JAXP

Kaffe CVS cvs-commits at kaffe.org
Sun Aug 15 20:04:27 PDT 2004


PatchSet 5070 
Date: 2004/08/16 02:43:39
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU JAXP

2004-08-15  Dalibor Topic  <robilad at kaffe.org>

        * include/Makefile.am:
        Added new libxmlj includes, and remove no longer needed ones.

        * include/Makefile.in,
        libraries/javalib/Makefile.am,
        libraries/javalib/Makefile.in,
        libraries/javalib/all.files:
        Regnerated.

        * libraries/clib/libxmlj/xmlj_dom.c,
        libraries/clib/libxmlj/xmlj_dom.h,
        libraries/clib/libxmlj/xmlj_io.c,
        libraries/clib/libxmlj/xmlj_io.h,
        libraries/clib/libxmlj/xmlj_sax.c,
        libraries/clib/libxmlj/xmlj_transform.c,
        libraries/clib/libxmlj/xmlj_util.c,
        libraries/clib/libxmlj/xmlj_util.h,
        libraries/clib/libxmlj/xmlj_xpath.c,
        libraries/javalib/gnu/xml/aelfred2/SAXDriver.java,
        libraries/javalib/gnu/xml/aelfred2/XmlParser.java,
        libraries/javalib/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java,
        libraries/javalib/gnu/xml/libxmlj/dom/GnomeElement.java,
        libraries/javalib/gnu/xml/libxmlj/dom/GnomeXPathExpression.java,
        libraries/javalib/gnu/xml/libxmlj/sax/GnomeLocator.java,
        libraries/javalib/gnu/xml/libxmlj/sax/GnomeXMLReader.java,
        libraries/javalib/gnu/xml/libxmlj/sax/StringArrayAttributes.java,
        libraries/javalib/gnu/xml/libxmlj/sax/XMLName.java,
        libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java,
        libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java,
        libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java,
        libraries/javalib/org/w3c/dom/bootstrap/DOMImplementationRegistry.java:
        Resynced with GNU JAXP.

        2004-08-10  Chris Burdess <dog at gnu.org>

        * transform: Fixed imports.

        2004-07-30  Chris Burdess <dog at gnu.org>

        * transform: Added support for DOMSource and DOMResult transforms
            to/from GnomeDocument nodes.

        2004-07-27  Chris Burdess <dog at gnu.org>

        * GnomeElement: getAttribute(NS) returns empty strings instead of
            null.
        * sax: Cached java.lang.String class.

        2004-08-10  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Fixed bug while reading 0x2028. Check
        for document version in external subset.

        2004-08-10  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Convert 0x2028 to '\r' when document is 1.1

        2004-08-08  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Report start name characters that are not
        BaseChar. (more of them)

        2004-08-08  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Report start name characters that are not
        BaseChar.

        2004-08-08  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Report NEL characters as igorable if document
        is 1.1

        2004-08-07  Musachy Barroso  <musachy at gmail.com>


        * XmlParser.java: Fixed bug while reading whitespaces in elements
        content.

        2004-08-06  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Check added for missing prefix in namespace
        declaration attribute.

        2004-08-06  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Partial character ref, partial entity
        references checks, moved to parseEntity(...)

        2004-08-06  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Checks added for colon in entities, PI and
        notations. Unbounded prefixes error changed to fatal.

        2004-08-05  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Fixed bug intruduced with the partial character
        ref, partial entity references checks.

        2004-08-05  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Fixed bug intruduced with the partial character
        ref, partial entity references checks.

        2004-08-03  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Check added for namespaces names containing only
        ':'.

        2004-07-31  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Improved check for partial character references
        and partial entity references in internal entities.

        2004-07-31  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Added check for partial character references
        in internal entities.

        2004-07-29  Musachy Barroso  <musachy at gmail.com>

        * SAXDriver.java: Added checks for invalid use of reserved
        prefixes and namespaces.

        2004-07-28  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Invalidate character range [0x7f - 0x9f] if the
        document version is 1.1. 0x85(NEL) is still valid.

        2004-07-25  Musachy Barroso  <musachy at gmail.com>

        * XmlParser.java: Fixed end-of-line handling to comply with sec 2.11.

Members: 
	ChangeLog:1.2628->1.2629 
	include/Makefile.am:1.71->1.72 
	include/Makefile.in:1.183->1.184 
	libraries/clib/libxmlj/xmlj_dom.c:1.4->1.5 
	libraries/clib/libxmlj/xmlj_dom.h:1.3->1.4 
	libraries/clib/libxmlj/xmlj_io.c:1.5->1.6 
	libraries/clib/libxmlj/xmlj_io.h:1.4->1.5 
	libraries/clib/libxmlj/xmlj_sax.c:1.4->1.5 
	libraries/clib/libxmlj/xmlj_transform.c:1.4->1.5 
	libraries/clib/libxmlj/xmlj_util.c:1.3->1.4 
	libraries/clib/libxmlj/xmlj_util.h:1.3->1.4 
	libraries/clib/libxmlj/xmlj_xpath.c:1.3->1.4 
	libraries/javalib/Makefile.am:1.221->1.222 
	libraries/javalib/Makefile.in:1.298->1.299 
	libraries/javalib/all.files:1.15->1.16 
	libraries/javalib/gnu/xml/aelfred2/SAXDriver.java:1.9->1.10 
	libraries/javalib/gnu/xml/aelfred2/XmlParser.java:1.8->1.9 
	libraries/javalib/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java:1.3->1.4 
	libraries/javalib/gnu/xml/libxmlj/dom/GnomeElement.java:1.3->1.4 
	libraries/javalib/gnu/xml/libxmlj/dom/GnomeXPathExpression.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/sax/GnomeLocator.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/sax/GnomeXMLReader.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/sax/StringArrayAttributes.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/sax/XMLName.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java:INITIAL->1.1 
	libraries/javalib/gnu/xml/libxmlj/transform/ErrorListenerProxy.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/xml/libxmlj/transform/GnomeTemplates.java:1.1->1.2(DEAD) 
	libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java:1.1->1.2 
	libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java:1.2->1.3 
	libraries/javalib/gnu/xml/libxmlj/transform/JavaContext.java:1.4->1.5(DEAD) 
	libraries/javalib/gnu/xml/libxmlj/transform/LibxsltStylesheet.java:1.4->1.5(DEAD) 
	libraries/javalib/gnu/xml/libxmlj/transform/URIResolverEntityResolver.java:INITIAL->1.1 
	libraries/javalib/gnu/xml/libxmlj/transform/URIResolverProxy.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:1.2->1.3 
	libraries/javalib/org/w3c/dom/bootstrap/DOMImplementationRegistry.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2628 kaffe/ChangeLog:1.2629
--- kaffe/ChangeLog:1.2628	Mon Aug 16 00:41:14 2004
+++ kaffe/ChangeLog	Mon Aug 16 02:43:39 2004
@@ -1,5 +1,138 @@
 2004-08-15  Dalibor Topic  <robilad at kaffe.org>
 
+        * include/Makefile.am:
+	Added new libxmlj includes, and remove no longer needed ones.
+
+        * include/Makefile.in,
+        libraries/javalib/Makefile.am,
+        libraries/javalib/Makefile.in,
+        libraries/javalib/all.files:
+	Regnerated.
+
+        * libraries/clib/libxmlj/xmlj_dom.c,
+        libraries/clib/libxmlj/xmlj_dom.h,
+        libraries/clib/libxmlj/xmlj_io.c,
+        libraries/clib/libxmlj/xmlj_io.h,
+        libraries/clib/libxmlj/xmlj_sax.c,
+        libraries/clib/libxmlj/xmlj_transform.c,
+        libraries/clib/libxmlj/xmlj_util.c,
+        libraries/clib/libxmlj/xmlj_util.h,
+        libraries/clib/libxmlj/xmlj_xpath.c,
+        libraries/javalib/gnu/xml/aelfred2/SAXDriver.java,
+        libraries/javalib/gnu/xml/aelfred2/XmlParser.java,
+        libraries/javalib/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java,
+        libraries/javalib/gnu/xml/libxmlj/dom/GnomeElement.java,
+        libraries/javalib/gnu/xml/libxmlj/dom/GnomeXPathExpression.java,
+        libraries/javalib/gnu/xml/libxmlj/sax/GnomeLocator.java,
+        libraries/javalib/gnu/xml/libxmlj/sax/GnomeXMLReader.java,
+        libraries/javalib/gnu/xml/libxmlj/sax/StringArrayAttributes.java,
+        libraries/javalib/gnu/xml/libxmlj/sax/XMLName.java,
+        libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java,
+        libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java,
+        libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java,
+        libraries/javalib/org/w3c/dom/bootstrap/DOMImplementationRegistry.java:
+	Resynced with GNU JAXP.
+
+	2004-08-10  Chris Burdess <dog at gnu.org>
+
+        * transform: Fixed imports.
+
+	2004-07-30  Chris Burdess <dog at gnu.org>
+
+        * transform: Added support for DOMSource and DOMResult transforms
+            to/from GnomeDocument nodes.
+
+	2004-07-27  Chris Burdess <dog at gnu.org>
+
+        * GnomeElement: getAttribute(NS) returns empty strings instead of
+            null.
+        * sax: Cached java.lang.String class.
+
+	2004-08-10  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Fixed bug while reading 0x2028. Check
+        for document version in external subset.
+        	
+	2004-08-10  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Convert 0x2028 to '\r' when document is 1.1
+        
+	2004-08-08  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Report start name characters that are not
+        BaseChar. (more of them)
+        	
+	2004-08-08  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Report start name characters that are not
+        BaseChar. 
+        	
+	2004-08-08  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Report NEL characters as igorable if document
+        is 1.1
+        
+	2004-08-07  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Fixed bug while reading whitespaces in elements
+        content.
+        
+	2004-08-06  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Check added for missing prefix in namespace 
+        declaration attribute.
+        
+	2004-08-06  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Partial character ref, partial entity 
+        references checks, moved to parseEntity(...)
+        
+	2004-08-06  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Checks added for colon in entities, PI and
+        notations. Unbounded prefixes error changed to fatal.
+        
+	2004-08-05  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Fixed bug intruduced with the partial character
+        ref, partial entity references checks.
+        
+	2004-08-05  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Fixed bug intruduced with the partial character
+        ref, partial entity references checks.
+        
+	2004-08-03  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Check added for namespaces names containing only
+        ':'. 
+        
+	2004-07-31  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Improved check for partial character references
+        and partial entity references in internal entities. 
+        
+	2004-07-31  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Added check for partial character references
+        in internal entities. 
+        
+	2004-07-29  Musachy Barroso  <musachy at gmail.com>
+
+        * SAXDriver.java: Added checks for invalid use of reserved 
+        prefixes and namespaces.
+
+	2004-07-28  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Invalidate character range [0x7f - 0x9f] if the 
+        document version is 1.1. 0x85(NEL) is still valid.
+         
+	2004-07-25  Musachy Barroso  <musachy at gmail.com>
+
+        * XmlParser.java: Fixed end-of-line handling to comply with sec 2.11.
+
+2004-08-15  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/security/DummyMessageDigest.java:
 	New file. Taken from GNU Classpath.
 
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.71 kaffe/include/Makefile.am:1.72
--- kaffe/include/Makefile.am:1.71	Sun Aug 15 20:02:27 2004
+++ kaffe/include/Makefile.am	Mon Aug 16 02:43:42 2004
@@ -172,17 +172,17 @@
 	gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h \
 	gnu_xml_libxmlj_dom_GnomeNode.h \
 	gnu_xml_libxmlj_dom_GnomeNodeList.h \
+	gnu_xml_libxmlj_dom_GnomeNotation.h \
 	gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h \
 	gnu_xml_libxmlj_dom_GnomeTypeInfo.h \
-	gnu_xml_libxmlj_sax_GnomeLocator.h \
-	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
 	gnu_xml_libxmlj_dom_GnomeXPathExpression.h \
 	gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
 	gnu_xml_libxmlj_dom_GnomeXPathNSResolver.h \
 	gnu_xml_libxmlj_dom_GnomeXPathResult.h \
-	gnu_xml_libxmlj_transform_LibxsltStylesheet.h \
-	gnu_xml_libxmlj_transform_GnomeTransformerFactory.h \
-	gnu_xml_libxmlj_transform_JavaContext.h
+	gnu_xml_libxmlj_sax_GnomeLocator.h \
+	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
+	gnu_xml_libxmlj_transform_GnomeTransformer.h \
+	gnu_xml_libxmlj_transform_GnomeTransformerFactory.h
 
 LIBGTKPEER_JNI_HDRS = \
 	gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.183 kaffe/include/Makefile.in:1.184
--- kaffe/include/Makefile.in:1.183	Sun Aug 15 20:02:27 2004
+++ kaffe/include/Makefile.in	Mon Aug 16 02:43:42 2004
@@ -510,17 +510,17 @@
 	gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h \
 	gnu_xml_libxmlj_dom_GnomeNode.h \
 	gnu_xml_libxmlj_dom_GnomeNodeList.h \
+	gnu_xml_libxmlj_dom_GnomeNotation.h \
 	gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h \
 	gnu_xml_libxmlj_dom_GnomeTypeInfo.h \
-	gnu_xml_libxmlj_sax_GnomeLocator.h \
-	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
 	gnu_xml_libxmlj_dom_GnomeXPathExpression.h \
 	gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
 	gnu_xml_libxmlj_dom_GnomeXPathNSResolver.h \
 	gnu_xml_libxmlj_dom_GnomeXPathResult.h \
-	gnu_xml_libxmlj_transform_LibxsltStylesheet.h \
-	gnu_xml_libxmlj_transform_GnomeTransformerFactory.h \
-	gnu_xml_libxmlj_transform_JavaContext.h
+	gnu_xml_libxmlj_sax_GnomeLocator.h \
+	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
+	gnu_xml_libxmlj_transform_GnomeTransformer.h \
+	gnu_xml_libxmlj_transform_GnomeTransformerFactory.h
 
 LIBGTKPEER_JNI_HDRS = \
 	gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h \
Index: kaffe/libraries/clib/libxmlj/xmlj_dom.c
diff -u kaffe/libraries/clib/libxmlj/xmlj_dom.c:1.4 kaffe/libraries/clib/libxmlj/xmlj_dom.c:1.5
--- kaffe/libraries/clib/libxmlj/xmlj_dom.c:1.4	Mon Jul 26 02:40:56 2004
+++ kaffe/libraries/clib/libxmlj/xmlj_dom.c	Mon Aug 16 02:43:43 2004
@@ -47,6 +47,17 @@
 }
 xmljHashScanData;
 
+/* Prototypes for local functions */
+
+void
+xmljAddAttribute (xmlNodePtr node, xmlAttrPtr attr);
+
+void
+xmljHashScanner (void *payload, void *vdata, xmlChar *name);
+
+xmlChar *
+xmljGetNodeValue (xmlNodePtr node);
+
 /*
  * Determines whether a child node is suitable for insertion in the list of
  * children for a given parent node.
@@ -834,10 +845,15 @@
 {
   xmlNodePtr node;
   const xmlChar *s_name;
+  const xmlChar *s_value;
   
   node = xmljGetNodeID (env, self);
   s_name = xmljGetStringChars (env, name);
-  return xmljNewString (env, xmlGetProp (node, s_name));
+  s_value = xmlGetProp (node, s_name);
+  xmlFree ((xmlChar *) s_name);
+  return (s_value == NULL) ?
+    xmljNewString (env, BAD_CAST "") :
+    xmljNewString (env, s_value);
 }
 
 JNIEXPORT void JNICALL
@@ -877,6 +893,7 @@
     {
       return NULL;
     }
+  xmlFree ((xmlChar *) s_name);
   return xmljGetNodeInstance (env, (xmlNodePtr) attr);
 }
 
@@ -943,8 +960,12 @@
     {
       s_uri = xmljGetStringChars (env, uri);
       s_value = xmlGetNsProp (node, s_localName, s_uri);
+      xmlFree ((xmlChar *) s_uri);
     }
-  return xmljNewString (env, s_value);
+  xmlFree ((xmlChar *) s_localName);
+  return (s_value == NULL) ?
+    xmljNewString (env, BAD_CAST "") :
+    xmljNewString (env, s_value);
 }
 
 JNIEXPORT void JNICALL
@@ -1013,6 +1034,8 @@
         }
       attr = attr->next;
     }
+  xmlFree ((xmlChar *) s_uri);
+  xmlFree ((xmlChar *) s_localName);
   return xmljGetNodeInstance (env, (xmlNodePtr) attr);
 }
 
@@ -1049,35 +1072,46 @@
 }
 
 JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_hasAttribute (JNIEnv * env,
+                                                    jobject self,
+                                                    jstring name)
+{
+  xmlNodePtr node;
+  const xmlChar *s_name;
+  const xmlChar *s_value;
+  
+  node = xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  s_value = xmlGetProp (node, s_name);
+  xmlFree ((xmlChar *) s_name);
+  return (s_value != NULL);
+}
+
+JNIEXPORT jboolean JNICALL
 Java_gnu_xml_libxmlj_dom_GnomeElement_hasAttributeNS (JNIEnv * env,
                                                       jobject self,
                                                       jstring uri,
                                                       jstring localName)
 {
   xmlNodePtr node;
-  xmlAttrPtr attr;
   const xmlChar *s_uri;
   const xmlChar *s_localName;
+  const xmlChar *s_value;
 
   node = xmljGetNodeID (env, self);
-  attr = node->properties;
-  s_uri = xmljGetStringChars (env, uri);
   s_localName = xmljGetStringChars (env, localName);
-  while (attr != NULL)
+  if (uri == NULL)
     {
-      if (uri == NULL)
-        {
-          if (xmljMatch (s_localName, (xmlNodePtr) attr))
-            break;
-        }
-      else
-        {
-          if (xmljMatchNS (s_uri, s_localName, (xmlNodePtr) attr))
-            break;
-        }
-      attr = attr->next;
+      s_value = xmlGetNoNsProp (node, s_localName);
     }
-  return (attr != NULL);
+  else
+    {
+      s_uri = xmljGetStringChars (env, uri);
+      s_value = xmlGetNsProp (node, s_localName, s_uri);
+      xmlFree ((xmlChar *) s_uri);
+    }
+  xmlFree ((xmlChar *) s_localName);
+  return (s_value != NULL);
 }
 
 /* -- GnomeEntity -- */
@@ -1146,6 +1180,7 @@
         }
       s_name = xmljGetStringChars (env, name);
       ret = (xmlNodePtr) xmlHashLookup (hash, s_name);
+      xmlFree ((xmlChar *) s_name);
       return xmljGetNodeInstance (env, ret);
     }
 }
@@ -1255,6 +1290,7 @@
         {
           xmlHashRemoveEntry (hash, s_name, NULL);
         }
+      xmlFree ((xmlChar *) s_name);
       return xmljGetNodeInstance (env, ret);
     }
 }
@@ -1302,7 +1338,7 @@
           if (attr == NULL)
             {
               char msg[1024];
-              sprintf (msg, "No attribute at index %d\n", index);
+              sprintf (msg, "No attribute at index %d\n", (int) index);
               xmljThrowException (env, "java/lang/NullPointerException", msg);
               return NULL;
             }
@@ -1384,12 +1420,12 @@
       hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
       if (hash == NULL)
         {
-          return NULL;
+          return 0;
         }
       data = (xmljHashScanData *) malloc (sizeof (xmljHashScanData));
       if (data == NULL)
         {
-          return NULL;
+          return 0;
         }
       data->index = -1;
       data->count = 0;
@@ -1917,6 +1953,7 @@
   xmlNodePtr node;
   xmlNsPtr ns;
   xmlDocPtr doc;
+  const xmlChar *s_uri;
   
   node = xmljGetNodeID (env, self);
   doc = node->doc;
@@ -1926,8 +1963,9 @@
       doc = (xmlDocPtr) node;
       node = xmlDocGetRootElement (doc);
     }
-  ns = xmlSearchNsByHref (doc, node, xmljGetStringChars (env,
-                                                         namespaceURI));
+  s_uri = xmljGetStringChars (env, namespaceURI);
+  ns = xmlSearchNsByHref (doc, node, s_uri);
+  xmlFree ((xmlChar *) s_uri);
   if (ns == NULL)
     {
       return NULL;
@@ -1942,10 +1980,12 @@
 {
   xmlNodePtr node;
   xmlNsPtr ns;
+  const xmlChar *s_uri;
   
   node = xmljGetNodeID (env, self);
-  ns = xmlSearchNsByHref (node->doc, node, xmljGetStringChars (env,
-                                                               namespaceURI));
+  s_uri = xmljGetStringChars (env, namespaceURI);
+  ns = xmlSearchNsByHref (node->doc, node, s_uri);
+  xmlFree ((xmlChar *) s_uri);
   if (ns == NULL)
     {
       return 0;
@@ -1961,6 +2001,7 @@
   xmlNodePtr node;
   xmlDocPtr doc;
   xmlNsPtr ns;
+  const xmlChar *s_prefix;
   
   node = xmljGetNodeID (env, self);
   doc = node->doc;
@@ -1970,7 +2011,9 @@
       doc = (xmlDocPtr) node;
       node = xmlDocGetRootElement (doc);
     }
-  ns = xmlSearchNs (doc, node, xmljGetStringChars (env, prefix));
+  s_prefix = xmljGetStringChars (env, prefix);
+  ns = xmlSearchNs (doc, node, s_prefix);
+  xmlFree ((xmlChar *) s_prefix);
   if (ns == NULL)
     {
       return NULL;
@@ -2263,6 +2306,7 @@
         break;
       attr = attr->next;
     }
+  xmlFree ((xmlChar *) s_name);
 
   return attr;
 }
@@ -2286,6 +2330,8 @@
         break;
       attr = attr->next;
     }
+  xmlFree ((xmlChar *) s_uri);
+  xmlFree ((xmlChar *) s_localName);
 
   return attr;
 }
Index: kaffe/libraries/clib/libxmlj/xmlj_dom.h
diff -u kaffe/libraries/clib/libxmlj/xmlj_dom.h:1.3 kaffe/libraries/clib/libxmlj/xmlj_dom.h:1.4
--- kaffe/libraries/clib/libxmlj/xmlj_dom.h:1.3	Mon Jul 26 02:40:57 2004
+++ kaffe/libraries/clib/libxmlj/xmlj_dom.h	Mon Aug 16 02:43:43 2004
@@ -36,6 +36,7 @@
 #include "gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h"
 #include "gnu_xml_libxmlj_dom_GnomeNode.h"
 #include "gnu_xml_libxmlj_dom_GnomeNodeList.h"
+#include "gnu_xml_libxmlj_dom_GnomeNotation.h"
 #include "gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h"
 #include "gnu_xml_libxmlj_dom_GnomeTypeInfo.h"
 
Index: kaffe/libraries/clib/libxmlj/xmlj_io.c
diff -u kaffe/libraries/clib/libxmlj/xmlj_io.c:1.5 kaffe/libraries/clib/libxmlj/xmlj_io.c:1.6
--- kaffe/libraries/clib/libxmlj/xmlj_io.c:1.5	Mon Jul 26 02:40:57 2004
+++ kaffe/libraries/clib/libxmlj/xmlj_io.c	Mon Aug 16 02:43:43 2004
@@ -97,6 +97,11 @@
 OutputStreamContext *xmljNewOutputStreamContext (JNIEnv * env,
                                                  jobject outputStream);
 
+void
+xmljFreeOutputStreamContext (OutputStreamContext * outContext);
+
+xmlCharEncoding
+xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer);
 
 int
 xmljOutputWriteCallback (void *context, const char *buffer, int len)
@@ -300,7 +305,7 @@
   ret->fatalError = NULL;
 
   ret->resolveURIAndOpen = NULL;
-  
+  ret->stringClass = NULL; 
   return ret;
 }
 
@@ -533,6 +538,7 @@
   free(sax);
   xmljFreeSAXParseContext (saxCtx);
   xmljFreeParserContext (ctx);
+  xmljClearStringCache ();
   return doc;
 }
 
@@ -762,6 +768,9 @@
 
 /* Once-only initialisation of the key */
 static pthread_once_t thread_context_once = PTHREAD_ONCE_INIT;
+
+static void
+thread_context_key_alloc (void);
 
 /* Allocate the key */
 static void
Index: kaffe/libraries/clib/libxmlj/xmlj_io.h
diff -u kaffe/libraries/clib/libxmlj/xmlj_io.h:1.4 kaffe/libraries/clib/libxmlj/xmlj_io.h:1.5
--- kaffe/libraries/clib/libxmlj/xmlj_io.h:1.4	Mon Jul 26 02:40:57 2004
+++ kaffe/libraries/clib/libxmlj/xmlj_io.h	Mon Aug 16 02:43:43 2004
@@ -77,7 +77,7 @@
   jmethodID fatalError;
 
   jmethodID resolveURIAndOpen; /* JavaProxy */
-  
+  jclass stringClass; 
 }
 SAXParseContext;
 
@@ -166,6 +166,6 @@
 xmljGetThreadContext (void);
 
 void
-xmljClearThreadContext ();
+xmljClearThreadContext (void);
 
 #endif /* !defined XMLJ_IO_H */
Index: kaffe/libraries/clib/libxmlj/xmlj_sax.c
diff -u kaffe/libraries/clib/libxmlj/xmlj_sax.c:1.4 kaffe/libraries/clib/libxmlj/xmlj_sax.c:1.5
--- kaffe/libraries/clib/libxmlj/xmlj_sax.c:1.4	Mon Jul 26 02:40:57 2004
+++ kaffe/libraries/clib/libxmlj/xmlj_sax.c	Mon Aug 16 02:43:43 2004
@@ -33,13 +33,22 @@
 
 xmlExternalEntityLoader defaultLoader = NULL;
 
+void
+xmljDispatchError (xmlParserCtxtPtr ctx,
+                   xmlSAXLocatorPtr loc,
+                   JNIEnv *env,
+                   jobject target,
+                   jmethodID method,
+                   const char *msg,
+                   va_list args);
+
 /* -- GnomeLocator -- */
 
 JNIEXPORT jstring JNICALL
-Java_gnu_xml_libxmlj_sax_GnomeLocator_getPublicId (JNIEnv * env,
-                                                   jobject self,
-                                                   jobject j_ctx,
-                                                   jobject j_loc)
+Java_gnu_xml_libxmlj_sax_GnomeLocator_publicId (JNIEnv * env,
+                                                jobject self,
+                                                jobject j_ctx,
+                                                jobject j_loc)
 {
   xmlParserCtxtPtr ctx;
   xmlSAXLocatorPtr loc;
@@ -53,10 +62,10 @@
 }
 
 JNIEXPORT jstring JNICALL
-Java_gnu_xml_libxmlj_sax_GnomeLocator_getSystemId (JNIEnv * env,
-                                                   jobject self,
-                                                   jobject j_ctx,
-                                                   jobject j_loc)
+Java_gnu_xml_libxmlj_sax_GnomeLocator_systemId (JNIEnv * env,
+                                                jobject self,
+                                                jobject j_ctx,
+                                                jobject j_loc)
 {
   xmlParserCtxtPtr ctx;
   xmlSAXLocatorPtr loc;
@@ -70,10 +79,10 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_gnu_xml_libxmlj_sax_GnomeLocator_getLineNumber (JNIEnv * env,
-                                                     jobject self,
-                                                     jobject j_ctx,
-                                                     jobject j_loc)
+Java_gnu_xml_libxmlj_sax_GnomeLocator_lineNumber (JNIEnv * env,
+                                                  jobject self,
+                                                  jobject j_ctx,
+                                                  jobject j_loc)
 {
   xmlParserCtxtPtr ctx;
   xmlSAXLocatorPtr loc;
@@ -88,10 +97,10 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_gnu_xml_libxmlj_sax_GnomeLocator_getColumnNumber (JNIEnv * env,
-                                                       jobject self,
-                                                       jobject j_ctx,
-                                                       jobject j_loc)
+Java_gnu_xml_libxmlj_sax_GnomeLocator_columnNumber (JNIEnv * env,
+                                                    jobject self,
+                                                    jobject j_ctx,
+                                                    jobject j_loc)
 {
   xmlParserCtxtPtr ctx;
   xmlSAXLocatorPtr loc;
@@ -271,6 +280,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->startDTD == NULL)
     {
@@ -321,6 +334,11 @@
   env = sax->env;
   target = sax->obj;
 
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+
   if (sax->resolveEntity == NULL)
     {
       sax->resolveEntity =
@@ -403,6 +421,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   j_name = xmljNewString (env, name);
   switch (type)
@@ -475,6 +497,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->notationDecl == NULL)
     {
@@ -529,6 +555,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->attributeDecl == NULL)
     {
@@ -580,6 +610,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->elementDecl == NULL)
     {
@@ -628,6 +662,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->unparsedEntityDecl == NULL)
     {
@@ -673,6 +711,10 @@
 
   /* Update locator on sax context */
   sax->loc = loc;
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->setDocumentLocator == NULL)
     {
@@ -709,6 +751,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->startDocument == NULL)
     {
@@ -744,6 +790,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->endDocument == NULL)
     {
@@ -771,7 +821,6 @@
   SAXParseContext *sax;
   JNIEnv *env;
   jobject target;
-  jclass cls;
   jstring j_name;
   jobjectArray j_attrs;
   jstring j_attr;
@@ -785,6 +834,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->startElement == NULL)
     {
@@ -802,24 +855,49 @@
   j_name = xmljNewString (env, name);
   /* build attributes array */
   len = 0;
-  for (len = 0; attrs && attrs[len] != NULL; len++)
+  for (len = 0; attrs && attrs[len]; len++)
     {
     }
-  cls = (*env)->FindClass (env, "java/lang/String");
-  j_attrs = (*env)->NewObjectArray (env, len, cls, NULL);
-  len = 0;
-  for (len = 0; attrs && attrs[len] != NULL; len++)
+  if (len)
     {
-      j_attr = xmljNewString (env, attrs[len]);
-      (*env)->SetObjectArrayElement (env, j_attrs, len, j_attr);
+      if (sax->stringClass == NULL)
+        {
+          sax->stringClass = (*env)->FindClass (env, "java/lang/String");
+          if (sax->stringClass == NULL)
+            {
+              fprintf (stderr, "Can't find java.lang.String class!\n");
+              return;
+            }
+        }
+      j_attrs = (*env)->NewObjectArray (env, len, sax->stringClass, NULL);
+      if (j_attrs == NULL)
+        {
+          fprintf (stderr, "Can't allocate attributes array!\n");
+          return;
+        }
+      len = 0;
+      for (len = 0; attrs && attrs[len]; len++)
+        {
+          j_attr = xmljNewString (env, attrs[len]);
+          (*env)->SetObjectArrayElement (env, j_attrs, len, j_attr);
+        }
+      
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->startElement,
+                              j_name,
+                              j_attrs);
+      (*env)->DeleteLocalRef (env, j_attrs);
+    }
+  else
+    {
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->startElement,
+                              j_name,
+                              NULL);
+      
     }
-
-  (*env)->CallVoidMethod (env,
-                          target,
-                          sax->startElement,
-                          j_name,
-                          j_attrs);
-  /* TODO free array? */
 }
 
 void
@@ -840,6 +918,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->endElement == NULL)
     {
@@ -888,6 +970,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->characters == NULL)
     {
@@ -931,6 +1017,10 @@
   target = sax->obj;
 
   xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
 
   if (sax->ignorableWhitespace == NULL)
     {
@@ -974,6 +1064,10 @@

*** Patch too long, truncated ***




More information about the kaffe mailing list