[xml] (no subject)



Last year, there was some discussion (below) about generating 
SAX from DOM. I searched in the latest sources and didn't 
find any of these functions. Did this make into the offical 
build?

Wondering if there are any update on this? 

-Regards
Guths

---------------
â From: Fernand Albarracin <fernand mamouni com> 
â To: xml gnome org 
â Subject: [xml] [PATCH] inverted SAX 
â Date: Thu, 4 Apr 2002 16:39:18 +0200 

Hi,

Here is a patch for libxml2-2.4.19 that implement 
an "inverted SAX" dump
method. As you can see, it doesn't modify any single line of 
code (only
provide its own stuff, which of course are based on existing 
code). In
fact, I'm pretty sure that even if the patch doesn't get 
integrated in
libxml, people might still be able to make an external add-on 
of it.
That is, it can be used inside an application without 
rebuilding libxml
(true because libxml exports its internals). Ok, I haven't 
done it that
way because it was easier to just do everything inside the 
libxml source
tree.

Warning : it's not well tested, it's not complete. But it 
brings a nice
function ...

void            xmlSAXUserDocDump       (xmlSAXHandlerPtr sax,
                                         void *user_data,
                                         xmlDocPtr out_doc);

... and yes, it does what you expect. :)

Known issues (search for "FIXME") :

- attributes : it's strange, it seems that there is two ways 
to handle
  them

  * call the attributeSAXFunc callback for each attribute,
  (http://www.xmlsoft.org/html/libxml-
parser.html#ATTRIBUTESAXFUNC)
  unfortunately there is no attibute field in xmlSAXHandler

  * build an array composed of all attributes, give it to the
  startElementSAXFunc callback, destroy it

- namespace handling : well, I'm not sure what should be done 
here

  * can we just discard namespace information ?

  * can we consider it as an attribute (xmlns...) ?

Other issues :

  [insert your comments here]

Fernand

diff -ru libxml2-2.4.19/include/libxml/tree.h libxml2-2.4.19-
dev/include/libxml/tree.h
--- libxml2-2.4.19/include/libxml/tree.h        Thu Mar 21 
04:35:12 2002
+++ libxml2-2.4.19-dev/include/libxml/tree.h    Wed Apr  3 
12:54:24 2002
@@ -852,6 +852,42 @@
                                         const char 
*encoding);
 
 /*
+ * SAX saving.
+ */
+void           xmlSAXUserDocDump       (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlDocPtr out_doc);
+void           xmlSAXDocDump           (xmlSAXHandlerPtr sax,
+                                        xmlDocPtr out_doc);
+void           xmlSAXUserDocContentDump(xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlDocPtr cur,
+                                        const char 
*encoding);
+void           xmlSAXUserNodeDump      (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlDocPtr doc,
+                                        xmlNodePtr cur,
+                                        const char 
*encoding);
+void           xmlSAXUserNodeListDump  (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlDocPtr doc,
+                                        xmlNodePtr cur,
+                                        const char 
*encoding);
+void           xmlSAXUserDumpEntityDecl(xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlEntityPtr cur);
+void           xmlSAXUserDumpAttributeDecl(xmlSAXHandlerPtr 
sax,
+                                           void *user_data,
+                                           xmlAttributePtr 
cur);
+void           xmlSAXUserDumpElementDecl(xmlSAXHandlerPtr 
sax,
+                                         void *user_data,
+                                         xmlElementPtr cur);
+void           xmlSAXUserDtdDump       (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlDtdPtr dtd,
+                                        const char 
*encoding);
________________________________________
<Signature>
   <Name>
      <First>Sridhar</First>
      <Last>Guthula</Last>
   </Name>
   <Phone type="Mobile">5106042617</Phone>
</Signature>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]