Commits

Anonymous committed c9a7f5f

0.94 changes
Some DOM Level 2 cleanups (when passed a NULL/blank nsURI)
getParentNode returns a XML::LibXML::Document if we get the doc node

  • Participants
  • Parent commits bf3231e

Comments (0)

Files changed (3)

 Revision history for Perl extension XML::LibXSLT.
 
+0.94
+    - Some DOM Level 2 cleanups
+    - getParentNode returns XML::LibXML::Document if we get the 
+      document node
+
+0.93
+    - Addition of DOM Level 2 APIs
+    - some more segfault fixes
+    - Document is now a Node (which makes lots of things easier)
+
 0.92
     - Many segfault and other bug fixes
     - More DOM API methods added
 	        croak("Failed to convert doc to string");
     	} else {
             RETVAL = newSVpvn((char *)result, (STRLEN)len);
-	        xmlFree(result);
-	    }
-        xmlReconciliateNs(real_dom,xmlDocGetRootElement(real_dom));
+	    xmlFree(result);
+	}
+        xmlReconciliateNs( real_dom, xmlDocGetRootElement( real_dom ) );
     OUTPUT:
         RETVAL
 
          char * CLASS = "XML::LibXML::Element";
          xmlNodePtr newNode;
          xmlChar *prefix;
-         xmlChar *lname;
-         xmlNsPtr ns;
+         xmlChar *lname = NULL;
+         xmlNsPtr ns = NULL;
      CODE:
-         lname = xmlSplitQName2(qname, &prefix);
-         ns = domNewNs (0 , prefix , nsURI);
+         if (nsURI != NULL && strlen(nsURI) != 0) {
+             lname = xmlSplitQName2(qname, &prefix);
+             ns = domNewNs (0 , prefix , nsURI);
+         }
          newNode = xmlNewNode( ns , lname );
-         newNode->doc =(xmlDocPtr)((ProxyObject*)SvIV((SV*)SvRV(dom)))->object;
+         newNode->doc = (xmlDocPtr)((ProxyObject*)SvIV((SV*)SvRV(dom)))->object;
          RETVAL = make_proxy_node(newNode);
          RETVAL->extra = dom;
          SvREFCNT_inc(dom);
         const char* CLASS = "XML::LibXML::Attr";
         xmlNodePtr newNode;
         xmlChar *prefix;
-        xmlChar *lname;
-        xmlNsPtr ns;
+        xmlChar *lname = NULL;
+        xmlNsPtr ns = NULL;
     CODE:
-        lname = xmlSplitQName2(qname, &prefix);
-        if (lname == NULL) {
-            lname = qname;
+        lname = qname;
+        if (nsURI != NULL && strlen(nsURI) != 0) {
+            lname = xmlSplitQName2(qname, &prefix);
+            if (lname == NULL) {
+                lname = qname;
+            }
+            ns = domNewNs (0 , prefix , nsURI);
         }
-        ns = domNewNs (0 , prefix , nsURI);
         newNode = (xmlNodePtr)xmlNewNsProp(NULL, ns, lname , value );
         newNode->doc = (xmlDocPtr)((ProxyObject*)SvIV((SV*)SvRV(dom)))->object;
         if ( newNode->children!=NULL ) {
                 RETVAL->extra = self->extra ;
                 SvREFCNT_inc(self->extra);                
             }
+            if ( ret == (xmlNodePtr)((xmlNodePtr)self->object)->doc) {
+                CLASS = "XML::LibXML::Document";
+            }
         }
     OUTPUT:
         RETVAL
         char * qname
         char * value
     PREINIT:
-        xmlNsPtr ns;
         xmlChar *prefix;
-        xmlChar *lname;
+        xmlChar *lname = NULL;
+        xmlNsPtr ns = NULL;
     CODE:
-        lname = xmlSplitQName2(qname, &prefix);
-        ns = domNewNs (elem , prefix , nsURI);
-        xmlSetNsProp( elem, ns, lname, value );
+        if ( nsURI != NULL && strlen(nsURI) != 0 ) {
+            lname = xmlSplitQName2(qname, &prefix);
+            ns = domNewNs (elem , prefix , nsURI);
+            xmlSetNsProp( elem, ns, lname, value );
+        }
+        else {
+            xmlSetProp( elem, qname, value );
+        }
 
 # this is a dummy!
 ProxyObject *
         char * name
     PREINIT:
         xmlChar *prefix;
-        xmlChar *lname;
-        xmlNsPtr ns;
+        xmlChar *lname = NULL;
+        xmlNsPtr ns = NULL;
     CODE:
         lname = xmlSplitQName2(name, &prefix);
         if (lname == NULL) /* as it is supposed to be */
   /* prefix is not in use */
   if (ns == NULL) {
     ns = xmlNewNs( elem , href , prefix );
+    ns->next = NULL;
   } else {
     /* prefix is in use; if it has same URI, let it go, otherwise it's
        an error */