- Lots of improvements, too long to list here
- Push mode for the XML parser (HTML to come)
- XML shell like interface for debug
- improvements on XPath and validation
Daniel
diff --git a/include/libxml/debugXML.h b/include/libxml/debugXML.h
index 9c77496..8774f0b 100644
--- a/include/libxml/debugXML.h
+++ b/include/libxml/debugXML.h
@@ -7,19 +7,97 @@
 
 #ifndef __DEBUG_XML__
 #define __DEBUG_XML__
+#include <stdio.h>
 #include "tree.h"
+#include "xpath.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern void xmlDebugDumpString(FILE *output, const xmlChar *str);
-extern void xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth);
-extern void xmlDebugDumpAttrList(FILE *output, xmlAttrPtr attr, int depth);
-extern void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth);
-extern void xmlDebugDumpNode(FILE *output, xmlNodePtr node, int depth);
-extern void xmlDebugDumpNodeList(FILE *output, xmlNodePtr node, int depth);
-extern void xmlDebugDumpDocument(FILE *output, xmlDocPtr doc);
-extern void xmlDebugDumpEntities(FILE *output, xmlDocPtr doc);
+
+/*
+ * The standard Dump routines
+ */
+void	xmlDebugDumpString	(FILE *output,
+				 const xmlChar *str);
+void	xmlDebugDumpAttr	(FILE *output,
+				 xmlAttrPtr attr,
+				 int depth);
+void	xmlDebugDumpAttrList	(FILE *output,
+				 xmlAttrPtr attr,
+				 int depth);
+void	xmlDebugDumpOneNode	(FILE *output,
+				 xmlNodePtr node,
+				 int depth);
+void	xmlDebugDumpNode	(FILE *output,
+				 xmlNodePtr node,
+				 int depth);
+void	xmlDebugDumpNodeList	(FILE *output,
+				 xmlNodePtr node,
+				 int depth);
+void	xmlDebugDumpDocumentHead(FILE *output,
+				 xmlDocPtr doc);
+void	xmlDebugDumpDocument	(FILE *output,
+				 xmlDocPtr doc);
+void	xmlDebugDumpEntities	(FILE *output,
+				 xmlDocPtr doc);
+void	xmlLsOneNode		(FILE *output,
+				 xmlNodePtr node);
+
+/****************************************************************
+ *								*
+ *	 The XML shell related structures and functions		*
+ *								*
+ ****************************************************************/
+
+/**
+ * xmlShellReadlineFunc:
+ * @prompt:  a string prompt
+ *
+ * This is a generic signature for the XML shell input function
+ *
+ * Returns a string which will be freed by the Shell
+ */
+typedef char * (* xmlShellReadlineFunc)(char *prompt);
+
+/*
+ * The shell context itself
+ * TODO: add the defined function tables.
+ */
+typedef struct xmlShellCtxt {
+    char *filename;
+    xmlDocPtr doc;
+    xmlNodePtr node;
+    xmlXPathContextPtr pctxt;
+    int loaded;
+    FILE *output;
+    xmlShellReadlineFunc input;
+} xmlShellCtxt, *xmlShellCtxtPtr;
+
+/**
+ * xmlShellCmd:
+ * @ctxt:  a shell context
+ * @arg:  a string argument
+ * @node:  a first node
+ * @node2:  a second node
+ *
+ * This is a generic signature for the XML shell functions
+ *
+ * Returns an int, negative returns indicating errors
+ */
+typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
+                             char *arg,
+			     xmlNodePtr node,
+			     xmlNodePtr node2);
+
+/*
+ * The Shell interface.
+ */
+void	xmlShell	(xmlDocPtr doc,
+			 char *filename,
+			 xmlShellReadlineFunc input,
+			 FILE *output);
+			 
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index 3af38e3..84ad7c1 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -34,6 +34,7 @@
     const xmlChar  *ExternalID;	/* External identifier for PUBLIC Entity */
     const xmlChar  *SystemID;	/* URI for a SYSTEM or PUBLIC Entity */
     xmlChar *content;		/* The entity content or ndata if unparsed */
