lot of bug fixes, cleanup, starting to add proper namespace support too.
* xmlschemas.c xmlschemastypes.c include/libxml/xmlerror.h
include/libxml/schemasInternals.h: lot of bug fixes, cleanup,
starting to add proper namespace support too.
* test/schemas/* result/schemas/*: added a number of tests
fixed the result from some regression tests too.
Daniel
diff --git a/include/libxml/schemasInternals.h b/include/libxml/schemasInternals.h
index a044b67..d42b53c 100644
--- a/include/libxml/schemasInternals.h
+++ b/include/libxml/schemasInternals.h
@@ -18,6 +18,7 @@
#include <libxml/xmlregexp.h>
#include <libxml/hash.h>
+#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
@@ -100,24 +101,33 @@
#define XML_SCHEMAS_ANYATTR_LAX 2
#define XML_SCHEMAS_ANYATTR_STRICT 3
+/**
+ * XML_SCHEMAS_ATTR_NSDEFAULT:
+ *
+ * allow elements in no namespace
+ */
+#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
+
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
struct _xmlSchemaAttribute {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
- xmlChar *typeName;
- xmlChar *typeNs;
+ const xmlChar *name;
+ const xmlChar *id;
+ const xmlChar *ref;
+ const xmlChar *refNs;
+ const xmlChar *typeName;
+ const xmlChar *typeNs;
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr base;
int occurs;
- xmlChar *defValue;
+ const xmlChar *defValue;
xmlSchemaTypePtr subtypes;
xmlNodePtr node;
+ const xmlChar *targetNamespace;
+ int flags;
};
/**
@@ -131,10 +141,10 @@
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
+ const xmlChar *name;
+ const xmlChar *id;
+ const xmlChar *ref;
+ const xmlChar *refNs;
xmlSchemaAnnotPtr annot;
xmlSchemaAttributePtr attributes;
@@ -157,10 +167,10 @@
struct _xmlSchemaType {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next;/* the next type if in a sequence ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
+ const xmlChar *name;
+ const xmlChar *id;
+ const xmlChar *ref;
+ const xmlChar *refNs;
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes;
xmlSchemaAttributePtr attributes;
@@ -170,8 +180,8 @@
int flags;
xmlSchemaContentType contentType;
- xmlChar *base;
- xmlChar *baseNs;
+ const xmlChar *base;
+ const xmlChar *baseNs;
xmlSchemaTypePtr baseType;
xmlSchemaFacetPtr facets;
};
@@ -225,16 +235,22 @@
* the element is a reference to a type
*/
#define XML_SCHEMAS_ELEM_REF 1 << 6
+/**
+ * XML_SCHEMAS_ELEM_NSDEFAULT:
+ *
+ * allow elements in no namespace
+ */
+#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
typedef struct _xmlSchemaElement xmlSchemaElement;
typedef xmlSchemaElement *xmlSchemaElementPtr;
struct _xmlSchemaElement {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next;/* the next type if in a sequence ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
+ const xmlChar *name;
+ const xmlChar *id;
+ const xmlChar *ref;
+ const xmlChar *refNs;
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes;
xmlSchemaAttributePtr attributes;
@@ -243,13 +259,13 @@
int maxOccurs;
int flags;
- xmlChar *targetNamespace;
- xmlChar *namedType;
- xmlChar *namedTypeNs;
- xmlChar *substGroup;
- xmlChar *substGroupNs;
- xmlChar *scope;
- xmlChar *value;
+ const xmlChar *targetNamespace;
+ const xmlChar *namedType;
+ const xmlChar *namedTypeNs;
+ const xmlChar *substGroup;
+ const xmlChar *substGroupNs;
+ const xmlChar *scope;
+ const xmlChar *value;
struct _xmlSchemaElement *refDecl;
xmlRegexpPtr contModel;
xmlSchemaContentType contentType;
@@ -286,8 +302,8 @@
struct _xmlSchemaFacet {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
- xmlChar *value;
- xmlChar *id;
+ const xmlChar *value;
+ const xmlChar *id;
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int fixed;
@@ -303,9 +319,9 @@
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
struct _xmlSchemaNotation {
xmlSchemaTypeType type; /* The kind of type */
- xmlChar *name;
+ const xmlChar *name;
xmlSchemaAnnotPtr annot;
- xmlChar *identifier;
+ const xmlChar *identifier;
};
/**
@@ -326,10 +342,10 @@
* A Schemas definition
*/
struct _xmlSchema {
- xmlChar *name; /* schema name */
- xmlChar *targetNamespace; /* the target namespace */
- xmlChar *version;
- xmlChar *id;
+ const xmlChar *name; /* schema name */
+ const xmlChar *targetNamespace; /* the target namespace */
+ const xmlChar *version;
+ const xmlChar *id;
xmlDocPtr doc;
xmlSchemaAnnotPtr annot;
int flags;
@@ -344,6 +360,7 @@
void *_private; /* unused by the library for users or bindings */
xmlHashTablePtr groupDecl;
+ xmlDictPtr dict;
};
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
index 648ddff..96439f8 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -535,6 +535,8 @@
XML_SCHEMAP_REDEFINED_ATTR, /* 1763 */
XML_SCHEMAP_REDEFINED_NOTATION, /* 1764 */
XML_SCHEMAP_FAILED_PARSE, /* 1765 */
+ XML_SCHEMAP_UNKNOWN_PREFIX, /* 1766 */
+ XML_SCHEMAP_DEF_AND_PREFIX, /* 1767 */
XML_SCHEMAV_NOROOT = 1800,
XML_SCHEMAV_UNDECLAREDELEM, /* 1801 */
XML_SCHEMAV_NOTTOPLEVEL, /* 1802 */