Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/include
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21703/include
Modified Files:
encoding.h guides.h hash.h shred_helper.h
Log Message:
-- XML shredder now honors namespace URIs
-- New formatting option %u to print namespace URIs
(this is not yet in default SQL_FORMAT but really should be in
there soon)
-- Guide tree construction honors namespace URIs
-- General clean-up (messages, naming, refactoring)
Index: shred_helper.h
===================================================================
RCS file:
/cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/include/shred_helper.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- shred_helper.h 2 Jan 2008 14:20:47 -0000 1.16
+++ shred_helper.h 8 Jan 2008 10:00:14 -0000 1.17
@@ -54,6 +54,9 @@
#include <string.h>
#endif
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#define MAX(x,y) ((x) >= (y) ? (x) : (y))
+
#ifndef HAVE_STRDUP
/**
* Alternative definition of strdup. It just duplicates a string
Index: encoding.h
===================================================================
RCS file:
/cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/include/encoding.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- encoding.h 4 Oct 2007 10:41:37 -0000 1.3
+++ encoding.h 8 Jan 2008 10:00:08 -0000 1.4
@@ -28,12 +28,15 @@
#ifndef ENCODING_H__
#define ENCODING_H__
-#include <stdio.h>
+#include <stdio.h>
+
+/* SAX parser interface (libxml2) */
+#include "libxml/parser.h"
+
#include "shred_helper.h"
/**
- * Enumeration of the different types
- * we met in an XML-Document.
+ * XML node kinds
*/
enum kind_t {
elem = 1 /** < element node */
@@ -46,13 +49,48 @@
typedef enum kind_t kind_t;
/**
- * Print the encoded kind.
+ * Properties of a guide tree node (see guides.h)
+ */
+typedef struct guide_tree_t guide_tree_t;
+
+/**
+ * Properties of an encoded XML node
+ */
+typedef struct node_t node_t;
+
+struct node_t {
+ nat pre; /* preorder rank */
+ nat post; /* postorder rank */
+ nat pre_stretched; /* preorder in stretched plane */
+ nat post_stretched; /* postorder in stretched plane */
+ node_t *parent; /* pointer to parent */
+ nat size; /* # of nodes in subtree */
+ int level; /* length of path from node to root */
+ kind_t kind; /* XML node kind */
+ xmlChar *localname; /* localname of element/attribute */
+ int localname_id; /* unique ID of localname */
+ xmlChar *uri; /* namespace URI of element/attribute
*/
+ int uri_id; /* unique ID of namespace URI */
+ xmlChar *value; /* node content (text, value) */
+ guide_tree_t *guide; /* pointer to this node's guide entry
*/
+};
+
+
+/**
+ * Print decoded kind
*/
void print_kind (FILE *f, kind_t kind);
-/* Main shredding procedure */
-int SHshredder (const char * s, FILE * shout, FILE *attout, FILE *namesout,
- FILE * guideout, shred_state_t *status);
+/**
+ * Main shredding procedure
+ */
+void SHshredder (const char *s,
+ FILE *shout,
+ FILE *attout,
+ FILE *namesout,
+ FILE *urisout,
+ FILE *guideout,
+ shred_state_t *status);
#endif
Index: hash.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/include/hash.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- hash.h 4 Oct 2007 10:41:38 -0000 1.4
+++ hash.h 8 Jan 2008 10:00:14 -0000 1.5
@@ -48,7 +48,7 @@
/**
* Find element in hashtable.
*/
-int find_element (bucket_t **hash_table, char *key);
+int hashtable_find (bucket_t **hash_table, char *key);
/**
* Insert key and id to hashtable.
@@ -58,6 +58,6 @@
/**
* Free memory assigned to hash_table.
*/
-void free_hash(bucket_t **hash_table);
+void free_hashtable (bucket_t **hash_table);
#endif /* HASH_H__ */
Index: guides.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/include/guides.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- guides.h 5 Nov 2007 13:46:20 -0000 1.6
+++ guides.h 8 Jan 2008 10:00:08 -0000 1.7
@@ -33,12 +33,9 @@
/* SAX parser interface (libxml2) */
#include "libxml/parser.h"
-#include "libxml/parserInternals.h"
#define GUIDE_INIT 1
-typedef struct guide_tree_t guide_tree_t;
-
typedef struct child_list_t child_list_t;
struct child_list_t {
child_list_t *next_element;
@@ -46,7 +43,8 @@
};
struct guide_tree_t {
- xmlChar *tag_name;
+ xmlChar *uri;
+ xmlChar *localname;
nat count;
nat rel_count;
nat min;
@@ -59,8 +57,8 @@
};
/* insert a node in the guide tree */
-guide_tree_t* insert_guide_node(const xmlChar *tag_name, guide_tree_t
- *parent, kind_t kind);
+guide_tree_t* insert_guide_node(const xmlChar *URI, const xmlChar *tag_name,
+ guide_tree_t *parent, kind_t kind);
/* adjust the minimum and maximum values of guide nodes */
void adjust_guide_min_max (guide_tree_t *guide);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins