Speed, conformance testing, more parsing, general improvements, Daniel.
diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h
index 72348c3..b5a11f9 100644
--- a/include/libxml/encoding.h
+++ b/include/libxml/encoding.h
@@ -17,8 +17,6 @@
*
* See Copyright for the status of this software.
*
- * $Id$
- *
* Daniel.Veillard@w3.org
*/
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index 0830101..86c425f 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -3,7 +3,7 @@
*
* See Copyright for the status of this software.
*
- * $Id$
+ * Daniel.Veillard@w3.org
*/
#ifndef __XML_ENTITIES_H__
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 4cd2ead..a06d481 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -3,7 +3,7 @@
*
* See Copyright for the status of this software.
*
- * $Id$
+ * Daniel.Veillard@w3.org
*/
#ifndef __XML_PARSER_H__
@@ -46,6 +46,7 @@
typedef struct xmlParserCtxt {
struct xmlSAXHandler *sax; /* The SAX handler */
xmlDocPtr doc; /* the document being built */
+ int wellFormed; /* is the document well formed */
/* Input stream stack */
xmlParserInputPtr input; /* Current input stream */
@@ -131,15 +132,8 @@
#include "entities.h"
/*
- * Interfaces
+ * CHAR handling
*/
-extern int xmlParseDocument(xmlParserCtxtPtr ctxt);
-extern xmlDocPtr xmlParseDoc(CHAR *cur);
-extern xmlDocPtr xmlParseMemory(char *buffer, int size);
-extern xmlDocPtr xmlParseFile(const char *filename);
-extern xmlDocPtr xmlSAXParseDoc(xmlSAXHandlerPtr sax, CHAR *cur);
-extern xmlDocPtr xmlSAXParseMemory(xmlSAXHandlerPtr sax, char *buffer, int size);
-extern xmlDocPtr xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename);
extern CHAR *xmlStrdup(const CHAR *input);
extern CHAR *xmlStrndup(const CHAR *input, int n);
extern CHAR *xmlStrchr(const CHAR *str, CHAR val);
@@ -149,6 +143,29 @@
extern CHAR *xmlStrcat(CHAR *cur, const CHAR *add);
extern CHAR *xmlStrncat(CHAR *cur, const CHAR *add, int len);
+/*
+ * Interfaces
+ */
+extern xmlDocPtr xmlParseDoc(CHAR *cur);
+extern xmlDocPtr xmlParseMemory(char *buffer, int size);
+extern xmlDocPtr xmlParseFile(const char *filename);
+
+/*
+ * Recovery mode
+ */
+extern xmlDocPtr xmlRecoverDoc(CHAR *cur);
+extern xmlDocPtr xmlRecoverMemory(char *buffer, int size);
+extern xmlDocPtr xmlRecoverFile(const char *filename);
+
+/*
+ * Internal routines
+ */
+extern int xmlParseDocument(xmlParserCtxtPtr ctxt);
+extern xmlDocPtr xmlSAXParseDoc(xmlSAXHandlerPtr sax, CHAR *cur, int recovery);
+extern xmlDocPtr xmlSAXParseMemory(xmlSAXHandlerPtr sax, char *buffer,
+ int size, int recovery);
+extern xmlDocPtr xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
+ int recovery);
extern void xmlInitParserCtxt(xmlParserCtxtPtr ctx);
extern void xmlClearParserCtxt(xmlParserCtxtPtr ctx);
extern void xmlSetupParserForBuffer(xmlParserCtxtPtr ctx, const CHAR* buffer,
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 3921f7e..b6e26cf 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -4,7 +4,7 @@
*
* See Copyright for the status of this software.
*
- * $Id$
+ * Daniel.Veillard@w3.org
*/
#ifndef __XML_TREE_H__
@@ -15,6 +15,8 @@
extern "C" {
#endif
+#include <stdio.h>
+
/*
* The different element types carried by an XML tree
*
@@ -61,18 +63,51 @@
* TODO !!!!
*/
+#define XML_ATTRIBUTE_NONE 1
+#define XML_ATTRIBUTE_REQUIRED 2
+#define XML_ATTRIBUTE_IMPLIED 3
+#define XML_ATTRIBUTE_FIXED 4
+
+#define XML_ATTRIBUTE_STRING 1
+#define XML_ATTRIBUTE_ID 2
+#define XML_ATTRIBUTE_IDREF 3
+#define XML_ATTRIBUTE_IDREFS 4
+#define XML_ATTRIBUTE_ENTITY 5
+#define XML_ATTRIBUTE_ENTITIES 6
+#define XML_ATTRIBUTE_NMTOKEN 7
+#define XML_ATTRIBUTE_NMTOKENS 8
+#define XML_ATTRIBUTE_ENUMERATED 9
+
/*
* a DTD Element definition.
*/
+#define XML_ELEMENT_CONTENT_PCDATA 1
+#define XML_ELEMENT_CONTENT_ELEMENT 2
+#define XML_ELEMENT_CONTENT_SEQ 3
+#define XML_ELEMENT_CONTENT_OR 4
+
+#define XML_ELEMENT_CONTENT_ONCE 1
+#define XML_ELEMENT_CONTENT_OPT 2
+#define XML_ELEMENT_CONTENT_MULT 3
+#define XML_ELEMENT_CONTENT_PLUS 4
+
+typedef struct xmlElementContent {
+ int type; /* PCDATA, ELEMENT, SEQ or OR */
+ int ocur; /* ONCE, OPT, MULT or PLUS */
+ const CHAR *name; /* Element name */
+ struct xmlElementContent *c1; /* first child */
+ struct xmlElementContent *c2; /* second child */
+} xmlElementContent, *xmlElementContentPtr;
+
#define XML_ELEMENT_TYPE_EMPTY 1
#define XML_ELEMENT_TYPE_ANY 2
#define XML_ELEMENT_TYPE_MIXED 3
#define XML_ELEMENT_TYPE_ELEMENT 4
typedef struct xmlElement {
- const CHAR *name; /* Element name */
- int type; /* type (too simple, to extend ...) */
- /* TODO !!! more needed */
+ const CHAR *name; /* Element name */
+ int type; /* The type */
+ xmlElementContentPtr content; /* the allowed element content */
} xmlElement, *xmlElementPtr;
/*
@@ -132,6 +167,7 @@
struct xmlNode *next; /* next sibling link */
struct xmlNode *prev; /* previous sibling link */
struct xmlNode *childs; /* parent->childs link */
+ struct xmlNode *last; /* last child link */
struct xmlAttr *properties; /* properties list */
const CHAR *name; /* the name of the node, or the entity */
xmlNs *ns; /* pointer to the associated namespace */
@@ -153,9 +189,9 @@
const CHAR *encoding; /* encoding, if any */
int compression;/* level of zlib compression */
int standalone; /* standalone document (no external refs) */
- struct xmlDtd *dtd; /* the document DTD if available */
+ struct xmlDtd *intSubset; /* the document internal subset */
+ struct xmlDtd *extSubset; /* the document external subset */
struct xmlNs *oldNs; /* Global namespace, the old way */
- void *entities; /* Hash table for general entities if any */
struct xmlNode *root; /* the document tree */
} xmlDoc, *xmlDocPtr;
@@ -169,6 +205,8 @@
/*
* Creating/freeing new structures
*/
+extern xmlDtdPtr xmlCreateIntSubset(xmlDocPtr doc, const CHAR *name,
+ const CHAR *ExternalID, const CHAR *SystemID);
extern xmlDtdPtr xmlNewDtd(xmlDocPtr doc, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID);
extern void xmlFreeDtd(xmlDtdPtr cur);
@@ -240,7 +278,7 @@
*/
extern xmlAttrPtr xmlSetProp(xmlNodePtr node, const CHAR *name,
const CHAR *value);
-extern const CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name);
+extern CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name);
extern xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, const CHAR *value);
extern xmlNodePtr xmlStringLenGetNodeList(xmlDocPtr doc, const CHAR *value,
int len);
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
new file mode 100644
index 0000000..d6765ff
--- /dev/null
+++ b/include/libxml/valid.h
@@ -0,0 +1,18 @@
+/*
+ * valid.h : interface to the DTD handling and the validity checking
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+
+#ifndef __XML_VALID_H__
+#define __XML_VALID_H__
+#include "tree.h"
+
+extern xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, char *name, int type,
+ xmlElementContentPtr content);
+extern xmlElementContentPtr xmlNewElementContent(CHAR *name, int type);
+extern void xmlFreeElementContent(xmlElementContentPtr cur);
+#endif /* __XML_VALID_H__ */