+    int length;			/* the content length */
     xmlChar *orig;		/* The entity cont without ref substitution */
 } xmlEntity;
 typedef xmlEntity *xmlEntityPtr;
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 8a6443c..196aeb3 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -40,11 +40,12 @@
 
     const char *filename;             /* The file analyzed, if any */
     const char *directory;            /* the directory/base of teh file */
-    const xmlChar *base;                 /* Base of the array to parse */
-    const xmlChar *cur;                  /* Current char being parsed */
+    const xmlChar *base;              /* Base of the array to parse */
+    const xmlChar *cur;               /* Current char being parsed */
+    int length;                       /* length if known */
     int line;                         /* Current line */
     int col;                          /* Current column */
-    int consumed;                     /* How many xmlChars were already consumed */
+    int consumed;                     /* How many xmlChars already consumed */
     xmlParserInputDeallocate free;    /* function to deallocate the base */
 } xmlParserInput;
 typedef xmlParserInput *xmlParserInputPtr;
@@ -77,20 +78,25 @@
 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
 
 /**
- * The parser is not a state based parser, but we need to maintain
+ * The parser is not (yet) a state based parser, but we need to maintain
  * minimum state informations, especially for entities processing.
  */
 typedef enum {
-    XML_PARSER_EOF = 0,
-    XML_PARSER_PROLOG,
-    XML_PARSER_CONTENT,
-    XML_PARSER_ENTITY_DECL,
-    XML_PARSER_ENTITY_VALUE,
-    XML_PARSER_ATTRIBUTE_VALUE,
-    XML_PARSER_DTD,
-    XML_PARSER_EPILOG,
-    XML_PARSER_COMMENT,
-    XML_PARSER_CDATA_SECTION 
+    XML_PARSER_EOF = -1,	/* nothing is to be parsed */
+    XML_PARSER_START = 0,	/* nothing has been parsed */
+    XML_PARSER_MISC,		/* Misc* before int subset */
+    XML_PARSER_PI,		/* Whithin a processing instruction */
+    XML_PARSER_DTD,		/* within some DTD content */
+    XML_PARSER_PROLOG,		/* Misc* after internal subset */
+    XML_PARSER_COMMENT,		/* within a comment */
+    XML_PARSER_START_TAG,	/* within a start tag */
+    XML_PARSER_CONTENT,		/* within the content */
+    XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
+    XML_PARSER_END_TAG,		/* within a closing tag */
+    XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
+    XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
+    XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
+    XML_PARSER_EPILOG 		/* the Misc* after the last end tag */
 } xmlParserInputState;
 
 /**
@@ -151,6 +157,7 @@
     xmlChar *         *nameTab;       /* array of nodes */
 
     long               nbChars;       /* number of xmlChar processed */
+    long            checkIndex;       /* used by progressive parsing lookup */
 } _xmlParserCtxt;
 typedef _xmlParserCtxt xmlParserCtxt;
 typedef xmlParserCtxt *xmlParserCtxtPtr;
@@ -347,13 +354,35 @@
 xmlDtdPtr	xmlSAXParseDTD		(xmlSAXHandlerPtr sax,
 					 const xmlChar *ExternalID,
 					 const xmlChar *SystemID);
+/**
+ * SAX initialization routines
+ */
+void		xmlDefaultSAXHandlerInit(void);
+void		htmlDefaultSAXHandlerInit(void);
+
+/**
+ * Parser contexts handling.
+ */
 void		xmlInitParserCtxt	(xmlParserCtxtPtr ctxt);
 void		xmlClearParserCtxt	(xmlParserCtxtPtr ctxt);
+void		xmlFreeParserCtxt	(xmlParserCtxtPtr ctxt);
 void		xmlSetupParserForBuffer	(xmlParserCtxtPtr ctxt,
 					 const xmlChar* buffer,
 					 const char* filename);
-void		xmlDefaultSAXHandlerInit(void);
-void		htmlDefaultSAXHandlerInit(void);
+xmlParserCtxtPtr xmlCreateDocParserCtxt	(xmlChar *cur);
+
+/**
+ * Interfaces for the Push mode
+ */
+xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
+					 void *user_data,
+					 const char *chunk,
+					 int size,
+					 const char *filename);
+int		 xmlParseChunk		(xmlParserCtxtPtr ctxt,
+					 const char *chunk,
+					 int size,
+					 int terminate);
 
 /**
  * Node infos
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
index 9da4846..5a7b7ff 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -435,9 +435,10 @@
  * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
  */
 #define IS_CHAR(c)							\
-    ((((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) ||		\
-      (((c) >= 0x20) && ((c) != 0xFFFE) && ((c) != 0xFFFF))) &&		\
-      (((c) <= 0xD7FF) || ((c) >= 0xE000)) && ((c) <= 0x10FFFF))
+    ((((c) >= 0x20) && ((c) <= 0xD7FF)) ||				\
+     ((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) ||			\
+     (((c) >= 0xE000) && ((c) <= 0xFFFD)) ||				\
+     (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
 
 /*
  * [85] BaseChar ::= ... long list see REC ...
@@ -595,8 +596,7 @@
 xmlChar *			xmlParseAttribute	(xmlParserCtxtPtr ctxt,
 						 xmlChar **value);
 xmlChar *			xmlParseStartTag	(xmlParserCtxtPtr ctxt);
-void			xmlParseEndTag		(xmlParserCtxtPtr ctxt,
-						 xmlChar *tagname);
+void			xmlParseEndTag		(xmlParserCtxtPtr ctxt);
 void			xmlParseCDSect		(xmlParserCtxtPtr ctxt);
 void			xmlParseContent		(xmlParserCtxtPtr ctxt);
 void			xmlParseElement		(xmlParserCtxtPtr ctxt);
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 3a0285b..cce6168 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -526,6 +526,9 @@
 					 int *size);
 void		xmlDocDump		(FILE *f,
 					 xmlDocPtr cur);
+void		xmlElemDump		(FILE *f,
+					 xmlDocPtr cur,
+					 xmlNodePtr elem);
 int		xmlSaveFile		(const char *filename,
 					 xmlDocPtr cur);
 
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 2bdba5d..bf43de2 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -38,6 +38,9 @@
  */
 
 xmlParserInputBufferPtr
+	xmlAllocParserInputBuffer		(xmlCharEncoding enc);
+
+xmlParserInputBufferPtr
 	xmlParserInputBufferCreateFilename	(const char *filename,
                                                  xmlCharEncoding enc);
 xmlParserInputBufferPtr
diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h
index 5c1b477..64477a1 100644
--- a/include/libxml/xmlmemory.h
+++ b/include/libxml/xmlmemory.h
@@ -1,5 +1,5 @@
 /*
- * memory.h: interface for the memory allocation debug.
+ * xmlmemory.h: interface for the memory allocation debug.
  *
  * Daniel.Veillard@w3.org
  */
@@ -24,6 +24,7 @@
 #define xmlInitMemory()
 #define xmlMemoryDump()
 #define xmlMemDisplay(x)
+#define xmlMemShow(x, d)
 
 #else /* ! NO_DEBUG_MEMORY */
 #include <stdio.h>
@@ -51,6 +52,7 @@
 char *	xmlMemStrdup	(const char *str);
 int	xmlMemUsed	(void);
 void	xmlMemDisplay	(FILE *fp);
+void	xmlMemShow	(FILE *fp, int nr);
 void	xmlMemoryDump	(void);
 int	xmlInitMemory	(void);
 
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
index 149b0be..84c8305 100644
--- a/include/libxml/xpath.h
+++ b/include/libxml/xpath.h
@@ -205,6 +205,9 @@
 void		   xmlXPathFreeObject		(xmlXPathObjectPtr obj);
 xmlXPathObjectPtr  xmlXPathEvalExpression	(const xmlChar *str,
 						 xmlXPathContextPtr ctxt);
+xmlNodeSetPtr	   xmlXPathNodeSetCreate	(xmlNodePtr val);
+void		   xmlXPathFreeNodeSetList	(xmlXPathObjectPtr obj);
+void		   xmlXPathFreeNodeSet		(xmlNodeSetPtr obj);
 
 #ifdef __cplusplus
 }