From 17049f05f9ef09b3dc2a9c5d1de3f21de7c03193 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 13 Sep 2005 09:58:33 +0000 Subject: Load /tmp/tmp.2Zlqcz/libxml2-2.6.22 into packages/libxml2/branches/upstream/current. --- doc/devhelp/libxml2-schemasInternals.html | 841 ++++++++++++++++++++++++++++++ 1 file changed, 841 insertions(+) create mode 100644 doc/devhelp/libxml2-schemasInternals.html (limited to 'doc/devhelp/libxml2-schemasInternals.html') diff --git a/doc/devhelp/libxml2-schemasInternals.html b/doc/devhelp/libxml2-schemasInternals.html new file mode 100644 index 0000000..ba7d1c1 --- /dev/null +++ b/doc/devhelp/libxml2-schemasInternals.html @@ -0,0 +1,841 @@ + + + + + schemasInternals: internal interfaces for XML Schemas + + + + + + + + + + + + + + + + +

+ schemasInternals +

+

schemasInternals - internal interfaces for XML Schemas

+

internal interfaces for the XML Schemas handling and schema validity checking

+

Author(s): Daniel Veillard

+
+

Synopsis

+
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION;
+#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION;
+#define XML_SCHEMAS_TYPE_FIXUP_1;
+#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION;
+#define XML_SCHEMAS_ELEM_CIRCULAR;
+#define XML_SCHEMAS_QUALIF_ATTR;
+#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE;
+#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
+#define XML_SCHEMAS_ATTR_USE_REQUIRED;
+#define XML_SCHEMAS_FACET_COLLAPSE;
+#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
+#define XML_SCHEMAS_TYPE_VARIETY_UNION;
+#define XML_SCHEMAS_ANY_STRICT;
+#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
+#define XML_SCHEMAS_QUALIF_ELEM;
+#define XML_SCHEMAS_TYPE_VARIETY_LIST;
+#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE;
+#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED;
+#define XML_SCHEMAS_INCLUDING_CONVERT_NS;
+#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED;
+#define XML_SCHEMAS_ATTR_USE_PROHIBITED;
+#define XML_SCHEMAS_ELEM_NILLABLE;
+#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION;
+#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED;
+#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD;
+#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT;
+#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION;
+#define XML_SCHEMAS_TYPE_FINAL_EXTENSION;
+#define XML_SCHEMAS_ELEM_FIXED;
+#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
+#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
+#define XML_SCHEMAS_TYPE_FINAL_LIST;
+#define XML_SCHEMAS_ATTR_USE_OPTIONAL;
+#define XML_SCHEMAS_ATTR_NSDEFAULT;
+#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE;
+#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION;
+#define XML_SCHEMAS_ANYATTR_STRICT;
+#define XML_SCHEMAS_FACET_UNKNOWN;
+#define XML_SCHEMAS_ATTRGROUP_MARKED;
+#define XML_SCHEMAS_FACET_PRESERVE;
+#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION;
+#define XML_SCHEMAS_ATTR_GLOBAL;
+#define XML_SCHEMAS_ANYATTR_SKIP;
+#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
+#define XML_SCHEMAS_ANYATTR_LAX;
+#define XML_SCHEMAS_TYPE_GLOBAL;
+#define XML_SCHEMAS_TYPE_ABSTRACT;
+#define XML_SCHEMAS_ATTR_FIXED;
+#define XML_SCHEMAS_ANY_SKIP;
+#define XML_SCHEMAS_FINAL_DEFAULT_LIST;
+#define XML_SCHEMAS_TYPE_VARIETY_ABSENT;
+#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION;
+#define XML_SCHEMAS_WILDCARD_COMPLETE;
+#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED;
+#define XML_SCHEMAS_ELEM_NSDEFAULT;
+#define XML_SCHEMAS_ELEM_GLOBAL;
+#define XML_SCHEMAS_TYPE_MIXED;
+#define XML_SCHEMAS_ANY_LAX;
+#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION;
+#define XML_SCHEMAS_TYPE_HAS_FACETS;
+#define XML_SCHEMAS_ELEM_FINAL_EXTENSION;
+#define XML_SCHEMAS_TYPE_NORMVALUENEEDED;
+#define XML_SCHEMAS_ELEM_FINAL_ABSENT;
+#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
+#define XML_SCHEMAS_TYPE_INTERNAL_INVALID;
+#define XML_SCHEMAS_ELEM_TOPLEVEL;
+#define XML_SCHEMAS_ELEM_ABSTRACT;
+#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION;
+#define XML_SCHEMAS_TYPE_FINAL_UNION;
+#define XML_SCHEMAS_TYPE_FINAL_DEFAULT;
+#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
+#define XML_SCHEMAS_FINAL_DEFAULT_UNION;
+#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION;
+#define XML_SCHEMAS_FACET_REPLACE;
+#define XML_SCHEMAS_ELEM_DEFAULT;
+#define XML_SCHEMAS_TYPE_MARKED;
+#define XML_SCHEMAS_ELEM_BLOCK_ABSENT;
+#define XML_SCHEMAS_ATTRGROUP_GLOBAL;
+#define XML_SCHEMAS_ELEM_REF;
+typedef xmlSchemaAttributeGroup * xmlSchemaAttributeGroupPtr;
+typedef xmlSchemaElement * xmlSchemaElementPtr;
+typedef xmlSchemaFacetLink * xmlSchemaFacetLinkPtr;
+typedef struct _xmlSchemaVal xmlSchemaVal;
+typedef xmlSchemaAttributeLink * xmlSchemaAttributeLinkPtr;
+typedef struct _xmlSchemaType xmlSchemaType;
+typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
+typedef xmlSchemaAnnot * xmlSchemaAnnotPtr;
+typedef struct _xmlSchemaElement xmlSchemaElement;
+typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
+typedef xmlSchemaWildcard * xmlSchemaWildcardPtr;
+typedef xmlSchemaFacet * xmlSchemaFacetPtr;
+typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
+typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
+typedef xmlSchemaVal * xmlSchemaValPtr;
+typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
+typedef xmlSchemaWildcardNs * xmlSchemaWildcardNsPtr;
+typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
+typedef xmlSchemaTypeLink * xmlSchemaTypeLinkPtr;
+typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
+typedef xmlSchemaAttribute * xmlSchemaAttributePtr;
+typedef xmlSchemaNotation * xmlSchemaNotationPtr;
+typedef enum xmlSchemaValType;
+typedef xmlSchemaType * xmlSchemaTypePtr;
+typedef struct _xmlSchemaNotation xmlSchemaNotation;
+typedef struct _xmlSchemaFacet xmlSchemaFacet;
+typedef enum xmlSchemaContentType;
+typedef enum xmlSchemaTypeType;
+typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
+void	xmlSchemaFreeType		(xmlSchemaTypePtr type);
+void	xmlSchemaFreeWildcard		(xmlSchemaWildcardPtr wildcard);
+
+
+
+

Description

+
+
+

Details

+
+

Macro XML_SCHEMAS_ANYATTR_LAX

#define XML_SCHEMAS_ANYATTR_LAX;
+

Ignore validation non definition on attributes Obsolete, not used anymore.

+
+
+

Macro XML_SCHEMAS_ANYATTR_SKIP

#define XML_SCHEMAS_ANYATTR_SKIP;
+

Skip unknown attribute from validation Obsolete, not used anymore.

+
+
+

Macro XML_SCHEMAS_ANYATTR_STRICT

#define XML_SCHEMAS_ANYATTR_STRICT;
+

Apply strict validation rules on attributes Obsolete, not used anymore.

+
+
+

Macro XML_SCHEMAS_ANY_LAX

#define XML_SCHEMAS_ANY_LAX;
+

Used by wildcards. Validate if type found, don't worry if not found

+
+
+

Macro XML_SCHEMAS_ANY_SKIP

#define XML_SCHEMAS_ANY_SKIP;
+

Skip unknown attribute from validation

+
+
+

Macro XML_SCHEMAS_ANY_STRICT

#define XML_SCHEMAS_ANY_STRICT;
+

Used by wildcards. Apply strict validation rules

+
+
+

Macro XML_SCHEMAS_ATTRGROUP_GLOBAL

#define XML_SCHEMAS_ATTRGROUP_GLOBAL;
+

The attribute wildcard has been already builded.

+
+
+

Macro XML_SCHEMAS_ATTRGROUP_MARKED

#define XML_SCHEMAS_ATTRGROUP_MARKED;
+

Marks the attr group as marked; used for circular checks.

+
+
+

Macro XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED

#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED;
+

The attribute wildcard has been already builded.

+
+
+

Macro XML_SCHEMAS_ATTR_FIXED

#define XML_SCHEMAS_ATTR_FIXED;
+

the attribute has a fixed value

+
+
+

Macro XML_SCHEMAS_ATTR_GLOBAL

#define XML_SCHEMAS_ATTR_GLOBAL;
+

allow elements in no namespace

+
+
+

Macro XML_SCHEMAS_ATTR_INTERNAL_RESOLVED

#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED;
+

this is set when the "type" and "ref" references have been resolved.

+
+
+

Macro XML_SCHEMAS_ATTR_NSDEFAULT

#define XML_SCHEMAS_ATTR_NSDEFAULT;
+

allow elements in no namespace

+
+
+

Macro XML_SCHEMAS_ATTR_USE_OPTIONAL

#define XML_SCHEMAS_ATTR_USE_OPTIONAL;
+

The attribute is optional.

+
+
+

Macro XML_SCHEMAS_ATTR_USE_PROHIBITED

#define XML_SCHEMAS_ATTR_USE_PROHIBITED;
+

Used by wildcards. The attribute is prohibited.

+
+
+

Macro XML_SCHEMAS_ATTR_USE_REQUIRED

#define XML_SCHEMAS_ATTR_USE_REQUIRED;
+

The attribute is required.

+
+
+

Macro XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION

#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION;
+

the schema has "extension" in the set of blockDefault.

+
+
+

Macro XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION

#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION;
+

the schema has "restriction" in the set of blockDefault.

+
+
+

Macro XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION

#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION;
+

the schema has "substitution" in the set of blockDefault.

+
+
+

Macro XML_SCHEMAS_ELEM_ABSTRACT

#define XML_SCHEMAS_ELEM_ABSTRACT;
+

the element is abstract

+
+
+

Macro XML_SCHEMAS_ELEM_BLOCK_ABSENT

#define XML_SCHEMAS_ELEM_BLOCK_ABSENT;
+

the "block" attribute is absent

+
+
+

Macro XML_SCHEMAS_ELEM_BLOCK_EXTENSION

#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION;
+

disallowed substitutions are absent

+
+
+

Macro XML_SCHEMAS_ELEM_BLOCK_RESTRICTION

#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION;
+

disallowed substitutions: "restriction"

+
+
+

Macro XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION

#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION;
+

disallowed substitutions: "substituion"

+
+
+

Macro XML_SCHEMAS_ELEM_CIRCULAR

#define XML_SCHEMAS_ELEM_CIRCULAR;
+

a helper flag for the search of circular references.

+
+
+

Macro XML_SCHEMAS_ELEM_DEFAULT

#define XML_SCHEMAS_ELEM_DEFAULT;
+

the element has a default value

+
+
+

Macro XML_SCHEMAS_ELEM_FINAL_ABSENT

#define XML_SCHEMAS_ELEM_FINAL_ABSENT;
+

substitution group exclusions are absent

+
+
+

Macro XML_SCHEMAS_ELEM_FINAL_EXTENSION

#define XML_SCHEMAS_ELEM_FINAL_EXTENSION;
+

substitution group exclusions: "extension"

+
+
+

Macro XML_SCHEMAS_ELEM_FINAL_RESTRICTION

#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION;
+

substitution group exclusions: "restriction"

+
+
+

Macro XML_SCHEMAS_ELEM_FIXED

#define XML_SCHEMAS_ELEM_FIXED;
+

the element has a fixed value

+
+
+

Macro XML_SCHEMAS_ELEM_GLOBAL

#define XML_SCHEMAS_ELEM_GLOBAL;
+

the element is global

+
+
+

Macro XML_SCHEMAS_ELEM_INTERNAL_CHECKED

#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED;
+

this is set when the elem decl has been checked against all constraints

+
+
+

Macro XML_SCHEMAS_ELEM_INTERNAL_RESOLVED

#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED;
+

this is set when "type", "ref", "substitutionGroup" references have been resolved.

+
+
+

Macro XML_SCHEMAS_ELEM_NILLABLE

#define XML_SCHEMAS_ELEM_NILLABLE;
+

the element is nillable

+
+
+

Macro XML_SCHEMAS_ELEM_NSDEFAULT

#define XML_SCHEMAS_ELEM_NSDEFAULT;
+

allow elements in no namespace Obsolete, not used anymore.

+
+
+

Macro XML_SCHEMAS_ELEM_REF

#define XML_SCHEMAS_ELEM_REF;
+

the element is a reference to a type

+
+
+

Macro XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD

#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD;
+

the declaration is a substitution group head

+
+
+

Macro XML_SCHEMAS_ELEM_TOPLEVEL

#define XML_SCHEMAS_ELEM_TOPLEVEL;
+

the element is top level obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead

+
+
+

Macro XML_SCHEMAS_FACET_COLLAPSE

#define XML_SCHEMAS_FACET_COLLAPSE;
+

collapse the types of the facet

+
+
+

Macro XML_SCHEMAS_FACET_PRESERVE

#define XML_SCHEMAS_FACET_PRESERVE;
+

preserve the type of the facet

+
+
+

Macro XML_SCHEMAS_FACET_REPLACE

#define XML_SCHEMAS_FACET_REPLACE;
+

replace the type of the facet

+
+
+

Macro XML_SCHEMAS_FACET_UNKNOWN

#define XML_SCHEMAS_FACET_UNKNOWN;
+

unknown facet handling

+
+
+

Macro XML_SCHEMAS_FINAL_DEFAULT_EXTENSION

#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION;
+

the schema has "extension" in the set of finalDefault.

+
+
+

Macro XML_SCHEMAS_FINAL_DEFAULT_LIST

#define XML_SCHEMAS_FINAL_DEFAULT_LIST;
+

the cshema has "list" in the set of finalDefault.

+
+
+

Macro XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION

#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION;
+

the schema has "restriction" in the set of finalDefault.

+
+
+

Macro XML_SCHEMAS_FINAL_DEFAULT_UNION

#define XML_SCHEMAS_FINAL_DEFAULT_UNION;
+

the schema has "union" in the set of finalDefault.

+
+
+

Macro XML_SCHEMAS_INCLUDING_CONVERT_NS

#define XML_SCHEMAS_INCLUDING_CONVERT_NS;
+

the schema is currently including an other schema with no target namespace.

+
+
+

Macro XML_SCHEMAS_QUALIF_ATTR

#define XML_SCHEMAS_QUALIF_ATTR;
+

Reflects attributeFormDefault == qualified in an XML schema document.

+
+
+

Macro XML_SCHEMAS_QUALIF_ELEM

#define XML_SCHEMAS_QUALIF_ELEM;
+

Reflects elementFormDefault == qualified in an XML schema document.

+
+
+

Macro XML_SCHEMAS_TYPE_ABSTRACT

#define XML_SCHEMAS_TYPE_ABSTRACT;
+

the simple/complexType is abstract.

+
+
+

Macro XML_SCHEMAS_TYPE_BLOCK_DEFAULT

#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT;
+

the complexType did not specify 'block' so use the default of the <schema> item.

+
+
+

Macro XML_SCHEMAS_TYPE_BLOCK_EXTENSION

#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
+

the complexType has a 'block' of "extension".

+
+
+

Macro XML_SCHEMAS_TYPE_BLOCK_RESTRICTION

#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION;
+

the complexType has a 'block' of "restriction".

+
+
+

Macro XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE

#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE;
+

Marks the item as a builtin primitive.

+
+
+

Macro XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION

#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
+

the simple or complex type has a derivation method of "extension".

+
+
+

Macro XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION

#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
+

the simple or complex type has a derivation method of "restriction".

+
+
+

Macro XML_SCHEMAS_TYPE_FACETSNEEDVALUE

#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
+

indicates if the facets need a computed value

+
+
+

Macro XML_SCHEMAS_TYPE_FINAL_DEFAULT

#define XML_SCHEMAS_TYPE_FINAL_DEFAULT;
+

the simpleType has a final of "default".

+
+
+

Macro XML_SCHEMAS_TYPE_FINAL_EXTENSION

#define XML_SCHEMAS_TYPE_FINAL_EXTENSION;
+

the complexType has a final of "extension".

+
+
+

Macro XML_SCHEMAS_TYPE_FINAL_LIST

#define XML_SCHEMAS_TYPE_FINAL_LIST;
+

the simpleType has a final of "list".

+
+
+

Macro XML_SCHEMAS_TYPE_FINAL_RESTRICTION

#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION;
+

the simpleType/complexType has a final of "restriction".

+
+
+

Macro XML_SCHEMAS_TYPE_FINAL_UNION

#define XML_SCHEMAS_TYPE_FINAL_UNION;
+

the simpleType has a final of "union".

+
+
+

Macro XML_SCHEMAS_TYPE_FIXUP_1

#define XML_SCHEMAS_TYPE_FIXUP_1;
+

First stage of fixup was done.

+
+
+

Macro XML_SCHEMAS_TYPE_GLOBAL

#define XML_SCHEMAS_TYPE_GLOBAL;
+

the type is global

+
+
+

Macro XML_SCHEMAS_TYPE_HAS_FACETS

#define XML_SCHEMAS_TYPE_HAS_FACETS;
+

has facets

+
+
+

Macro XML_SCHEMAS_TYPE_INTERNAL_INVALID

#define XML_SCHEMAS_TYPE_INTERNAL_INVALID;
+

indicates that the type is invalid

+
+
+

Macro XML_SCHEMAS_TYPE_INTERNAL_RESOLVED

#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
+

indicates that the type was typefixed

+
+
+

Macro XML_SCHEMAS_TYPE_MARKED

#define XML_SCHEMAS_TYPE_MARKED;
+

Marks the item as marked; used for circular checks.

+
+
+

Macro XML_SCHEMAS_TYPE_MIXED

#define XML_SCHEMAS_TYPE_MIXED;
+

the element content type is mixed

+
+
+

Macro XML_SCHEMAS_TYPE_NORMVALUENEEDED

#define XML_SCHEMAS_TYPE_NORMVALUENEEDED;
+

indicates if the facets (pattern) need a normalized value

+
+
+

Macro XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD

#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
+

the complexType owns an attribute wildcard, i.e. it can be freed by the complexType

+
+
+

Macro XML_SCHEMAS_TYPE_VARIETY_ABSENT

#define XML_SCHEMAS_TYPE_VARIETY_ABSENT;
+

the simpleType has a variety of "absent".

+
+
+

Macro XML_SCHEMAS_TYPE_VARIETY_ATOMIC

#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
+

the simpleType has a variety of "union".

+
+
+

Macro XML_SCHEMAS_TYPE_VARIETY_LIST

#define XML_SCHEMAS_TYPE_VARIETY_LIST;
+

the simpleType has a variety of "list".

+
+
+

Macro XML_SCHEMAS_TYPE_VARIETY_UNION

#define XML_SCHEMAS_TYPE_VARIETY_UNION;
+

the simpleType has a variety of "union".

+
+
+

Macro XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE

#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
+

a whitespace-facet value of "collapse"

+
+
+

Macro XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE

#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE;
+

a whitespace-facet value of "preserve"

+
+
+

Macro XML_SCHEMAS_TYPE_WHITESPACE_REPLACE

#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE;
+

a whitespace-facet value of "replace"

+
+
+

Macro XML_SCHEMAS_WILDCARD_COMPLETE

#define XML_SCHEMAS_WILDCARD_COMPLETE;
+

If the wildcard is complete.

+
+
+

Structure xmlSchemaAnnot

struct _xmlSchemaAnnot {
+    struct _xmlSchemaAnnot *	next
+    xmlNodePtr	content	: the annotation
+} xmlSchemaAnnot;
+

+

+
+

Typedef xmlSchemaAnnotPtr

xmlSchemaAnnot * xmlSchemaAnnotPtr;
+

+

+
+

Structure xmlSchemaAttribute

struct _xmlSchemaAttribute {
+    xmlSchemaTypeType	type	: The kind of type
+    struct _xmlSchemaAttribute *	next	: the next attribute if in a group ...
+    const xmlChar *	name	: name of the declaration or empty if particle
+    const xmlChar *	id
+    const xmlChar *	ref	: the local name of the attribute decl. if a particle
+    const xmlChar *	refNs	: the ns URI of the attribute decl. if a particle
+    const xmlChar *	typeName	: the local name of the type definition
+    const xmlChar *	typeNs	: the ns URI of the type definition
+    xmlSchemaAnnotPtr	annot
+    xmlSchemaTypePtr	base	: obsolete, not used
+    int	occurs
+    const xmlChar *	defValue
+    xmlSchemaTypePtr	subtypes	: the type definition
+    xmlNodePtr	node
+    const xmlChar *	targetNamespace
+    int	flags
+    const xmlChar *	refPrefix
+    xmlSchemaValPtr	defVal
+    xmlSchemaAttributePtr	refDecl
+} xmlSchemaAttribute;
+

+

+
+

Structure xmlSchemaAttributeGroup

struct _xmlSchemaAttributeGroup {
+    xmlSchemaTypeType	type	: The kind of type
+    struct _xmlSchemaAttribute *	next	: the next attribute if in a group ...
+    const xmlChar *	name
+    const xmlChar *	id
+    const xmlChar *	ref
+    const xmlChar *	refNs
+    xmlSchemaAnnotPtr	annot
+    xmlSchemaAttributePtr	attributes
+    xmlNodePtr	node
+    int	flags
+    xmlSchemaWildcardPtr	attributeWildcard
+    const xmlChar *	refPrefix
+    xmlSchemaAttributeGroupPtr	refItem	: The referenced attribute group
+    const xmlChar *	targetNamespace	: xmlSchemaAttributeGroupPtr redef Redefinitions
+} xmlSchemaAttributeGroup;
+

+

+
+

Typedef xmlSchemaAttributeGroupPtr

xmlSchemaAttributeGroup * xmlSchemaAttributeGroupPtr;
+

+

+
+

Structure xmlSchemaAttributeLink

struct _xmlSchemaAttributeLink {
+    struct _xmlSchemaAttributeLink *	next	: the next attribute link ...
+    struct _xmlSchemaAttribute *	attr	: the linked attribute
+} xmlSchemaAttributeLink;
+

+

+
+

Typedef xmlSchemaAttributeLinkPtr

xmlSchemaAttributeLink * xmlSchemaAttributeLinkPtr;
+

+

+
+

Typedef xmlSchemaAttributePtr

xmlSchemaAttribute * xmlSchemaAttributePtr;
+

+

+
+ +
+

Structure xmlSchemaElement

struct _xmlSchemaElement {
+    xmlSchemaTypeType	type	: The kind of type
+    struct _xmlSchemaType *	next	: the next type if in a sequence ...
+    const xmlChar *	name
+    const xmlChar *	id
+    const xmlChar *	ref	: the local name of the element declaration if a particle
+    const xmlChar *	refNs	: the ns URI of the element declaration if a particle
+    xmlSchemaAnnotPtr	annot
+    xmlSchemaTypePtr	subtypes	: the type definition
+    xmlSchemaAttributePtr	attributes
+    xmlNodePtr	node
+    int	minOccurs
+    int	maxOccurs
+    int	flags
+    const xmlChar *	targetNamespace
+    const xmlChar *	namedType
+    const xmlChar *	namedTypeNs
+    const xmlChar *	substGroup
+    const xmlChar *	substGroupNs
+    const xmlChar *	scope
+    const xmlChar *	value
+    struct _xmlSchemaElement *	refDecl	: This will now be used for the substitution group affiliation
+    xmlRegexpPtr	contModel
+    xmlSchemaContentType	contentType
+    const xmlChar *	refPrefix
+    xmlSchemaValPtr	defVal
+    void *	idcs
+} xmlSchemaElement;
+

+

+
+

Typedef xmlSchemaElementPtr

xmlSchemaElement * xmlSchemaElementPtr;
+

+

+
+

Structure xmlSchemaFacet

struct _xmlSchemaFacet {
+    xmlSchemaTypeType	type	: The kind of type
+    struct _xmlSchemaFacet *	next	: the next type if in a sequence ...
+    const xmlChar *	value
+    const xmlChar *	id
+    xmlSchemaAnnotPtr	annot
+    xmlNodePtr	node
+    int	fixed
+    int	whitespace
+    xmlSchemaValPtr	val
+    xmlRegexpPtr	regexp
+} xmlSchemaFacet;
+

+

+
+

Structure xmlSchemaFacetLink

struct _xmlSchemaFacetLink {
+    struct _xmlSchemaFacetLink *	next	: the next facet link ...
+    xmlSchemaFacetPtr	facet	: the linked facet
+} xmlSchemaFacetLink;
+

+

+
+

Typedef xmlSchemaFacetLinkPtr

xmlSchemaFacetLink * xmlSchemaFacetLinkPtr;
+

+

+
+

Typedef xmlSchemaFacetPtr

xmlSchemaFacet * xmlSchemaFacetPtr;
+

+

+
+

Structure xmlSchemaNotation

struct _xmlSchemaNotation {
+    xmlSchemaTypeType	type	: The kind of type
+    const xmlChar *	name
+    xmlSchemaAnnotPtr	annot
+    const xmlChar *	identifier
+    const xmlChar *	targetNamespace
+} xmlSchemaNotation;
+

+

+
+

Typedef xmlSchemaNotationPtr

xmlSchemaNotation * xmlSchemaNotationPtr;
+

+

+
+

Structure xmlSchemaType

struct _xmlSchemaType {
+    xmlSchemaTypeType	type	: The kind of type
+    struct _xmlSchemaType *	next	: the next type if in a sequence ...
+    const xmlChar *	name
+    const xmlChar *	id
+    const xmlChar *	ref
+    const xmlChar *	refNs
+    xmlSchemaAnnotPtr	annot
+    xmlSchemaTypePtr	subtypes
+    xmlSchemaAttributePtr	attributes
+    xmlNodePtr	node
+    int	minOccurs
+    int	maxOccurs
+    int	flags
+    xmlSchemaContentType	contentType
+    const xmlChar *	base
+    const xmlChar *	baseNs
+    xmlSchemaTypePtr	baseType
+    xmlSchemaFacetPtr	facets
+    struct _xmlSchemaType *	redef	: possible redefinitions for the type
+    int	recurse
+    xmlSchemaAttributeLinkPtr	attributeUses
+    xmlSchemaWildcardPtr	attributeWildcard
+    int	builtInType
+    xmlSchemaTypeLinkPtr	memberTypes
+    xmlSchemaFacetLinkPtr	facetSet
+    const xmlChar *	refPrefix
+    xmlSchemaTypePtr	contentTypeDef
+    xmlRegexpPtr	contModel
+    const xmlChar *	targetNamespace
+} xmlSchemaType;
+

+

+
+

Structure xmlSchemaTypeLink

struct _xmlSchemaTypeLink {
+    struct _xmlSchemaTypeLink *	next	: the next type link ...
+    xmlSchemaTypePtr	type	: the linked typ
+} xmlSchemaTypeLink;
+

+

+
+

Typedef xmlSchemaTypeLinkPtr

xmlSchemaTypeLink * xmlSchemaTypeLinkPtr;
+

+

+
+

Typedef xmlSchemaTypePtr

xmlSchemaType * xmlSchemaTypePtr;
+

+

+
+ +
+

Structure xmlSchemaVal

struct _xmlSchemaVal {
+The content of this structure is not made public by the API.
+} xmlSchemaVal;
+

+

+
+

Typedef xmlSchemaValPtr

xmlSchemaVal * xmlSchemaValPtr;
+

+

+
+ +
+

Structure xmlSchemaWildcard

struct _xmlSchemaWildcard {
+    xmlSchemaTypeType	type	: The kind of type
+    const xmlChar *	id
+    xmlSchemaAnnotPtr	annot
+    xmlNodePtr	node
+    int	minOccurs
+    int	maxOccurs
+    int	processContents
+    int	any	: Indicates if the ns constraint is of ##any
+    xmlSchemaWildcardNsPtr	nsSet	: The list of allowed namespaces
+    xmlSchemaWildcardNsPtr	negNsSet	: The negated namespace
+    int	flags
+} xmlSchemaWildcard;
+

+

+
+

Structure xmlSchemaWildcardNs

struct _xmlSchemaWildcardNs {
+    struct _xmlSchemaWildcardNs *	next	: the next constraint link ...
+    const xmlChar *	value	: the value
+} xmlSchemaWildcardNs;
+

+

+
+

Typedef xmlSchemaWildcardNsPtr

xmlSchemaWildcardNs * xmlSchemaWildcardNsPtr;
+

+

+
+

Typedef xmlSchemaWildcardPtr

xmlSchemaWildcard * xmlSchemaWildcardPtr;
+

+

+
+

xmlSchemaFreeType ()

void	xmlSchemaFreeType		(xmlSchemaTypePtr type)
+

Deallocate a Schema Type structure.

+
type:a schema type structure
+
+

xmlSchemaFreeWildcard ()

void	xmlSchemaFreeWildcard		(xmlSchemaWildcardPtr wildcard)
+

Deallocates a wildcard structure.

+
wildcard:a wildcard structure
+
+
+
+ + -- cgit v1.2.3 From 0fd83af441e251fc23fc1af7959fd6ecfa105fe1 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 6 Jan 2006 18:28:17 +0100 Subject: Load /tmp/tmp.U9vXwU/libxml2-2.6.23 into local/libxml2/branches/upstream/current. --- ChangeLog | 540 ++ HTMLparser.c | 11 +- HTMLtree.c | 22 +- Makefile.am | 2 +- Makefile.in | 2 +- NEWS | 332 +- SAX2.c | 4 + c14n.c | 2 +- config.h.in | 18 +- configure | 615 +- configure.in | 65 +- doc/APIchunk0.html | 8 +- doc/APIchunk1.html | 1 + doc/APIchunk10.html | 19 +- doc/APIchunk11.html | 10 +- doc/APIchunk12.html | 28 +- doc/APIchunk13.html | 14 +- doc/APIchunk14.html | 42 +- doc/APIchunk15.html | 17 +- doc/APIchunk16.html | 7 +- doc/APIchunk17.html | 12 +- doc/APIchunk18.html | 5 +- doc/APIchunk19.html | 7 +- doc/APIchunk2.html | 10 +- doc/APIchunk20.html | 10 +- doc/APIchunk21.html | 20 +- doc/APIchunk22.html | 47 +- doc/APIchunk23.html | 22 +- doc/APIchunk24.html | 28 +- doc/APIchunk25.html | 7 +- doc/APIchunk26.html | 5 +- doc/APIchunk27.html | 3 - doc/APIchunk28.html | 13 +- doc/APIchunk29.html | 1 + doc/APIchunk3.html | 1 + doc/APIchunk4.html | 4 + doc/APIchunk5.html | 9 +- doc/APIchunk6.html | 7 +- doc/APIchunk7.html | 5 +- doc/APIchunk8.html | 9 +- doc/APIchunk9.html | 10 +- doc/APIconstructors.html | 4 +- doc/APIfiles.html | 17 + doc/APIfunctions.html | 14 + doc/APIsymbols.html | 17 + doc/FAQ.html | 63 +- doc/Makefile.am | 1 - doc/Makefile.in | 1 - doc/XMLinfo.html | 2 +- doc/XSLT.html | 2 +- doc/bugs.html | 2 +- doc/catalog.html | 2 +- doc/contribs.html | 8 +- doc/devhelp/libxml2-HTMLtree.html | 9 +- doc/devhelp/libxml2-pattern.html | 14 +- doc/devhelp/libxml2-relaxng.html | 2 +- doc/devhelp/libxml2-schemasInternals.html | 145 +- doc/devhelp/libxml2-tree.html | 2 +- doc/devhelp/libxml2-valid.html | 6 +- doc/devhelp/libxml2-xmlIO.html | 7 +- doc/devhelp/libxml2-xmlerror.html | 5 + doc/devhelp/libxml2-xmlreader.html | 9 +- doc/devhelp/libxml2-xmlregexp.html | 12 +- doc/devhelp/libxml2-xmlsave.html | 5 + doc/devhelp/libxml2-xmlschemas.html | 73 +- doc/devhelp/libxml2-xmlstring.html | 8 +- doc/devhelp/libxml2.devhelp | 17 + doc/downloads.html | 9 +- doc/encoding.html | 16 +- doc/examples/Makefile.am | 104 +- doc/examples/Makefile.in | 102 +- doc/examples/examples.xml | 418 +- doc/help.html | 2 +- doc/html/libxml-HTMLtree.html | 5 +- doc/html/libxml-pattern.html | 12 +- doc/html/libxml-relaxng.html | 2 +- doc/html/libxml-schemasInternals.html | 127 +- doc/html/libxml-tree.html | 2 +- doc/html/libxml-valid.html | 6 +- doc/html/libxml-xmlIO.html | 5 +- doc/html/libxml-xmlerror.html | 5 + doc/html/libxml-xmlreader.html | 7 +- doc/html/libxml-xmlregexp.html | 10 +- doc/html/libxml-xmlsave.html | 5 +- doc/html/libxml-xmlschemas.html | 69 +- doc/html/libxml-xmlstring.html | 8 +- doc/index.html | 6 +- doc/intro.html | 2 +- doc/libxml2-api.xml | 384 +- doc/libxml2.xsa | 52 +- doc/namespaces.html | 2 +- doc/news.html | 332 +- doc/python.html | 15 +- doc/site.xsl | 2 +- doc/xml.html | 492 +- doc/xmldtd.html | 2 +- doc/xmlreader.html | 4 +- elfgcchack.h | 64 +- error.c | 19 +- gentest.py | 1 + include/libxml/HTMLtree.h | 5 + include/libxml/pattern.h | 7 + include/libxml/schemasInternals.h | 177 +- include/libxml/valid.h | 2 +- include/libxml/xmlIO.h | 4 + include/libxml/xmlerror.h | 5 + include/libxml/xmlreader.h | 9 + include/libxml/xmlregexp.h | 4 +- include/libxml/xmlsave.h | 4 +- include/libxml/xmlschemas.h | 7 +- include/libxml/xmlversion.h | 10 +- include/libxml/xmlversion.h.in | 2 +- include/win32config.h | 4 +- include/wsockcompat.h | 12 + legacy.c | 1 - libxml.3 | 2 +- libxml.spec.in | 30 - libxml2.spec | 36 +- macos/src/config-mac.h | 9 - nanohttp.c | 142 +- parser.c | 43 +- parserInternals.c | 62 +- pattern.c | 517 +- python/libxml.py | 3 +- python/libxml2-py.c | 98 +- python/setup.py | 2 +- relaxng.c | 1 - result/HTML/53867.html | 66 + result/HTML/53867.html.err | 0 result/HTML/53867.html.sax | 26 + result/XPath/tests/nodespat | 94 + result/c14n/exc-without-comments/test-2 | 11 + result/noent/ns7 | 2 + result/ns7 | 2 + result/ns7.rde | 1 + result/ns7.rdr | 1 + result/ns7.sax | 5 + result/ns7.sax2 | 5 + result/regexp/* | 1 - result/regexp/hard | 5 + result/schemas/bug303566_1_1.err | 2 +- result/schemas/bug312957_1_0.err | 2 +- result/schemas/bug321475_1_0 | 1 + result/schemas/bug321475_1_0.err | 0 result/schemas/bug322411_1_0 | 1 + result/schemas/bug322411_1_0.err | 0 result/schemas/bug323510_1_0 | 1 + result/schemas/bug323510_1_0.err | 1 + result/schemas/decimal-1_1_0 | 1 + result/schemas/decimal-1_1_0.err | 8 + result/schemas/decimal-2_1_0 | 1 + result/schemas/decimal-2_1_0.err | 4 + result/schemas/decimal-3_1_0 | 1 + result/schemas/decimal-3_1_0.err | 8 + result/schemas/derivation-ok-extension-err_0_0.err | 2 +- result/schemas/derivation-ok-extension_0_0.err | 2 +- .../derivation-ok-restriction-2-1-1_0_0.err | 12 +- .../derivation-ok-restriction-4-1-err_0_0.err | 6 +- result/schemas/element-err_0_0.err | 22 +- result/schemas/idc-keyref-err1_1_0 | 1 + result/schemas/idc-keyref-err1_1_0.err | 1 + result/schemas/include3_0_0.err | 2 +- result/schemas/restriction-attr1_0_0.err | 2 +- result/schemas/scc-no-xmlns_0_0.err | 2 +- result/schemas/scc-no-xsi_0_0.err | 2 +- result/schemas/src-attribute1_0_0.err | 2 +- result/schemas/src-attribute2_0_0.err | 2 +- result/schemas/src-attribute3-1_0_0.err | 2 +- result/schemas/src-attribute3-2-form_0_0.err | 2 +- result/schemas/src-attribute3-2-st_0_0.err | 2 +- result/schemas/src-attribute3-2-type_0_0.err | 2 +- result/schemas/src-attribute4_0_0.err | 2 +- result/schemas/src-element1_0_0.err | 2 +- result/schemas/src-element3_0_0.err | 4 +- runsuite.c | 53 +- runtest.c | 18 +- schematron.c | 6 +- test/HTML/53867.html | 69 + test/XPath/docs/nodes | 2 + test/XPath/tests/nodespat | 5 + test/c14n/exc-without-comments/test-2.xml | 20 + test/c14n/exc-without-comments/test-2.xpath | 6 + test/ns7 | 1 + test/regexp/hard | 5 + test/schemas/bug321475_0.xml | 10 + test/schemas/bug321475_1.xsd | 48 + test/schemas/bug322411_0.xml | 93 + test/schemas/bug322411_1.xsd | 35 + test/schemas/bug323510_0.xml | 3 + test/schemas/bug323510_1.xsd | 12 + test/schemas/decimal-1.xml | 37 + test/schemas/decimal-1.xsd | 29 + test/schemas/decimal-1_0.xml | 24 + test/schemas/decimal-1_1.xsd | 19 + test/schemas/decimal-2_0.xml | 14 + test/schemas/decimal-2_1.xsd | 18 + test/schemas/decimal-3_0.xml | 17 + test/schemas/decimal-3_1.xsd | 18 + test/schemas/idc-keyref-err1_0.xml | 14 + test/schemas/idc-keyref-err1_1.xsd | 53 + testapi.c | 446 +- tree.c | 95 +- uri.c | 144 +- valid.c | 23 +- vms/config.vms | 9 - win32/Makefile.mingw | 4 +- win32/Makefile.mingw.orig | 336 + win32/Makefile.mingw.rej | 17 + win32/configure.js | 8 + win32/libxml2.def.src | 9 + xmlIO.c | 55 +- xmlmodule.c | 9 +- xmlreader.c | 211 +- xmlregexp.c | 517 +- xmlsave.c | 47 +- xmlschemas.c | 9553 ++++++++++++-------- xmlschemastypes.c | 166 +- xmlstring.c | 14 +- xmlwriter.c | 75 +- xpath.c | 97 +- 220 files changed, 12466 insertions(+), 6252 deletions(-) create mode 100644 result/HTML/53867.html create mode 100644 result/HTML/53867.html.err create mode 100644 result/HTML/53867.html.sax create mode 100644 result/XPath/tests/nodespat create mode 100644 result/c14n/exc-without-comments/test-2 create mode 100644 result/noent/ns7 create mode 100644 result/ns7 create mode 100644 result/ns7.rde create mode 100644 result/ns7.rdr create mode 100644 result/ns7.sax create mode 100644 result/ns7.sax2 delete mode 100644 result/regexp/* create mode 100644 result/schemas/bug321475_1_0 create mode 100644 result/schemas/bug321475_1_0.err create mode 100644 result/schemas/bug322411_1_0 create mode 100644 result/schemas/bug322411_1_0.err create mode 100644 result/schemas/bug323510_1_0 create mode 100644 result/schemas/bug323510_1_0.err create mode 100644 result/schemas/decimal-1_1_0 create mode 100644 result/schemas/decimal-1_1_0.err create mode 100644 result/schemas/decimal-2_1_0 create mode 100644 result/schemas/decimal-2_1_0.err create mode 100644 result/schemas/decimal-3_1_0 create mode 100644 result/schemas/decimal-3_1_0.err create mode 100644 result/schemas/idc-keyref-err1_1_0 create mode 100644 result/schemas/idc-keyref-err1_1_0.err create mode 100644 test/HTML/53867.html create mode 100644 test/XPath/docs/nodes create mode 100644 test/XPath/tests/nodespat create mode 100644 test/c14n/exc-without-comments/test-2.xml create mode 100644 test/c14n/exc-without-comments/test-2.xpath create mode 100644 test/ns7 create mode 100644 test/schemas/bug321475_0.xml create mode 100644 test/schemas/bug321475_1.xsd create mode 100644 test/schemas/bug322411_0.xml create mode 100644 test/schemas/bug322411_1.xsd create mode 100644 test/schemas/bug323510_0.xml create mode 100644 test/schemas/bug323510_1.xsd create mode 100644 test/schemas/decimal-1.xml create mode 100644 test/schemas/decimal-1.xsd create mode 100644 test/schemas/decimal-1_0.xml create mode 100644 test/schemas/decimal-1_1.xsd create mode 100644 test/schemas/decimal-2_0.xml create mode 100644 test/schemas/decimal-2_1.xsd create mode 100644 test/schemas/decimal-3_0.xml create mode 100644 test/schemas/decimal-3_1.xsd create mode 100644 test/schemas/idc-keyref-err1_0.xml create mode 100644 test/schemas/idc-keyref-err1_1.xsd create mode 100644 win32/Makefile.mingw.orig create mode 100644 win32/Makefile.mingw.rej (limited to 'doc/devhelp/libxml2-schemasInternals.html') diff --git a/ChangeLog b/ChangeLog index b8cd4e5..46037c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,543 @@ +Thu Jan 5 16:25:06 CET 2006 Daniel Veillard + + * NEWS configure.in libxml.spec.in testapi.c doc/*: upated the news + regenerated the docs, preparing for release of 2.6.23 + * pattern.c xmlschemas.c: fixed some comments + +Thu Jan 5 15:48:27 CET 2006 Kasimier Buchcik + + * test/XPath/docs/nodes test/XPath/tests/nodespat + result/XPath/tests/nodespat: Added regression tests for + the latest XPath/pattern fixes. + +Thu Jan 5 15:43:38 CET 2006 Kasimier Buchcik + + * pattern.c: Another fix to handle "foo//.": "foo" was not + included in the resulting node-set. + +Thu Jan 5 13:22:29 CET 2006 Kasimier Buchcik + + * pattern.c xpath.c include/libxml/pattern.h: + Fixed bug #322928, reported by Erich Schubert: The bug was + in pattern.c, which is used for a tiny subset of xpath + expression which can be evaluated in an optimized way. + The doc-node was never considered when evaluating "//" + expressions. Additionally, we fixed resolution + to nodes of any type in pattern.c; i.e. a "//." didn't work + yet, as it did select only element-nodes. Due to this + issue the pushing of nodes in xpath.c needed to be adjusted + as well. + +Wed Jan 4 18:07:47 CET 2006 Daniel Veillard + + * parser.c: tiny refactoring patch from Bjorn Reese + +Wed Jan 4 15:00:51 CET 2006 Daniel Veillard + + * SAX2.c: fix bug #324432 with + * test/ns7 resul//ns7*: added to the regression tests + +Wed Jan 4 10:53:56 CET 2006 Daniel Veillard + + * include/wsockcompat.h: applied patch from Mark Junker, fixing a + MinGW compilation problem, should close bug #324943 + +Tue Jan 3 11:49:54 CET 2006 Kasimier Buchcik + + * xmlschemas.c: Removed last dependency on the obsolete enum + xmlSchemaValidError. + +Mon Jan 2 11:20:00 CET 2006 Daniel Veillard + + * xmlreader.c include/libxml/xmlreader.h xmlschemas.c: compilation + and doc build fixes from Michael Day + +Wed Dec 28 22:12:34 CET 2005 Daniel Veillard + + * xmlregexp.c: bug in xmlRegExecPushString2() pointed out by + Sreeni Nair. + +Tue Dec 20 16:55:31 CET 2005 Rob Richards + + * tree.c: fix bug #322136 in xmlNodeBufGetContent when entity ref is + a child of an element (fix by Oleksandr Kononenko). + * HTMLtree.c include/libxml/HTMLtree.h: Add htmlDocDumpMemoryFormat. + +Tue Dec 20 11:43:06 CET 2005 Kasimier Buchcik + + * xmlschemas.c xmlstring.c: Fixed a segfault during + text concatenation when validating a node tree: + xmlStrncat was called with a @len of -1; but unlike + xmlStrncatNew, it does not calculate the length + automatically in such a case (reported by Judy Hay + on the mailing list). + Updated the descriptions of the involved string + functions to note this. + +Thu Dec 15 12:11:07 CET 2005 Daniel Veillard + + * nanohttp.c: applied patch from Gary Coady to accept gzipped + http resources. + +Wed Dec 14 18:41:26 CET 2005 Kasimier Buchcik + + * win32/configure.js: Added enable/disable of runtime + debugging (LIBXML_DEBUG_RUNTIME). + +Wed Dec 14 18:11:50 CET 2005 Kasimier Buchcik + + * include/libxml/xmlversion.h.in: Fixed to define + LIBXML_DEBUG_RUNTIME on the basis of @WITH_RUN_DEBUG@. + +Tue Dec 13 12:49:23 CET 2005 Kasimier Buchcik + + * test/schemas/bug321475* result/schemas/bug321475*: + Added regression test for bug #321475 (reported by + Gabor Nagy). Fixing of bug #323510 seemed to have + fixed this bug as well. + +Mon Dec 12 16:19:16 CET 2005 Kasimier Buchcik + + * test/schemas/bug323510* result/schemas/bug323510*: + Added regression test for bug #323510. + +Mon Dec 12 16:11:13 CET 2005 Kasimier Buchcik + + * xmlschemas.c: Workaround for bug #323510 (reported by + Jonathan Filiatrault): substituted the epsilon transition + for a labelled transition, in order to avoid a bug in + xmlregexp.c which eliminated the epsilon transition and + marked the initial state as final. + +Mon Dec 12 14:25:46 CET 2005 Daniel Veillard + + * xmlreader.c: Gary Coady pointed a memory leak in + xmlTextReaderReadInnerXml() applied patch fixing #323864 + +Sat Dec 10 12:08:28 CET 2005 Daniel Veillard + + * HTMLparser.c configure.in parserInternals.c runsuite.c runtest.c + testapi.c xmlschemas.c xmlschemastypes.c xmlstring.c: fixed a number + of warnings shown by HP-UX compiler and reported by Rick Jones + +Fri Dec 9 18:57:31 CET 2005 Rob Richards + + * xmlwriter.c: Insert space between pubid and sysid when both + passed to xmlTextWriterStartDTD and indenting not being used. + Remove no longer used Mem callbacks. + +Fri Dec 9 11:01:16 CET 2005 Kasimier Buchcik + + * runsuite.c: Changed to instantly mark instance-tests as + failed if the corresponding schema was invalid. This + reflects the side of the Python code for the XML Schema test + suite. We now get the same number of failed tests on both + sides. + +Wed Dec 7 14:59:01 CET 2005 Kasimier Buchcik + + * xmlreader.c include/libxml/xmlreader.h: Added + xmlTextReaderSchemaValidateCtxt() to the API. + +Wed Dec 7 12:59:56 CET 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed a segfault: the instance document was + still tried to be validated, if the schema, dynamically + acquired using XSI was invalid, thus mangled. The + validation will stop (or rather won't validate) now in + such a case. The schema parser error code will be set + on the validion context now; this is somehow not nice, + but it assures that the validation context indicates an + error in there was a parser error. + +Tue Dec 6 18:57:23 CET 2005 Daniel Veillard + + * xmlreader.c: small doc patch from Aron Stansvik + * legacy.c: another doc patch for a deprecated API + +Mon Dec 5 16:23:49 CET 2005 Kasimier Buchcik + + * Makefile.am: Tiny change for 'make tests': raised + the number of expected failures for James Clark's + XML Schema datatype tests from 10 to 11. The additional + reported error was agreed to be correct long time ago, + but we missed to adjust the message reported by + the testing script. + +Fri Dec 2 13:51:14 CET 2005 Kasimier Buchcik + + * result/schemas/decimal* result/schemas/bug322411*: + Added missing regression test results for the latest IDC + and xs:decimal bugs. + +Wed Nov 30 12:22:23 CET 2005 Kasimier Buchcik + + * test/schemas/decimal* test/schemas/bug322411*: Added + regression tests for the latest IDC and xs:decimal bugs. + +Wed Nov 30 11:57:35 CET 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed bubbling of duplicate IDC nodes: the + parent's list of duplicates was filled with NULLs instead + of the nodes under certain conditions. This lead to a + segfault when the list's entries were accessed. + +Mon Nov 28 17:28:53 CET 2005 Kasimier Buchcik + + * xmlschemastypes.c: Fixed parsing of xs:decimal to + allow/deny special lexical forms. Fixed the totalDigits + for values in the range (x < 1) && (x > -1) && (x != 0); + E.g "0.123" has now a totalDigits of 3 (was 4 previously). + Adjusted the comparison function for decimals due to this + change. As a side effect comparison against zeroes was + optimized. + +Mon Nov 28 13:25:11 CET 2005 Kasimier Buchcik + + * xmlschemas.c: An assignment to a local variable, which was + used to access the IDC node list, was missing after the + reallocation of the list (reported by Fabrice GUY + bug #322411). Renamed the define ENABLE_IDC_NODE_TABLES + to ENABLE_IDC_NODE_TABLES_TEST and *disabled* it, since + it is used to force bubbling of IDC node tables even + if not necessary; this was intended to be used for test + purposes, but I obviously missed to disable it (although + it apparently helped finding the bug). + +Wed Nov 23 17:34:52 CET 2005 Kasimier Buchcik + + * xmlschemas.c: In xmlSchemaAssembleByXSI() the return value + of xmlSchemaGetMetaAttrInfo() was not assigned to anything; + this caused XSI-driven-dynamic schema acquisition to fail + with @noNamespaceSchemaLocation (reported by Julien Lamy + on the mailing list). + +Tue Nov 22 18:31:34 CET 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed a bug in xmlSchemaFindRedefCompInGraph() + which caused the search for components to stop at the + first encountered attribute group component. + Fixed error report in xmlSchemaCheckSRCRedefineFirst(): the + designation of a not-found component was not reported. + +Mon Nov 21 12:23:28 CET 2005 Daniel Veillard + + * xmlschemastypes.c: Albert Chin found another signed/unsigned problem + in the date and time code raised on IRIX 6.5 + +Fri Nov 18 18:13:38 CET 2005 Kasimier Buchcik + + * xmlschemas.c include/libxml/xmlschemas.h: + Added xmlSchemaSetParserStructuredErrors() to the API. + Fixed channeling of error relevant information to + subsequent parser/validation contexts. + +Thu Nov 17 14:11:43 CET 2005 Daniel Veillard + + * parserInternals.c: removed unreachable code pointed out by + Oleksandr Kononenko, fixes bug #321695 + +Thu Nov 17 08:24:31 CET 2005 Daniel Veillard + + * parser.c: use ctxt->standalone = -2 to indicate that the + XMLDecl was parsed but no standalone attribute was found, + suggested by Michael Day to detect if an XMLDecl was found. + +Tue Nov 15 09:49:24 CET 2005 Daniel Veillard + + * runtest.c: Hisashi Fujinaka pointed that errors in Schemas tests + were not properly reported. + +Sun Nov 13 13:42:41 CET 2005 Daniel Veillard + + * xmlIO.c: applied patch from Geert Jansen to remove xmlBufferClose() + which is not needed. + +Fri Nov 11 13:48:52 CET 2005 Kasimier Buchcik + + * xmlschemas.c: Changed xmlSchemaFormatIDCKeySequence() + to use xmlSchemaGetCanonValueWhtspExt() in order to + correctly report values for xs:anySimpleType. + * test/schemas/idc-keyref-err1* + result/schemas/idc-keyref-err1*: Added a test for this change. + +Wed Nov 9 13:07:24 EST 2005 Rob Richards + + * xmlIO.c xmlwriter.c: function consolidation when writing to xmlBuffer. + Return error condition not len if xmlwriter fails writing to buffer. + +Wed Nov 9 09:54:54 CET 2005 Daniel Veillard + + * xmlsave.c xmlIO.c include/libxml/xmlIO.h include/libxml/xmlsave.h: + applied patch from Geert Jansen to implement the save function to + a xmlBuffer, and a bit of cleanup. + +Mon Nov 7 14:58:39 CET 2005 Kasimier Buchcik + + * xmlschemas.c xmlschemastypes.c: Fixed the type of the + totalDigits value to be positiveInteger. + Fixed crash in an error report function when we gave it + the document node; only element and attribute nodes are + processed now (reported by Rob Richards). + +Tue Nov 1 16:22:29 CET 2005 Daniel Veillard + + * xmlregexp.c: fix bug #319897, problem with counted atoms + when the transition itself is counted too + * result/regexp/hard test/regexp/hard: augmented the regression + tests with the problem exposed. + +Tue Nov 1 11:54:39 CET 2005 Daniel Veillard + + * win32/Makefile.mingw include/win32config.h: applied patch from + Mark Junker to fix compilation with MinGW + +Fri Oct 28 18:36:08 CEST 2005 Daniel Veillard + + * libxml.3: tiny fix from Albert Chin + * runsuite.c runtest.c testapi.c: portability cleanup for arch + needing trio for *printf + +Fri Oct 28 12:21:39 EDT 2005 Rob Richards + + * tree.c: add additional checks to prevent tree corruption. fix problem + copying attribute using xmlDocCopyNode from one document to another. + +Fri Oct 28 17:58:13 CEST 2005 Daniel Veillard + + * config.h.in configure.in vms/config.vms macos/src/config-mac.h: + cleanup from Albert Chin + * doc/Makefile.am: html/index.sgml doesn't exist anymore + +Fri Oct 28 16:53:51 CEST 2005 Daniel Veillard + + * xmlIO.c xmlmodule.c: more portability patches from Albert Chin for + HP-UX and AIX + +Fri Oct 28 10:36:10 CEST 2005 Daniel Veillard + + * xmlmodule.c configure.in: applied 2 patches from Albert Chin for + module portability + +Fri Oct 28 10:24:39 CEST 2005 Daniel Veillard + + * error.c: fixing a portability problem on some old Unices with + patch from Albert Chin + +2005-10-27 Aleksey Sanin + + * c14n.c result/c14n/exc-without-comments/test-2 + test/c14n/exc-without-comments/test-2.xml + test/c14n/exc-without-comments/test-2.xpath: fixing + bug in exc-c14n namespace visibility + test case (bug #319367) + +Thu Oct 27 16:10:31 CEST 2005 Daniel Veillard + + * python/libxml.py: remove warnings to stdout patch from Nic Ferrier + +Thu Oct 27 13:54:52 CEST 2005 Daniel Veillard + + * valid.c xmlregexp.c include/libxml/valid.h + include/libxml/xmlregexp.h: avoid function parameters names 'list' + as this seems to give troubles with VC6 and stl as reported by + Samuel Diaz Garcia. + +Wed Oct 26 10:59:21 CEST 2005 Daniel Veillard + + * parserInternals.c: fix a problem in some error case on Solaris + when passed a NULL filename, pointed by Albert Chin. + +Tue Oct 25 14:34:58 CEST 2005 Daniel Veillard + + * HTMLparser.c: script HTML parser error fix, corrects bug #319715 + * result/HTML/53867* test/HTML/53867.html: added test from Michael Day + to the regression suite + +Tue Oct 25 14:21:11 CEST 2005 Daniel Veillard + + * HTMLparser.c: typo fix from Michael Day + +Mon Oct 24 20:16:23 EDT 2005 Rob Richards + + * tree.c: fix issue adding non-namespaced attributes in xmlAddChild(), + xmlAddNextSibling() and xmlAddPrevSibling() (bug #319108) - part 1. + +Sat Oct 22 10:00:41 HKT 2005 William Brack + + * parser.c: fixed second spot where CRLF split between chunks + could cause trouble (bug #319279) + * gentest.py, testapi.c: fixed two problems involved with + --with-minimum compilation (compilation errors with schematron + and formal expressions tests) + +Fri Oct 21 10:50:14 EDT 2005 Rob Richards + + * xmlsave.c: prevent output of fragment tags when serializing XHTML. + +Wed Oct 19 16:53:47 BST 2005 Daniel Veillard + + * xmlregexp.c: commiting a some fixes and debug done yesterday in + the London airport. + +Thu Oct 20 12:54:23 CEST 2005 Kasimier Buchcik + + * xmlschemas.c: Removed creation of a temporary parser context + during validation when processing xsi:type; this previously + added a string to the dict of the schema - to assure thread + safety, we don't want to modify a given schema during + validation. + +Thu Oct 20 17:05:29 HKT 2005 William Brack + + * xmlwriter.c: fixed problem in xmlTextWriterVSprintf caused by + misuse of vsnprintf + * configure.in, config.h.in: added a configuration check for + va_copy and added a define for VA_COPY for xmlwriter.c fix + * parser.c: fixed problem with CRLF split between chunks (bug + #319279) (fix provided by Brion Vibber) + +Wed Oct 19 18:49:52 CEST 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed a potential memory leak in + xmlSchemaCheckCSelectorXPath() when an internal error occurs. + Fixed setting of ctxt->err to the given error code in + the parsing error functions. + * pattern.c: Added internal xmlCompileIDCXPathPath() as a + starting point for IDC XPath compilation; this and some other + tiny changes fixes issues regarding whitespace in the + expressions and IDC selector/field relevant restrictions of + the subset of XPath. Fixed a missing blocking of attributes + in xmlStreamPushInternal(). + +Mon Oct 17 15:06:05 EDT 2005 Daniel Veillard + + * runtest.c: removed the error message + * relaxng.c xmlschemas.c: removed 2 instability warnings from function + documentation + * include/libxml/schemasInternals.h: changed warning about API stability + * xmlregexp.c: trying to improve runtime execution of non-deterministic + regexps and automata. Not fully finished but should be way better. + +Mon Oct 17 16:12:02 CEST 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed a memory leak in + xmlSchemaContentModelDump(). Added output of local types + in xmlSchemaElementDump(). Tiny cosmetical changes to the + dump output. + +Mon Oct 17 14:29:08 CEST 2005 Kasimier Buchcik + + * tree.c pattern.c: Silenced intel compiler warnings (reported + by Kjartan Maraas, bug #318517). + * xmlschemas.c: The above changes in pattern.c revealed an + inconsistency wrt IDCs: we now _only_ pop XPath states, if + we really pushed them beforehand; this was previously not + checked for the case when we discover an element node to be + invalid wrt the content model. + Fixed segfault in xmlSchemaGetEffectiveValueConstraint(). + +Fri Oct 14 16:40:18 CEST 2005 Kasimier Buchcik + + * result/schemas/*.err: Adapted regression test results. + +Fri Oct 14 16:21:22 CEST 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed some identity-constraint issues: + Restructured IDC node-tables + Allowed IDCs to resolve also to nodes of complex type with + simple content. + Added check for keyrefs with references to keyrefs. + IDC target-nodes were interferring with IDC node-tables, + since they used one list of entries only. I separated this + one big list into 3 lists: 1 for IDC node-table entries, + 1 for _duplicates_ of IDC node-table entries and 1 for + IDC target-nodes. More code, but cleaner and it works at last. + Keyrefs will fail to resolve to duplicate key/unique entries. + I thought this was already working this way, but it didn't. + The wording of the definition for [node table] in the spec + can lead to a scenario, where keyrefs resolve perfectly, even + if the relevant key-sequences of the referenced key/unique have + duplicates in the subtree. Currently only Saxon 8.5.1 is + dissallowing resolution to duplicate entries correctly - we + will follow Saxon here. + Removed some intel compiler warnings (reported by + Kjartan Maraas, bug #318517). + * pattern.c: Fixed an IDC-XPath problem when resolving to + attributes. + +Mon Oct 14 01:15:14 CEST 2005 Rob Richards + * nanohttp.c include/wsockcompat.h: applied patch from Kolja Nowak + to use getaddrinfo() if supported in Windows build (bug# 317431). + +Mon Oct 10 15:33:48 CEST 2005 Kasimier Buchcik + + * result/schemas/*: Adapted regression test results. + +Mon Oct 10 15:12:43 CEST 2005 Kasimier Buchcik + + * xmlschemas.c include/libxml/schemasInternals.h + include/libxml/xmlerror.h: Initial implementation for + redefinitions; this still misses checks for restrictions + of the content model of complex types. + Fixed default/fixed values for attributes (looks like they + did not work in the last releases). + Completed constraints for attribute uses. + Seperated attribute derivation from attribute constraints. + Completed constraints for attribute group definitions. + Disallowing s of schemas in no target namespace if the + importing schema is a chameleon schema. This contradicts + the way Saxon, Xerces-J, XSV and IBM's SQC works, but the + W3C XML Schema WG, thinks it is correct to dissalow such + imports. + Added cos-all-limited constraints. + Restructured reference resolution to model groups and element + declarations. + Misc cleanup. + +Fri Oct 7 04:34:12 CEST 2005 Rob Richards + + * schematron.c xmlregexp.c: remove warnings under Windows. + +Wed Sep 28 23:42:14 CEST 2005 Daniel Veillard + + * parser.c: applied patch from Massimo Morara fixing bug #317447 + about risk of invalid write in xmlStringLenDecodeEntities + +Tue Sep 27 11:20:57 CEST 2005 Daniel Veillard + + * error.c: Adrian Mouat pointed out redundancies in xmlReportError() + +Mon Sep 26 19:18:24 CEST 2005 Daniel Veillard + + * xmlregexp.c: seems a test to avoid duplicate transition is + really needed at all times. Luka Por gave an example hitting + this. Changed back the internal API. + +Thu Sep 22 13:14:07 CEST 2005 Daniel Veillard + + * xmlreader.c: fixing leak in xmlTextReaderReadString() #316924 + +Thu Sep 15 16:12:44 CEST 2005 Daniel Veillard + + * uri.c: more fixes to the behaviour of xmlBuildRelativeURI + +Thu Sep 15 15:08:21 CEST 2005 Daniel Veillard + + * xmlregexp.c: detect combinatory explosion and return with + a runtime error in those case, c.f. #316338 though maybe we + should not see such an explosion with that specific regexp, + more checking needs to be done. + +Wed Sep 14 19:52:18 CEST 2005 Kasimier Buchcik + + * include/libxml/schemasInternals.h: Added some comments for the + struct fields. + +Wed Sep 14 13:24:27 HKT 2005 William Brack + + * uri.c: fixed problem when xmlBuildRelativeURI was given a + blank path (bug 316224) + Mon Sep 12 23:41:40 CEST 2005 Daniel Veillard * NEWS configure.in doc//*: release of 2.6.22 updated doc and diff --git a/HTMLparser.c b/HTMLparser.c index d11ae08..12afdd8 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2678,7 +2678,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { break; /* while */ } else { htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, - "Element %s embbeds close tag\n", + "Element %s embeds close tag\n", ctxt->name, NULL); } } else { @@ -2701,6 +2701,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } nbchar = 0; } + GROW; NEXTL(l); cur = CUR_CHAR(l); } @@ -4778,7 +4779,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { } break; case XML_PARSER_START_TAG: { - const xmlChar *name, *oldname; + const xmlChar *name; int failed; const htmlElemDesc * info; @@ -4831,7 +4832,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { SKIP(2); if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, name); - oldname = htmlnamePop(ctxt); + htmlnamePop(ctxt); ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4852,7 +4853,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { */ if (xmlStrEqual(name, ctxt->name)) { nodePop(ctxt); - oldname = htmlnamePop(ctxt); + htmlnamePop(ctxt); } ctxt->instate = XML_PARSER_CONTENT; @@ -4869,7 +4870,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if ((info != NULL) && (info->empty)) { if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, name); - oldname = htmlnamePop(ctxt); + htmlnamePop(ctxt); } ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH diff --git a/HTMLtree.c b/HTMLtree.c index e77ee65..d73024a 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -506,16 +506,17 @@ htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) { } /** - * htmlDocDumpMemory: + * htmlDocDumpMemoryFormat: * @cur: the document * @mem: OUT: the memory pointer * @size: OUT: the memory length + * @format: should formatting spaces been added * * Dump an HTML document in memory and return the xmlChar * and it's size. * It's up to the caller to free the memory. */ void -htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { +htmlDocDumpMemoryFormat(xmlDocPtr cur, xmlChar**mem, int *size, int format) { xmlOutputBufferPtr buf; xmlCharEncodingHandlerPtr handler = NULL; const char *encoding; @@ -572,7 +573,8 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { return; } - htmlDocContentDumpOutput(buf, cur, NULL); + htmlDocContentDumpFormatOutput(buf, cur, NULL, format); + xmlOutputBufferFlush(buf); if (buf->conv != NULL) { *size = buf->conv->use; @@ -584,6 +586,20 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { (void)xmlOutputBufferClose(buf); } +/** + * htmlDocDumpMemory: + * @cur: the document + * @mem: OUT: the memory pointer + * @size: OUT: the memory length + * + * Dump an HTML document in memory and return the xmlChar * and it's size. + * It's up to the caller to free the memory. + */ +void +htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { + htmlDocDumpMemoryFormat(cur, mem, size, 1); +} + /************************************************************************ * * diff --git a/Makefile.am b/Makefile.am index ee09a7b..5ef9d90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1070,7 +1070,7 @@ SchemasPythonTests: LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ echo "## XML Schemas datatypes Python based test suite" ; \ - echo "## It is normal to see 10 errors reported" ; \ + echo "## It is normal to see 11 errors reported" ; \ $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \ fi) @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" MAKEFLAGS+=--silent pytests ; fi) diff --git a/Makefile.in b/Makefile.in index 3e66d17..d238442 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2328,7 +2328,7 @@ SchemasPythonTests: LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ echo "## XML Schemas datatypes Python based test suite" ; \ - echo "## It is normal to see 10 errors reported" ; \ + echo "## It is normal to see 11 errors reported" ; \ $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \ fi) @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" MAKEFLAGS+=--silent pytests ; fi) diff --git a/NEWS b/NEWS index 6d91fc6..ccb9ace 100644 --- a/NEWS +++ b/NEWS @@ -15,176 +15,216 @@ ChangeLog.html to the CVS at http://cvs.gnome.org/viewcvs/libxml2/ code base.There is the list of public releases: +2.6.23: Jan 5 2006: + - portability fixes: Windows (Rob Richards), getaddrinfo on Windows + (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas), + --with-minimum compilation fixes (William Brack), error case handling fix + on Solaris (Albert Chin), don't use 'list' as parameter name reported by + Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin), + MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick Jones), + + - code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose + (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring + parsing code (Bjorn Reese) + - bug fixes: xmlBuildRelativeURI and empty path (William Brack), + combinatory explosion and performances in regexp code, leak in + xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo + Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik), + XPath pattern based evaluation bugs (DV & Kasimier), + xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in + xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of + vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF + split problem (William), issues with non-namespaced attributes in + xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), + HTML parsing of script, Python must not output to stdout (Nic Ferrier), + exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype + totalDigits bug (Kasimier Buchcik), error handling when writing to an + xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi + Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix + XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier), + fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml + (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of + runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs + (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), + compilation and build fixes (Michael Day), removed dependancies on + xmlSchemaValidError (Kasimier), bug with , more XPath + pattern based evaluation fixes (Kasimier) + - improvements: XSD Schemas redefinitions/restrictions (Kasimier + Buchcik), node copy checks and fix for attribute (Rob Richards), counted + transition bug in regexps, ctxt->standalone = -2 to indicate no + standalone attribute was found, add xmlSchemaSetParserStructuredErrors() + (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API + (Kasimier), handle gzipped HTTP resources (Gary Coady), add + htmlDocDumpMemoryFormat. (Rob Richards), + - documentation: typo (Michael Day), libxml man page (Albert Chin), save + function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik), + + + 2.6.22: Sep 12 2005: - build fixes: compile without schematron (Stéphane Bidoul) - bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, - CDATA push parser bug, xmlElemDump problem with XHTML1 doc, - XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, - fix some output formatting for meta element (Rob Richards), - script and style XHTML1 serialization (David Madore), Attribute - derivation fixups in XSD (Kasimier Buchcik), better IDC error - reports (Kasimier Buchcik) - - - improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), - add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements - preparing for derive (Kasimier Buchcik). + CDATA push parser bug, xmlElemDump problem with XHTML1 doc, + XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some + output formatting for meta element (Rob Richards), script and style + XHTML1 serialization (David Madore), Attribute derivation fixups in XSD + (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik) + - improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add + XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for + derive (Kasimier Buchcik). - documentation: generation of gtk-doc like docs, integration with - devhelp. + devhelp. 2.6.21: Sep 4 2005: - build fixes: Cygwin portability fixes (Gerrit P. Haase), calling - convention problems on Windows (Marcus Boerger), cleanups based on - Linus' sparse tool, update of win32/configure.js (Rob Richards), - remove warnings on Windows(Marcus Boerger), compilation without SAX1, - detection of the Python binary, use $GCC inestad of $CC = 'gcc' (Andrew - W. Nosenko), compilation/link with threads and old gcc, compile - problem by C370 on Z/OS, + convention problems on Windows (Marcus Boerger), cleanups based on Linus' + sparse tool, update of win32/configure.js (Rob Richards), remove warnings + on Windows(Marcus Boerger), compilation without SAX1, detection of the + Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko), + compilation/link with threads and old gcc, compile problem by C370 on + Z/OS, - bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 - bug (Jiri Netolicky), XPath NaN compare bug (William Brack), - htmlParseScript potential bug, Schemas regexp handling of spaces, - Base64 Schemas comparisons NIST passes, automata build error xsd:all, - xmlGetNodePath for namespaced attributes (Alexander Pohoyda), - xmlSchemas foreign namespaces handling, XML Schemas facet comparison - (Kupriyanov Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier - Buchcik), xml: namespace ahndling in Schemas (Kasimier), empty model - group in Schemas (Kasimier), wilcard in Schemas (Kasimier), URI - composition (William), xs:anyType in Schemas (Kasimier), Python resolver - emmitting error messages directly, Python xmlAttr.parent (Jakub Piotr - Clapa), trying to fix the file path/URI conversion, - xmlTextReaderGetAttribute fix (Rob Richards), xmlSchemaFreeAnnot memleak - (Kasimier), HTML UTF-8 serialization, streaming XPath, Schemas determinism - detection problem, XInclude bug, Schemas context type (Dean Hill), - validation fix (Derek Poon), xmlTextReaderGetAttribute[Ns] namespaces - (Rob Richards), Schemas type fix (Kuba Nowakowski), UTF-8 parser bug, - error in encoding handling, xmlGetLineNo fixes, bug on entities handling, - entity name extraction in error handling with XInclude, text nodes - in HTML body tags (Gary Coady), xml:id and IDness at the treee level - fixes, XPath streaming patterns bugs. + bug (Jiri Netolicky), XPath NaN compare bug (William Brack), + htmlParseScript potential bug, Schemas regexp handling of spaces, Base64 + Schemas comparisons NIST passes, automata build error xsd:all, + xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas + foreign namespaces handling, XML Schemas facet comparison (Kupriyanov + Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: + namespace ahndling in Schemas (Kasimier), empty model group in Schemas + (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), + xs:anyType in Schemas (Kasimier), Python resolver emmitting error + messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to + fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob + Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8 + serialization, streaming XPath, Schemas determinism detection problem, + XInclude bug, Schemas context type (Dean Hill), validation fix (Derek + Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas + type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling, + xmlGetLineNo fixes, bug on entities handling, entity name extraction in + error handling with XInclude, text nodes in HTML body tags (Gary Coady), + xml:id and IDness at the treee level fixes, XPath streaming patterns + bugs. - improvements: structured interfaces for schemas and RNG error reports - (Marcus Boerger), optimization of the char data inner loop parsing - (thanks to Behdad Esfahbod for the idea), schematron validation - though not finished yet, xmlSaveOption to omit XML declaration, - keyref match error reports (Kasimier), formal expression handling - code not plugged yet, more lax mode for the HTML parser, - parser XML_PARSE_COMPACT option for text nodes allocation. + (Marcus Boerger), optimization of the char data inner loop parsing + (thanks to Behdad Esfahbod for the idea), schematron validation though + not finished yet, xmlSaveOption to omit XML declaration, keyref match + error reports (Kasimier), formal expression handling code not plugged + yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option + for text nodes allocation. - documentation: xmllint man page had --nonet duplicated 2.6.20: Jul 10 2005: - - build fixes: Windows build (Rob Richards), Mingw compilation (Igor - Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and - andriy@google.com), use gcc weak references to pthread to avoid the - pthread dependancy on Linux, compilation problem (Steve Nairn), - compiling of subset (Morten Welinder), IPv6/ss_family compilation - (William Brack), compilation when disabling parts of the library, - standalone test distribution. - - - bug fixes: bug in lang(), memory cleanup on errors (William Brack), - HTTP query strings (Aron Stansvik), memory leak in DTD (William), - integer overflow in XPath (William), nanoftp buffer size, pattern - "." apth fixup (Kasimier), leak in tree reported by Malcolm Rowe, - replaceNode patch (Brent Hendricks), CDATA with NULL content - (Mark Vakoc), xml:base fixup on XInclude (William), pattern - fixes (William), attribute bug in exclusive c14n (Aleksey Sanin), - xml:space and xml:lang with SAX2 (Rob Richards), namespace - trouble in complex parsing (Malcolm Rowe), XSD type QNames fixes - (Kasimier), XPath streaming fixups (William), RelaxNG bug (Rob Richards), - Schemas for Schemas fixes (Kasimier), removal of ID (Rob Richards), - a small RelaxNG leak, HTML parsing in push mode bug (James Bursa), - failure to detect UTF-8 parsing bugs in CDATA sections, areBlanks() - heuristic failure, duplicate attributes in DTD bug (William). - - - improvements: lot of work on Schemas by Kasimier Buchcik both on - conformance and streaming, Schemas validation messages (Kasimier - Buchcik, Matthew Burgess), namespace removal at the python level - (Brent Hendricks), Update to new Schemas regression tests from - W3C/Nist (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation - of xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), - standalone test framework and programs, new DOM import APIs - xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and - xmlDOMWrapRemoveNode(), extension of xmllint capabilities for - SAX and Schemas regression tests, xmlStopParser() available in - pull mode too, ienhancement to xmllint --shell namespaces support, - Windows port of the standalone testing tools (Kasimier and William), - xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() - SAX Schemas APIs, Schemas xmlReader support. - + - build fixes: Windows build (Rob Richards), Mingw compilation (Igor + Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and + andriy@google.com), use gcc weak references to pthread to avoid the + pthread dependancy on Linux, compilation problem (Steve Nairn), compiling + of subset (Morten Welinder), IPv6/ss_family compilation (William Brack), + compilation when disabling parts of the library, standalone test + distribution. + - bug fixes: bug in lang(), memory cleanup on errors (William Brack), + HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer + overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup + (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch + (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup + on XInclude (William), pattern fixes (William), attribute bug in + exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob + Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type + QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug + (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob + Richards), a small RelaxNG leak, HTML parsing in push mode bug (James + Bursa), failure to detect UTF-8 parsing bugs in CDATA sections, + areBlanks() heuristic failure, duplicate attributes in DTD bug + (William). + - improvements: lot of work on Schemas by Kasimier Buchcik both on + conformance and streaming, Schemas validation messages (Kasimier Buchcik, + Matthew Burgess), namespace removal at the python level (Brent + Hendricks), Update to new Schemas regression tests from W3C/Nist + (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of + xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), + standalone test framework and programs, new DOM import APIs + xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and + xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and + Schemas regression tests, xmlStopParser() available in pull mode too, + ienhancement to xmllint --shell namespaces support, Windows port of the + standalone testing tools (Kasimier and William), + xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX + Schemas APIs, Schemas xmlReader support. 2.6.19: Apr 02 2005: - - build fixes: drop .la from RPMs, --with-minimum build fix (William - Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with - AIX 5.3 compiler, fixed elfgcchack.h generation and PLT reduction - code on Linux/ELF/gcc4 - - bug fixes: schemas type decimal fixups (William Brack), xmmlint return - code (Gerry Murphy), small schemas fixes (Matthew Burgess and - GUY Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey - Sanin), segfault in Schemas (Kasimier Buchcik), Schemas attribute - validation (Kasimier), Prop related functions and xmlNewNodeEatName - (Rob Richards), HTML serialization of name attribute on a elements, - Python error handlers leaks and improvement (Brent Hendricks), - uninitialized variable in encoding code, Relax-NG validation bug, - potential crash if gnorableWhitespace is NULL, xmlSAXParseDoc and - xmlParseDoc signatures, switched back to assuming UTF-8 in case - no encoding is given at serialization time - - improvements: lot of work on Schemas by Kasimier Buchcik on facets - checking and also mixed handling. + - build fixes: drop .la from RPMs, --with-minimum build fix (William + Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX + 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on + Linux/ELF/gcc4 + - bug fixes: schemas type decimal fixups (William Brack), xmmlint return + code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY + Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin), + segfault in Schemas (Kasimier Buchcik), Schemas attribute validation + (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards), + HTML serialization of name attribute on a elements, Python error handlers + leaks and improvement (Brent Hendricks), uninitialized variable in + encoding code, Relax-NG validation bug, potential crash if + gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures, + switched back to assuming UTF-8 in case no encoding is given at + serialization time + - improvements: lot of work on Schemas by Kasimier Buchcik on facets + checking and also mixed handling. - 2.6.18: Mar 13 2005: - - build fixes: warnings (Peter Breitenlohner), testapi.c generation, - Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), - some gcc4 fixes, HP-UX portability fixes (Rick Jones). - - bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and - xmlreader stopping on non-fatal errors, thread support for dictionnaries - reference counting (Gary Coady), internal subset and push problem, - URL saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python - paths fixup (Stephane Bidoul), xmlGetNodePath and namespaces, - xmlSetNsProp fix (Mike Hommey), warning should not count as error - (William Brack), xmlCreatePushParser empty chunk, XInclude parser - flags (William), cleanup FTP and HTTP code to reuse the uri parsing - and IPv6 (William), xmlTextWriterStartAttributeNS fix (Rob Richards), - XMLLINT_INDENT being empty (William), xmlWriter bugs (Rob Richards), - multithreading on Windows (Rich Salz), xmlSearchNsByHref fix (Kasimier), - Python binding leak (Brent Hendricks), aliasing bug exposed by gcc4 - on s390, xmlTextReaderNext bug (Rob Richards), Schemas decimal type - fixes (William Brack), xmlByteConsumed static buffer (Ben Maurer). - - improvement: speedup parsing comments and DTDs, dictionnary support for - hash tables, Schemas Identity constraints (Kasimier), streaming XPath - subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical - values handling (Kasimier), add xmlTextReaderByteConsumed (Aron - Stansvik), - - Documentation: Wiki support (Joel Reed) - + - build fixes: warnings (Peter Breitenlohner), testapi.c generation, + Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), + some gcc4 fixes, HP-UX portability fixes (Rick Jones). + - bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and + xmlreader stopping on non-fatal errors, thread support for dictionnaries + reference counting (Gary Coady), internal subset and push problem, URL + saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths + fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix + (Mike Hommey), warning should not count as error (William Brack), + xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup + FTP and HTTP code to reuse the uri parsing and IPv6 (William), + xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being + empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows + (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent + Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug + (Rob Richards), Schemas decimal type fixes (William Brack), + xmlByteConsumed static buffer (Ben Maurer). + - improvement: speedup parsing comments and DTDs, dictionnary support for + hash tables, Schemas Identity constraints (Kasimier), streaming XPath + subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical + values handling (Kasimier), add xmlTextReaderByteConsumed (Aron + Stansvik), + - Documentation: Wiki support (Joel Reed) 2.6.17: Jan 16 2005: - - build fixes: Windows, warnings removal (William Brack), - maintainer-clean dependency(William), build in a different directory - (William), fixing --with-minimum configure build (William), BeOS - build (Marcin Konicki), Python-2.4 detection (William), compilation - on AIX (Dan McNichol) + - build fixes: Windows, warnings removal (William Brack), + maintainer-clean dependency(William), build in a different directory + (William), fixing --with-minimum configure build (William), BeOS build + (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan + McNichol) - bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile() - to use the catalog(s), loop on output (William Brack), XPath memory leak, - ID deallocation problem (Steve Shepard), debugDumpNode crash (William), - warning not using error callback (William), xmlStopParser bug (William), - UTF-16 with BOM on DTDs (William), namespace bug on empty elements - in push mode (Rob Richards), line and col computations fixups (Aleksey - Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), - patterns with too many steps, bug in RNG choice optimization, line - number sometimes missing. - - - improvements: XSD Schemas (Kasimier Buchcik), python generator (William), - xmlUTF8Strpos speedup (William), unicode Python strings (William), - XSD error reports (Kasimier Buchcik), Python __str__ call serialize(). - - - new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber - for the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs - (mostly Joel Reed), error extraction API from regexps, new XMLSave - option for format (Phil Shafer) - - documentation: site improvement (John Fleck), FAQ entries (William). + to use the catalog(s), loop on output (William Brack), XPath memory leak, + ID deallocation problem (Steve Shepard), debugDumpNode crash (William), + warning not using error callback (William), xmlStopParser bug (William), + UTF-16 with BOM on DTDs (William), namespace bug on empty elements in + push mode (Rob Richards), line and col computations fixups (Aleksey + Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), + patterns with too many steps, bug in RNG choice optimization, line number + sometimes missing. + - improvements: XSD Schemas (Kasimier Buchcik), python generator + (William), xmlUTF8Strpos speedup (William), unicode Python strings + (William), XSD error reports (Kasimier Buchcik), Python __str__ call + serialize(). + - new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for + the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel + Reed), error extraction API from regexps, new XMLSave option for format + (Phil Shafer) + - documentation: site improvement (John Fleck), FAQ entries + (William). 2.6.16: Nov 10 2004: @@ -197,7 +237,7 @@ http://cvs.gnome.org/viewcvs/libxml2/ - documentation: fix to xmllint man page, some API function descritpion were updated. - improvements: DTD validation APIs provided at the Python level (Brent - Hendricks) + Hendricks) 2.6.15: Oct 27 2004: diff --git a/SAX2.c b/SAX2.c index 9f7edf6..17425e7 100644 --- a/SAX2.c +++ b/SAX2.c @@ -2233,9 +2233,13 @@ xmlSAX2StartElementNs(void *ctx, */ if ((URI != NULL) && (ret->ns == NULL)) { ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix); + if ((ret->ns == NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) { + ret->ns = xmlSearchNs(ctxt->myDoc, ret, prefix); + } if (ret->ns == NULL) { ns = xmlNewNs(ret, NULL, prefix); if (ns == NULL) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; } diff --git a/c14n.c b/c14n.c index 32c7004..33a5803 100644 --- a/c14n.c +++ b/c14n.c @@ -802,7 +802,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) if(xmlStrlen(attr->ns->prefix) == 0) { has_empty_ns = 1; } - } else if(attr->ns == NULL) { + } else if((attr->ns != NULL) && (xmlStrlen(attr->ns->prefix) == 0) && (xmlStrlen(attr->ns->href) == 0)) { has_visibly_utilized_empty_ns = 1; } } diff --git a/config.h.in b/config.h.in index 8484193..1dafc10 100644 --- a/config.h.in +++ b/config.h.in @@ -97,24 +97,12 @@ /* Define if history library is there (-lhistory) */ #undef HAVE_LIBHISTORY -/* Define to 1 if you have the `inet' library (-linet). */ -#undef HAVE_LIBINET - -/* Define to 1 if you have the `net' library (-lnet). */ -#undef HAVE_LIBNET - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - /* Define if pthread library is there (-lpthread) */ #undef HAVE_LIBPTHREAD /* Define if readline library is there (-lreadline) */ #undef HAVE_LIBREADLINE -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - /* Have compression library */ #undef HAVE_LIBZ @@ -237,6 +225,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Whether va_copy() is available */ +#undef HAVE_VA_COPY + /* Define to 1 if you have the `vfprintf' function. */ #undef HAVE_VFPRINTF @@ -252,6 +243,9 @@ /* Define to 1 if you have the `_stat' function. */ #undef HAVE__STAT +/* Whether __va_copy() is available */ +#undef HAVE___VA_COPY + /* Name of package */ #undef PACKAGE diff --git a/configure b/configure index ac6e4bb..ad70461 100755 --- a/configure +++ b/configure @@ -1618,7 +1618,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=22 +LIBXML_MICRO_VERSION=23 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -19934,8 +19934,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# AM_MAINTAINER_MODE _cppflags="${CPPFLAGS}" @@ -26028,58 +26026,20 @@ fi done -echo "$as_me:$LINENO: checking for gethostent" >&5 -echo $ECHO_N "checking for gethostent... $ECHO_C" >&6 -if test "${ac_cv_func_gethostent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for va_copy" >&5 +echo $ECHO_N "checking for va_copy... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define gethostent to an innocuous variant, in case declares gethostent. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostent innocuous_gethostent - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostent (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostent - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostent (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_gethostent) || defined (__stub___gethostent) -choke me -#else -char (*f) () = gethostent; -#endif -#ifdef __cplusplus -} -#endif - +#include +va_list ap1,ap2; int main () { -return f != gethostent; +va_copy(ap1,ap2); ; return 0; } @@ -26106,47 +26066,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_gethostent=yes + have_va_copy=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_gethostent=no +have_va_copy=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostent" >&5 -echo "${ECHO_T}$ac_cv_func_gethostent" >&6 -if test $ac_cv_func_gethostent = yes; then - : -else +echo "$as_me:$LINENO: result: $have_va_copy" >&5 +echo "${ECHO_T}$have_va_copy" >&6 +if test x"$have_va_copy" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_VA_COPY 1 +_ACEOF -echo "$as_me:$LINENO: checking for gethostent in -lnsl" >&5 -echo $ECHO_N "checking for gethostent in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_gethostent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: checking for __va_copy" >&5 +echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostent (); +#include + va_list ap1,ap2; int main () { -gethostent (); +__va_copy(ap1,ap2); ; return 0; } @@ -26173,82 +26124,51 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_nsl_gethostent=yes + have___va_copy=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_nsl_gethostent=no +have___va_copy=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostent" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6 -if test $ac_cv_lib_nsl_gethostent = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNSL 1 -_ACEOF - - LIBS="-lnsl $LIBS" + echo "$as_me:$LINENO: result: $have___va_copy" >&5 +echo "${ECHO_T}$have___va_copy" >&6 + if test x"$have___va_copy" = x"yes"; then -fi +cat >>confdefs.h <<\_ACEOF +#define HAVE___VA_COPY 1 +_ACEOF + fi fi -echo "$as_me:$LINENO: checking for setsockopt" >&5 -echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 -if test "${ac_cv_func_setsockopt+set}" = set; then +echo "$as_me:$LINENO: checking for library containing gethostent" >&5 +echo $ECHO_N "checking for library containing gethostent... $ECHO_C" >&6 +if test "${ac_cv_search_gethostent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_gethostent=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define setsockopt to an innocuous variant, in case declares setsockopt. - For example, HP-UX 11i declares gettimeofday. */ -#define setsockopt innocuous_setsockopt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char setsockopt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef setsockopt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char setsockopt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_setsockopt) || defined (__stub___setsockopt) -choke me -#else -char (*f) () = setsockopt; -#endif -#ifdef __cplusplus -} -#endif - +char gethostent (); int main () { -return f != setsockopt; +gethostent (); ; return 0; } @@ -26275,30 +26195,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_setsockopt=yes + ac_cv_search_gethostent="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 -if test $ac_cv_func_setsockopt = yes; then - : -else - -echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 -echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_setsockopt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_gethostent" = no; then + for ac_lib in nsl; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -26311,11 +26219,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char setsockopt (); +char gethostent (); int main () { -setsockopt (); +gethostent (); ; return 0; } @@ -26342,82 +26250,51 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_socket_setsockopt=yes + ac_cv_search_gethostent="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_socket_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + done fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 -if test $ac_cv_lib_socket_setsockopt = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSOCKET 1 -_ACEOF - - LIBS="-lsocket $LIBS" - +LIBS=$ac_func_search_save_LIBS fi +echo "$as_me:$LINENO: result: $ac_cv_search_gethostent" >&5 +echo "${ECHO_T}$ac_cv_search_gethostent" >&6 +if test "$ac_cv_search_gethostent" != no; then + test "$ac_cv_search_gethostent" = "none required" || LIBS="$ac_cv_search_gethostent $LIBS" fi -echo "$as_me:$LINENO: checking for setsockopt" >&5 -echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 -if test "${ac_cv_func_setsockopt+set}" = set; then +echo "$as_me:$LINENO: checking for library containing setsockopt" >&5 +echo $ECHO_N "checking for library containing setsockopt... $ECHO_C" >&6 +if test "${ac_cv_search_setsockopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_setsockopt=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define setsockopt to an innocuous variant, in case declares setsockopt. - For example, HP-UX 11i declares gettimeofday. */ -#define setsockopt innocuous_setsockopt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char setsockopt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef setsockopt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char setsockopt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_setsockopt) || defined (__stub___setsockopt) -choke me -#else -char (*f) () = setsockopt; -#endif -#ifdef __cplusplus -} -#endif - int main () { -return f != setsockopt; +setsockopt (); ; return 0; } @@ -26444,30 +26321,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_setsockopt=yes + ac_cv_search_setsockopt="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 -if test $ac_cv_func_setsockopt = yes; then - : -else - -echo "$as_me:$LINENO: checking for setsockopt in -lnet" >&5 -echo $ECHO_N "checking for setsockopt in -lnet... $ECHO_C" >&6 -if test "${ac_cv_lib_net_setsockopt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnet $LIBS" -cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_setsockopt" = no; then + for ac_lib in socket net; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -26511,82 +26376,51 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_net_setsockopt=yes + ac_cv_search_setsockopt="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_net_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + done fi -echo "$as_me:$LINENO: result: $ac_cv_lib_net_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_lib_net_setsockopt" >&6 -if test $ac_cv_lib_net_setsockopt = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNET 1 -_ACEOF - - LIBS="-lnet $LIBS" - +LIBS=$ac_func_search_save_LIBS fi +echo "$as_me:$LINENO: result: $ac_cv_search_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_search_setsockopt" >&6 +if test "$ac_cv_search_setsockopt" != no; then + test "$ac_cv_search_setsockopt" = "none required" || LIBS="$ac_cv_search_setsockopt $LIBS" fi -echo "$as_me:$LINENO: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6 -if test "${ac_cv_func_connect+set}" = set; then +echo "$as_me:$LINENO: checking for library containing connect" >&5 +echo $ECHO_N "checking for library containing connect... $ECHO_C" >&6 +if test "${ac_cv_search_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_connect=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define connect to an innocuous variant, in case declares connect. - For example, HP-UX 11i declares gettimeofday. */ -#define connect innocuous_connect - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_connect) || defined (__stub___connect) -choke me -#else -char (*f) () = connect; -#endif -#ifdef __cplusplus -} -#endif - int main () { -return f != connect; +connect (); ; return 0; } @@ -26613,30 +26447,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_connect=yes + ac_cv_search_connect="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6 -if test $ac_cv_func_connect = yes; then - : -else - -echo "$as_me:$LINENO: checking for connect in -linet" >&5 -echo $ECHO_N "checking for connect in -linet... $ECHO_C" >&6 -if test "${ac_cv_lib_inet_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-linet $LIBS" -cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_connect" = no; then + for ac_lib in inet; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -26680,27 +26502,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_inet_connect=yes + ac_cv_search_connect="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_inet_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + done fi -echo "$as_me:$LINENO: result: $ac_cv_lib_inet_connect" >&5 -echo "${ECHO_T}$ac_cv_lib_inet_connect" >&6 -if test $ac_cv_lib_inet_connect = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBINET 1 -_ACEOF - - LIBS="-linet $LIBS" - +LIBS=$ac_func_search_save_LIBS fi +echo "$as_me:$LINENO: result: $ac_cv_search_connect" >&5 +echo "${ECHO_T}$ac_cv_search_connect" >&6 +if test "$ac_cv_search_connect" != no; then + test "$ac_cv_search_connect" = "none required" || LIBS="$ac_cv_search_connect $LIBS" fi @@ -26708,7 +26526,7 @@ fi echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5 echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6 cat > conftest.$ac_ext < @@ -26719,7 +26537,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: socklen_t *" >&5 @@ -26731,7 +26549,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26742,7 +26560,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: size_t *" >&5 @@ -26754,7 +26572,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26765,7 +26583,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (int *)NULL) ; return 0; } EOF -if { (eval echo configure:26768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26586: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: int *" >&5 @@ -27529,7 +27347,7 @@ RDL_LIBS="" if test "${GCC}" != "yes" ; then case "${host}" in - *-*-hpux* ) + hppa*-*-hpux* ) CFLAGS="${CFLAGS} -Wp,-H30000" ;; *-dec-osf* ) @@ -27777,8 +27595,101 @@ fi ;; *) - MODULE_EXTENSION=".so" - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + libxml_have_shl_load=yes +else + + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -27844,18 +27755,105 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then - WITH_MODULES=1 - MODULE_PLATFORM_LIBS="-ldld" + MODULE_PLATFORM_LIBS="-ldld" + libxml_have_shl_load=yes +else -cat >>confdefs.h <<\_ACEOF -#define HAVE_SHLLOAD + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -fi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef dlopen - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + libxml_have_dlopen=yes +else + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -27921,16 +27919,44 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then + MODULE_PLATFORM_LIBS="-ldl" + libxml_have_dlopen=yes +fi + +fi + +fi + +fi + + + if test "${libxml_have_shl_load}" = "yes"; then + MODULE_EXTENSION=".sl" WITH_MODULES=1 - MODULE_PLATFORM_LIBS="-ldl" cat >>confdefs.h <<\_ACEOF -#define HAVE_DLOPEN +#define HAVE_SHLLOAD _ACEOF + fi -fi + if test "${libxml_have_dlopen}" = "yes"; then + case "${host}" in + *-*-hpux* ) + MODULE_EXTENSION=".sl" + ;; + * ) + MODULE_EXTENSION=".so" + ;; + esac + WITH_MODULES=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DLOPEN +_ACEOF + + fi ;; esac fi @@ -31039,3 +31065,4 @@ fi chmod +x xml2-config python/setup.py +echo Done configuring diff --git a/configure.in b/configure.in index 6119d61..253b63a 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=22 +LIBXML_MICRO_VERSION=23 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -50,8 +50,6 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant) AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL -# AM_MAINTAINER_MODE - dnl dnl We process the AC_ARG_WITH first so that later we can modify dnl some of them to try to prevent impossible combinations. This @@ -432,11 +430,31 @@ dnl Checking the standard string functions availability AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,, NEED_TRIO=1) +dnl Checking for va_copy availability +AC_MSG_CHECKING([for va_copy]) +AC_TRY_LINK([#include +va_list ap1,ap2;], [va_copy(ap1,ap2);], +have_va_copy=yes, +have_va_copy=no) +AC_MSG_RESULT($have_va_copy) +if test x"$have_va_copy" = x"yes"; then + AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) +else + AC_MSG_CHECKING([for __va_copy]) + AC_TRY_LINK([#include + va_list ap1,ap2;], [__va_copy(ap1,ap2);], + have___va_copy=yes, + have___va_copy=no) + AC_MSG_RESULT($have___va_copy) + if test x"$have___va_copy" = x"yes"; then + AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) + fi +fi + dnl Checks for inet libraries: -AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) -AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) -AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(net, setsockopt)) -AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect)) +AC_SEARCH_LIBS(gethostent, [nsl]) +AC_SEARCH_LIBS(setsockopt, [socket net]) +AC_SEARCH_LIBS(connect, [inet]) dnl Determine what socket length (socklen_t) data type is AC_MSG_CHECKING([for type of socket length (socklen_t)]) @@ -569,7 +587,7 @@ dnl DEC : Enable NaN/Inf dnl if test "${GCC}" != "yes" ; then case "${host}" in - *-*-hpux* ) + hppa*-*-hpux* ) CFLAGS="${CFLAGS} -Wp,-H30000" ;; *-dec-osf* ) @@ -703,18 +721,34 @@ if test "$with_modules" != "no" ; then ]) ;; *) - MODULE_EXTENSION=".so" - AC_CHECK_LIB(dld, shl_load, [ + AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [ + AC_CHECK_LIB(dld, shl_load, [ + MODULE_PLATFORM_LIBS="-ldld" + libxml_have_shl_load=yes], [ + AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [ + AC_CHECK_LIB(dl, dlopen, [ + MODULE_PLATFORM_LIBS="-ldl" + libxml_have_dlopen=yes])])])]) + + if test "${libxml_have_shl_load}" = "yes"; then + MODULE_EXTENSION=".sl" WITH_MODULES=1 - MODULE_PLATFORM_LIBS="-ldld" AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso]) - ]) + fi - AC_CHECK_LIB(dl, dlopen, [ + if test "${libxml_have_dlopen}" = "yes"; then + case "${host}" in + *-*-hpux* ) + MODULE_EXTENSION=".sl" + ;; + * ) + MODULE_EXTENSION=".so" + ;; + esac + WITH_MODULES=1 - MODULE_PLATFORM_LIBS="-ldl" AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) - ]) + fi ;; esac fi @@ -1320,3 +1354,4 @@ ln -s Copyright COPYING AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py) chmod +x xml2-config python/setup.py +echo Done configuring diff --git a/doc/APIchunk0.html b/doc/APIchunk0.html index 36b401b..7763664 100644 --- a/doc/APIchunk0.html +++ b/doc/APIchunk0.html @@ -73,7 +73,9 @@ A:link, A:visited, A:active { text-decoration: underline }
Activation
xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
+
Actually
XML_SCHEMAS_TYPE_VARIETY_ABSENT
Add
xmlACatalogAdd
xmlAddChild
xmlAddChildList
@@ -96,7 +98,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCleanupGlobals
xmlInitGlobals
AegeanNumbers
xmlUCSIsAegeanNumbers
-
All
xmlNanoFTPGet
+
All
_xmlSchema
+_xmlSchemaType
+xmlNanoFTPGet
xmlNanoFTPList
xmlParseAttValue
xmlTextWriterEndDocument
@@ -203,6 +207,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseInNodeContext
xmlSAXParseEntity
Base
_xmlParserInput
+_xmlSchemaType
xmlNodeGetBase
BaseChar
IS_BASECHAR
IS_LETTER
@@ -230,6 +235,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Both
XML_SUBSTITUTE_BOTH
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
BoxDrawing
xmlUCSIsBoxDrawing
BraillePatterns
xmlUCSIsBraillePatterns
Brzozowski
xmlExpExpDerive
diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html index 668482d..2736de5 100644 --- a/doc/APIchunk1.html +++ b/doc/APIchunk1.html @@ -301,6 +301,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
Correct
xmlSetCompressMode
xmlSetDocCompressMode
+
Could
_xmlSchemaType
Count
xmlLsCountNode
Creates
htmlNewDoc
htmlNewDocNoDtD
diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index 74cea54..c397308 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -55,6 +55,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlShellDir
xmlTextWriterWriteRawLen
above
xmlParseMarkupDecl
+xmlStreamWantsAnyNode
xmlXPathSubstringFunction
absent
XML_SCHEMAS_ELEM_BLOCK_ABSENT
XML_SCHEMAS_ELEM_BLOCK_EXTENSION
@@ -106,6 +107,7 @@ A:link, A:visited, A:active { text-decoration: underline }
account
xmlSchemaValidateFacetWhtsp
act
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
activate
xmlTextReaderSetParserProp
activated
DEBUG_MEMORY
xmlAutomataNewAllTrans
@@ -119,6 +121,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
activation
xmlGetLineNo
acts
xmlGetProp
@@ -162,6 +165,7 @@ A:link, A:visited, A:active { text-decoration: underline } attributeSAXFunc
htmlDocContentDumpFormatOutput
htmlDocContentDumpOutput
+htmlDocDumpMemoryFormat
htmlNodeDump
htmlNodeDumpFile
htmlNodeDumpFileFormat
@@ -196,6 +200,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathSubstringFunction
additional
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
+
additionally
xmlStreamWantsAnyNode
address
xmlModuleSymbol
xmlNewTextWriterDoc
adds
xmlAutomataNewAllTrans
@@ -362,6 +367,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoFTPProxy
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlTextReaderPreserve
xmlTextReaderPreservePattern
xmlXPathStringEvalNumber
@@ -415,7 +421,6 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_ANYATTR_SKIP
XML_SCHEMAS_ANYATTR_STRICT
XML_SCHEMAS_ELEM_NSDEFAULT
-_xmlSchema
xmlNamespaceParseNCName
xmlNamespaceParseNSDef
xmlNamespaceParseQName
@@ -525,11 +530,16 @@ A:link, A:visited, A:active { text-decoration: underline }
atomic
xmlGcMemGet
xmlGcMemSetup
attached
xmlTextReaderGetRemainder
-
attr
XML_SCHEMAS_ATTRGROUP_MARKED
+
attr
XML_SCHEMAS_ATTRGROUP_HAS_REFS
+XML_SCHEMAS_ATTRGROUP_MARKED
+XML_SCHEMAS_ATTRGROUP_REDEFINED
_xmlID
_xmlRef
+
attribute-
xmlStreamPushNode
attribute-list
xmlParseDefaultDecl
xmlParseEntityRef
+
attribute-node
xmlStreamPushAttr
+
attribute-nodes
xmlStreamWantsAnyNode
attributeFormDefault
XML_SCHEMAS_QUALIF_ATTR
augmented
docbParseDocument
htmlParseDocument
@@ -546,8 +556,11 @@ A:link, A:visited, A:active { text-decoration: underline }
autoclose
htmlAutoCloseTag
autoclosed
htmlIsAutoClosed
autogeneration
xmlKeepBlanksDefault
-
automatically
xmlCharEncOutFunc
+
automatically
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+xmlCharEncOutFunc
xmlNewTextChild
+xmlStrncatNew
+
automaton
_xmlSchemaType
autoreference
_xmlDoc
avoiding
xmlTextReaderNext
xmlTextReaderNextSibling
diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index 763623f..ce2a617 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -58,10 +58,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewStringInputStream
xmlRelaxNGNewValidCtxt
xmlSchemaNewStringValue
-xmlSchemaNewValidCtxt
-xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
-xmlSchemaValidateStream
xmlSchematronNewValidCtxt
xmlSetCompressMode
xmlSetDocCompressMode
@@ -96,6 +92,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetParserProp
xmlTextReaderSetSchema
xmlValidGetValidElements
@@ -194,7 +191,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseElementMixedContentDecl
bracket
xmlParseCharData
branch
xmlDOMWrapRemoveNode
-xmlSchemaValidateOneElement
break
_xmlError
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
@@ -210,6 +206,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAllocParserInputBuffer
xmlFreeParserInputBuffer
xmlOutputBufferClose
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -264,7 +261,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaParse
xmlSchematronParse
xmlTextReaderNextSibling
-
built-in
xmlSchemaGetBuiltInListSimpleTypeItemType
+
built-in
_xmlSchemaType
+xmlSchemaGetBuiltInListSimpleTypeItemType
xmlSchemaGetBuiltInType
xmlSchemaIsBuiltInTypeFacet
xmlSchemaValidateFacetWhtsp
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index 9d1944e..6db6d0d 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -37,7 +37,8 @@ A:link, A:visited, A:active { text-decoration: underline } w-w x-x y-z -

Letter c:

calculates
xmlUTF8Size
+

Letter c:

calculated
xmlStrncatNew
+
calculates
xmlUTF8Size
calling
_xmlXPathContext
xmlBuildRelativeURI
xmlC14NDocDumpMemory
@@ -51,7 +52,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathSubValues
xmlXPathValueFlipSign
calls
xlinkNodeDetectFunc
-xmlSchemaSAXPlug
xmlXPathAxisFunc
came
xmlPopInput
cannot
xmlParseAttribute
@@ -121,6 +121,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlLoadCatalogs
category
xmlUCSIsCat
cause
xmlShellPrintXPathError
+
cdata-section-
xmlStreamPushNode
+xmlStreamWantsAnyNode
ceiling
xmlXPathCeilingFunction
certainly
xmlTextReaderGetRemainder
chained
xmlFreeNsList
@@ -128,10 +130,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCtxtResetLastError
xmlNanoFTPCwd
xmlParseSDDecl
-xmlRelaxNGParse
xmlResetLastError
xmlSchemaCollapseString
-xmlSchemaParse
xmlSchemaWhiteSpaceReplace
xmlSubstituteEntitiesDefault
xmlSwitchEncoding
@@ -318,6 +318,7 @@ A:link, A:visited, A:active { text-decoration: underline }
combining
IS_COMBINING_CH
come
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
coment
xmlTextWriterEndComment
comes
xmlValidityErrorFunc
xmlValidityWarningFunc
@@ -341,6 +342,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextWriterWriteFormatComment
xmlTextWriterWriteVFormatComment
xmlXPathIsNodeType
+
comment-
xmlStreamPushNode
+xmlStreamWantsAnyNode
comments
xmlC14NDocDumpMemory
xmlC14NDocSave
xmlC14NDocSaveTo
@@ -415,6 +418,9 @@ A:link, A:visited, A:active { text-decoration: underline } LIBXML_SCHEMATRON_ENABLED
LIBXML_TEST_VERSION
LIBXML_UNICODE_ENABLED
+_xmlSchemaAttribute
+_xmlSchemaElement
+_xmlSchemaFacet
xmlAutomataCompile
xmlCheckVersion
xmlExpDump
@@ -451,6 +457,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNodeGetBase
complex
XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
+_xmlSchemaType
complexType
XML_SCHEMAS_TYPE_ABSTRACT
XML_SCHEMAS_TYPE_BLOCK_DEFAULT
XML_SCHEMAS_TYPE_BLOCK_EXTENSION
@@ -459,6 +466,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_FINAL_RESTRICTION
XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
complicated
xmlBuildRelativeURI
+
component
_xmlSchemaType
components
_xmlSchema
compound
xmlXPathFreeNodeSet
xmlXPtrFreeLocationSet
@@ -580,7 +588,9 @@ A:link, A:visited, A:active { text-decoration: underline }
consist
xmlXPathNextAncestor
constant
XML_SAX2_MAGIC
xmlByteConsumed
-
constraint
_xmlSchemaWildcard
+
constraint
_xmlSchemaAttribute
+_xmlSchemaElement
+_xmlSchemaWildcard
_xmlSchemaWildcardNs
xmlParseEntityRef
xmlValidateNotationDecl
@@ -644,7 +654,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrlen
xmlXPathDistinct
xmlXPathDistinctSorted
-
contains
xmlCurrentChar
+
contains
XML_SCHEMAS_ATTRGROUP_HAS_REFS
+xmlCurrentChar
xmlParseEntityRef
xmlParsePEReference
xmlParserHandlePEReference
@@ -693,6 +704,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetParserErrors
xmlSchemaSetParserErrors
continuing
xmlXPathSubstringFunction
+
contraint
_xmlSchemaElement
contrary
xmlNodeListGetRawString
xmlXPathFreeNodeSetList
control
_xmlXPathContext
@@ -743,6 +755,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathStringFunction
xmlXPathStringLengthFunction
converter
xmlAllocOutputBuffer
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -782,6 +795,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
xmlValidateDtd
count
ftpListCallback
@@ -807,7 +821,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCreateEnumeration
xmlNewCatalog
xmlNewDtd
-xmlNewGlobalNs
xmlNewNs
creates
xmlAutomataNewAllTrans
xmlAutomataNewCountTrans
@@ -850,7 +863,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMemGet
xmlMemUsed
xmlOutputBufferCreateFilename
-xmlSchemaValidateFile
custom
xmlDOMWrapAdoptNode
xmlSaveSetAttrEscape
xmlSaveSetEscape
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index a44fa80..d286a7a 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -44,6 +44,8 @@ A:link, A:visited, A:active { text-decoration: underline }
day:minute
ftpListCallback
de-coupled
xmlValidateDtd
deactivated
xmlTextReaderRelaxNGSetSchema
+xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
deallocate
_xmlParserInput
xmlCleanupParser
@@ -112,7 +114,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathDebugDumpObject
decimal
xmlXPathStringFunction
decl
XML_SCHEMAS_ELEM_INTERNAL_CHECKED
-_xmlSchemaAttribute
xmlAddAttributeDecl
xmlNewDocElementContent
xmlNewElementContent
@@ -212,6 +213,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2StartElementNs
xmlTextReaderPreservePattern
xmlValidateDtd
+
defs
_xmlSchema
+_xmlSchemaElement
delayed
xmlOutputBufferWrite
xmlOutputBufferWriteEscape
xmlOutputBufferWriteString
@@ -248,18 +251,17 @@ A:link, A:visited, A:active { text-decoration: underline } xmlExpStringDerive
des
xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
-xmlTextReaderSchemaValidate
xmlTextReaderSetSchema
desactivated
xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
-xmlTextReaderSchemaValidate
xmlTextReaderSetSchema
descendant
xmlXPathNextDescendant
descendant-or-self
xmlXPathNextDescendantOrSelf
descendants
xmlXPathNextDescendant
xmlXPathNextDescendantOrSelf
xmlXPathNextFollowing
-
described
xmlValidateAttributeDecl
+
described
xmlStreamWantsAnyNode
+xmlValidateAttributeDecl
xmlValidateDocument
xmlValidateDocumentFinal
xmlValidateDtdFinal
@@ -350,7 +352,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2EndElementNs
xmlSAX2Reference
xmlSAX2StartElementNs
-xmlSchemaIsValid
detection
docbCreatePushParserCtxt
xlinkExtendedLinkFunk
xlinkExtendedLinkSetFunk
@@ -378,6 +379,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPatterncompile
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
dictionnary
_xmlParserCtxt
_xmlXPathContext
xmlDictCreate
@@ -586,9 +588,7 @@ A:link, A:visited, A:active { text-decoration: underline }
duplicates
xmlSchemaCopyValue
duration
xmlSchemaGetCanonValue
during
xmlSAXDefaultVersion
-xmlSchemaIsValid
xmlSchemaNewDocParserCtxt
-xmlSchemaSetValidOptions
xmlSchematronNewDocParserCtxt
dynamic
LIBXML_MODULE_EXTENSION

A-B diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 5c7e274..c093285 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -70,9 +70,12 @@ A:link, A:visited, A:active { text-decoration: underline } resolveEntitySAXFunc
xmlSAX2ResolveEntity

elem
XML_SCHEMAS_ELEM_INTERNAL_CHECKED
-
element-
xmlXPathOrderDocElems
+
element-
xmlStreamPushNode
+xmlXPathOrderDocElems
element-node
xmlDOMWrapReconcileNamespaces
+xmlStreamPush
element-nodes
xmlDOMWrapReconcileNamespaces
+xmlStreamWantsAnyNode
elementFormDefault
XML_SCHEMAS_QUALIF_ELEM
elementdecl
xmlParseElementDecl
xmlParseMarkupDecl
@@ -256,6 +259,35 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathConvertBoolean
xmlXPathConvertNumber
xmlXPathConvertString
+
errors
INPUT_CHUNK
+_xmlSAXHandler
+_xmlSAXHandlerV1
+_xmlValidCtxt
+_xmlXPathContext
+fatalErrorSAXFunc
+initGenericErrorDefaultFunc
+xmlCharEncOutFunc
+xmlCheckHTTPInput
+xmlDOMWrapAdoptNode
+xmlDOMWrapReconcileNamespaces
+xmlDOMWrapRemoveNode
+xmlDebugCheckDocument
+xmlExpGetLanguage
+xmlExpGetStart
+xmlHashAddEntry
+xmlHashAddEntry2
+xmlHashAddEntry3
+xmlRelaxNGGetParserErrors
+xmlRelaxNGSetParserErrors
+xmlSchemaGetCanonValue
+xmlSchemaGetCanonValueWhtsp
+xmlSchemaGetParserErrors
+xmlSchemaSetParserErrors
+xmlSchemaValueAppend
+xmlSchemaValueGetAsString
+xmlSchemaValueGetNext
+xmlShellCmd
+xmlStreamWantsAnyNode
errror
xmlDOMWrapNewCtxt
escape
docbEncodeEntities
htmlEncodeEntities
@@ -277,7 +309,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveSetEscape
especially
xmlExpParse
established
xmlNanoFTPUpdateURL
-
etc
xmlDocGetRootElement
+
etc
_xmlSchemaFacet
+xmlDocGetRootElement
xmlDocSetRootElement
xmlParseInNodeContext
evaluate
xmlXPathEvalExpr
@@ -309,11 +342,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseBalancedChunkMemoryRecover
xmlTextWriterFullEndElement
xmlXPathRoundFunction
-
event
xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
-xmlSchemaValidateStream
events
htmlSAXParseDoc
-xmlSchemaValidateStream
ever
xmlExpCtxtNbCons
everywhere
xmlSAXParseFileWithData
xmlSAXParseMemoryWithData
@@ -375,6 +404,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchematronNewParserCtxt
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
experimental
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index da7f8f7..c6452a2 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -55,6 +55,7 @@ A:link, A:visited, A:active { text-decoration: underline }
facets
XML_SCHEMAS_TYPE_FACETSNEEDVALUE
XML_SCHEMAS_TYPE_HAS_FACETS
XML_SCHEMAS_TYPE_NORMVALUENEEDED
+_xmlSchemaType
xmlSchemaCheckFacet
facility
xmlExpCtxtNbCons
xmlExpCtxtNbNodes
@@ -102,7 +103,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXParseMemoryWithData
far
_xmlParserCtxt
fatalErrorSAXFunc
-xmlSchemaIsValid
fashion
xmlNewRMutex
fast
htmlInitAutoClose
faster
htmlNodeStatus
@@ -118,6 +118,8 @@ A:link, A:visited, A:active { text-decoration: underline }
fed
xmlCreatePushParserCtxt
xmlNewTextReader
xmlNewTextReaderFilename
+xmlStreamPushNode
+xmlStreamWantsAnyNode
fetch
xmlNanoFTPGetSocket
xmlNanoFTPOpen
xmlNanoHTTPFetch
@@ -202,7 +204,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderIsValid
flagged
_htmlElemDesc
htmlGetMetaEncoding
-
flags
_xmlXPathContext
+
flags
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+_xmlXPathContext
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
xmlPatterncompile
@@ -222,9 +225,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenGetNodeList
floor
xmlXPathFloorFunction
flow
xmlScanName
-xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
-xmlSchemaValidateStream
flushes
xmlOutputBufferClose
xmlOutputBufferFlush
follow
xmlAutomataNewNegTrans
@@ -285,6 +285,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextWriterWriteVFormatRaw
xmlTextWriterWriteVFormatString
formatting
htmlDocContentDumpFormatOutput
+htmlDocDumpMemoryFormat
htmlNodeDump
htmlNodeDumpFile
htmlNodeDumpFileFormat
@@ -307,7 +308,6 @@ A:link, A:visited, A:active { text-decoration: underline } htmlSAXParseFile
xmlParseCtxtExternalEntity
xmlParseExternalEntity
-
forward
xmlSchemaValidateStream
fptr
XML_CAST_FPTR
fragment
_xmlURI
xmlNewDocFragment
@@ -381,10 +381,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
xmlRelaxNGSetValidStructuredErrors
-xmlSchemaGetValidErrors
xmlSchemaSetParserErrors
-xmlSchemaSetValidErrors
-xmlSchemaSetValidStructuredErrors
+xmlSchemaSetParserStructuredErrors
xmlShellCmd
xmlSwitchEncoding
xmlSwitchInputEncoding
@@ -396,7 +394,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidCtxtNormalizeAttributeValue
xmlValidNormalizeAttributeValue
xmlXIncludeSetFlags
-
future
xmlSchemaValidateFile

A-B C-C D-E diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html index d04b049..dcc30f1 100644 --- a/doc/APIchunk16.html +++ b/doc/APIchunk16.html @@ -161,12 +161,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathFloorFunction
xmlXPathSubstringFunction

greater-than
xmlNewTextChild
-
group
XML_SCHEMAS_ATTRGROUP_MARKED
+
group
XML_SCHEMAS_ATTRGROUP_HAS_REFS
+XML_SCHEMAS_ATTRGROUP_MARKED
+XML_SCHEMAS_ATTRGROUP_REDEFINED
XML_SCHEMAS_ELEM_FINAL_ABSENT
XML_SCHEMAS_ELEM_FINAL_EXTENSION
XML_SCHEMAS_ELEM_FINAL_RESTRICTION
XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD
-_xmlSchemaAttribute
_xmlSchemaAttributeGroup
_xmlSchemaElement
ftpListCallback
@@ -275,8 +276,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetBuiltInListSimpleTypeItemType
highly
htmlParseElement
xmlParseElement
-xmlRelaxNGParse
-xmlSchemaParse
hold
xmlDOMWrapReconcileNamespaces
xmlNewTextWriterDoc
xmlNewTextWriterPushParser
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index 22d1024..eabec9f 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -40,6 +40,8 @@ A:link, A:visited, A:active { text-decoration: underline }

Letter i:

iconv
LIBXML_ICONV_ENABLED
LIBXML_ISO8859X_ENABLED
identify
xmlParseAttributeType
+
identity-constraint
_xmlSchema
+_xmlSchemaElement
ignorable
ignorableWhitespace
ignorableWhitespaceSAXFunc
xmlIsBlankNode
@@ -130,6 +132,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoFTPList
xmlNanoHTTPFetch
xmlNanoHTTPSave
+
incl
_xmlSchemaType
include
XINCLUDE_NODE
xmlC14NDocDumpMemory
xmlC14NDocSave
@@ -217,6 +220,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoHTTPOpenRedir
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
indicates
XML_SCHEMAS_TYPE_FACETSNEEDVALUE
XML_SCHEMAS_TYPE_INTERNAL_INVALID
XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
@@ -288,7 +292,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewTextReader
xmlRelaxNGGetParserErrors
xmlSchemaGetParserErrors
-xmlSchemaValidateStream
xmlTextReaderByteConsumed
xmlXPathOrderDocElems
informations
_xmlAttr
@@ -313,13 +316,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxParserSetFlag
xmlSAX2EndElementNs
xmlSAX2StartElementNs
-xmlSchemaGetValidErrors
-xmlSchemaSetValidErrors
xmlShellDir
xmlXIncludeProcessNode
informative
_xmlError
infos
_xmlParserCtxt
inherited
_xmlParserCtxt
+_xmlSchemaType
xmlEntityReferenceFunc
xmlNodeGetSpacePreserve
xmlXPathNextAttribute
@@ -327,6 +329,7 @@ A:link, A:visited, A:active { text-decoration: underline }
inherits
xmlNewChild
xmlNewTextChild
initial
_xmlDoc
+_xmlSchemaAttribute
xmlAutomataGetInitState
xmlBufferCreateSize
xmlInitNodeInfoSeq
@@ -442,8 +445,6 @@ A:link, A:visited, A:active { text-decoration: underline } htmlParseDocument
xmlParseDocument
xmlParseReference
-xmlRelaxNGParse
-xmlSchemaParse
xmlTextReaderCurrentDoc
xmlTextReaderCurrentNode
interfaces
LIBXML_AUTOMATA_ENABLED
@@ -463,7 +464,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGNewDocParserCtxt
xmlRemoveID
xmlRemoveRef
-xmlSchemaValidateFile
interned
xmlPatterncompile
xmlTextReaderConstString
interning
xmlCopyNodeList
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index 8bc0157..51e8c2a 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -73,8 +73,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathOrderDocElems
keyword
xmlParseDefaultDecl
kill
xmlCheckVersion
-
kind
_xmlSchemaAttribute
-_xmlSchemaAttributeGroup
+
kind
_xmlSchemaAttributeGroup
_xmlSchemaElement
_xmlSchemaFacet
_xmlSchemaNotation
@@ -134,8 +133,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRootNode
xmlSaveFileTo
xmlSaveFormatFileTo
-xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
leading
xmlParseAttValue
xmlParseElementChildrenContentDecl
xmlParseElementMixedContentDecl
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index cecaf32..c54ee8d 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -51,7 +51,6 @@ A:link, A:visited, A:active { text-decoration: underline }
main
xmlIsMainThread
maintained
xmlRemoveID
xmlRemoveRef
-xmlSchemaSAXPlug
major
xmlDecodeEntities
make
xmlCreateEntitiesTable
xmlNewNode
@@ -149,12 +148,14 @@ A:link, A:visited, A:active { text-decoration: underline } xmlExpMaxToken
xmlExpNewCtxt
xmlPatternMaxDepth
+
maybe
_xmlSchemaElement
mean
xmlPatternMinDepth
means
xmlExpNewRange
xmlSetGenericErrorFunc
xmlSetStructuredErrorFunc
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
mechanism
_xmlXPathContext
xmlStructuredErrorFunc
xmlXPathRegisterFuncLookup
@@ -177,6 +178,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextWriterWriteVFormatRaw
xmlTextWriterWriteVFormatString
xmlXPathStringFunction
+
member-types
_xmlSchemaType
memo
getSystemId
xmlSAX2GetSystemId
memorylist
xmlMemDisplay
@@ -259,7 +261,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXParseMemory
xmlSAXParseMemoryWithData
xmlSetCompressMode
-
model
xmlValidBuildContentModel
+
model
_xmlSchemaType
+xmlValidBuildContentModel
modified
xmlBufferCreateStatic
xmlNodeAddContent
xmlNodeAddContentLen
diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html index 9a0e7ab..85de2bb 100644 --- a/doc/APIchunk2.html +++ b/doc/APIchunk2.html @@ -133,15 +133,6 @@ A:link, A:visited, A:active { text-decoration: underline }
DefaultDecl
xmlParseAttributeListDecl
xmlParseDefaultDecl
Deletes
xmlListDelete
-
Deprecated
_xmlSchema
-htmlAttrAllowed
-xmlCleanupPredefinedEntities
-xmlCopyElementContent
-xmlFreeElementContent
-xmlInitializePredefinedEntities
-xmlNewElementContent
-xmlParseQuotedString
-xmlSprintfElementContent
Depth
_xmlParserCtxt
_xmlValidCtxt
Dereference
xmlExpFree
@@ -155,6 +146,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderIsNamespaceDecl
xmlTextReaderStandalone
Devanagari
xmlUCSIsDevanagari
+
Different
xmlStreamPushNode
Digit
IS_DIGIT
xmlNamespaceParseNCName
xmlParseName
diff --git a/doc/APIchunk20.html b/doc/APIchunk20.html index 01db33a..9d751f3 100644 --- a/doc/APIchunk20.html +++ b/doc/APIchunk20.html @@ -80,7 +80,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathLangFunction
nearly
xmlSAXParseFileWithData
xmlSAXParseMemoryWithData
-
necessary
_htmlElemDesc
+
necessary
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+_htmlElemDesc
xmlCheckUTF8
xmlDebugDumpString
need
WITH_TRIO
@@ -101,6 +102,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegExecErrInfo
xmlRegExecNextValues
xmlSchemaNewStringValue
+xmlStreamWantsAnyNode
xmlValidGetValidElements
xmlXPathNewContext
needed
_xmlParserCtxt
@@ -116,7 +118,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseElementChildrenContentDecl
xmlParseElementMixedContentDecl
xmlReconciliateNs
-xmlSchemaSAXPlug
xmlSetBufferAllocationScheme
xmlShellPwd
xmlStrncat
@@ -136,6 +137,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrstr
needs
xmlEntityReferenceFunc
xmlSchemaValidateFacetWhtsp
+xmlStreamWantsAnyNode
xmlXPathNodeSetFreeNs
negated
_xmlSchemaWildcard
negative
xmlC14NDocDumpMemory
@@ -215,7 +217,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsLetter
xmlSAX2InitDefaultSAXHandler
xmlXPathBooleanFunction
-
none
getNamespace
+
none
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+getNamespace
xmlDecodeEntities
xmlGetLastChild
xmlOutputBufferCreateFilename
@@ -265,7 +268,6 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlSchema
_xmlSchemaElement
xmlDecodeEntities
-xmlNewGlobalNs
xmlParserHandleReference
xmlScanName
ns-decls
xmlDOMWrapAdoptNode
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 6789f9d..13518b1 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -50,11 +50,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathMultValues
xmlXPathSubValues
obligated
xmlParseEntityRef
-
obsolete
_xmlSchemaAttribute
-xmlNormalizeWindowsPath
+
obsolete
xmlNormalizeWindowsPath
obsolete:
XML_SCHEMAS_ELEM_TOPLEVEL
occupied
xmlCanonicPath
-
occur
xmlParseComment
+
occur
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+xmlParseComment
xmlParseMarkupDecl
occured
xmlCtxtGetLastError
xmlDictCreate
@@ -152,6 +152,7 @@ A:link, A:visited, A:active { text-decoration: underline }
onto
xmlParserInputBufferGrow
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
opaque
_xmlSchema
_xmlURI
open
htmlCtxtReadFd
@@ -222,7 +223,6 @@ A:link, A:visited, A:active { text-decoration: underline }
option
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
xmlGetLineNo
-xmlSchemaValidCtxtGetOptions
optional
XML_SCHEMAS_ATTR_USE_OPTIONAL
docbCreatePushParserCtxt
htmlCreatePushParserCtxt
@@ -244,7 +244,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseMisc
xmlPatterncompile
xmlSchemaCheckFacet
-xmlSchemaValidateStream
xmlShellSave
xmlShellValidate
xmlURIUnescapeString
@@ -252,12 +251,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCtxtUseOptions
xmlDOMWrapRemoveNode
xmlModuleOpen
+xmlSaveToBuffer
xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
-xmlSchemaSetValidOptions
-xmlSchemaValidCtxtGetOptions
-xmlSchemaValidateFile
+xmlTextReaderSchemaValidateCtxt
ordered
xmlListAppend
xmlListInsert
xmlXPathNextAncestor
@@ -278,14 +276,14 @@ A:link, A:visited, A:active { text-decoration: underline }
oriented
xmlValidityErrorFunc
xmlValidityWarningFunc
origin
_xmlXPathContext
-
original
xmlCharEncodingInputFunc
+
original
_xmlSchemaElement
+_xmlSchemaFacet
+xmlCharEncodingInputFunc
xmlCopyError
xmlGetEncodingAlias
xmlListMerge
xmlParseEntityValue
xmlParseURIRaw
-xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
xmlShellSave
xmlStrcat
xmlStrncat
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index 42008e7..fdec580 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -81,8 +81,6 @@ A:link, A:visited, A:active { text-decoration: underline }
partial
xmlOutputBufferWrite
xmlOutputBufferWriteEscape
xmlOutputBufferWriteString
-
particle
_xmlSchemaAttribute
-_xmlSchemaElement
particular
_xmlNodeSet
pass
xmlCurrentChar
xmlRelaxParserSetFlag
@@ -137,7 +135,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPatternStreamable
xmlPatterncompile
xmlSchemaValidateFacetWhtsp
+xmlStreamWantsAnyNode
xmlTextReaderPreservePattern
+
patterns
_xmlSchemaFacet
pcdata
cdataBlock
cdataBlockSAXFunc
xmlSAX2CDataBlock
@@ -179,8 +179,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
xmlRegExecErrInfo
xmlRegExecNextValues
-xmlSchemaSAXPlug
-xmlSchemaSAXUnplug
xmlValidGetValidElements
points
_xmlChRangeGroup
pop
xmlPopInput
@@ -199,8 +197,36 @@ A:link, A:visited, A:active { text-decoration: underline }
positioned
xmlTextReaderReadString
positionned
xmlTextReaderReadAttributeValue
positions
xmlUTF8Strsub
-
possible
_xmlSchemaType
-xmlCopyNodeList
+
positive
UTF8ToHtml
+UTF8Toisolat1
+docbEncodeEntities
+htmlEncodeEntities
+isolat1ToUTF8
+xmlBufferAdd
+xmlBufferAddHead
+xmlBufferCCat
+xmlBufferCat
+xmlCharEncodingInputFunc
+xmlCharEncodingOutputFunc
+xmlRelaxNGValidateDoc
+xmlSchemaCheckFacet
+xmlSchemaValPredefTypeNode
+xmlSchemaValPredefTypeNodeNoNorm
+xmlSchemaValidateFacet
+xmlSchemaValidateFacetWhtsp
+xmlSchemaValidateLengthFacet
+xmlSchemaValidateLengthFacetWhtsp
+xmlSchemaValidateListSimpleTypeFacet
+xmlSchemaValidatePredefinedType
+xmlTextReaderPreservePattern
+xmlValidateNCName
+xmlValidateNMToken
+xmlValidateName
+xmlValidateQName
+xmlXPathBooleanFunction
+xmlXPathFloorFunction
+xmlXPathStringFunction
+
possible
xmlCopyNodeList
xmlCreateEntityParserCtxt
xmlParseDefaultDecl
xmlParseExternalID
@@ -210,6 +236,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
xmlValidateDtdFinal
possibly
xmlDocGetRootElement
@@ -249,7 +276,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPatternStreamable
xmlRegNewExecCtxt
xmlRelaxNGNewValidCtxt
-xmlSchemaNewValidCtxt
xmlSchematronNewValidCtxt
xmlTextReaderRelaxNGSetSchema
xmlTextReaderSetSchema
@@ -403,8 +429,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
processing-instruction
xmlXPathIsNodeType
+
processing-instruction-node
xmlStreamPushNode
+
processing-instruction-nodes
xmlStreamWantsAnyNode
processor
xmlCurrentChar
xmlParseAttValue
xmlParseEntityRef
@@ -425,6 +454,7 @@ A:link, A:visited, A:active { text-decoration: underline }
progresses
xmlRegNewExecCtxt
progressive
_xmlParserCtxt
xmlAllocParserInputBuffer
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -484,7 +514,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputMatchCallback
xmlSaveFormatFile
xmlSaveFormatFileEnc
-xmlSchemaValidateStream
xmlUTF8Strloc
xmlUTF8Strpos
provides
endElementNsSAX2Func
@@ -519,6 +548,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPop
xmlXPathEvalExpr
pushed
xmlRegExecErrInfo
+xmlStreamPushNode
+xmlStreamWantsAnyNode
xmlXPathFunction
pushing
xmlParsePEReference
put
xmlCatalogAdd
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html index d5a969d..b217f1c 100644 --- a/doc/APIchunk23.html +++ b/doc/APIchunk23.html @@ -116,8 +116,7 @@ A:link, A:visited, A:active { text-decoration: underline }
read-only
xmlDictCreateSub
readable
xmlStrEqual
reader-
xmlTextReaderGetRemainder
-
reading
xmlSchemaValidateStream
-xmlShell
+
reading
xmlShell
ready
INPUT_CHUNK
xmlAutomataCompile
realloc
_xmlBuffer
@@ -212,9 +211,9 @@ A:link, A:visited, A:active { text-decoration: underline }
recursively
xmlLoadACatalog
xmlParseAttValue
redeclared
xmlReconciliateNs
-
redef
_xmlSchemaAttributeGroup
+
redefined
XML_SCHEMAS_ATTRGROUP_REDEFINED
+XML_SCHEMAS_TYPE_REDEFINED
redefinition
xmlErrMemory
-
redefinitions
_xmlSchemaType
redir
xmlNanoHTTPMethodRedir
redirected
xmlNanoHTTPMethodRedir
xmlNanoHTTPOpenRedir
@@ -235,10 +234,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddRef
xmlFreeRefTable
xmlNewCharRef
-
referenced
_xmlSchemaAttributeGroup
-xmlLinkGetData
+
referenced
xmlLinkGetData
xmlParseAttValue
-
references
XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
+
references
XML_SCHEMAS_ATTRGROUP_HAS_REFS
+XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
XML_SCHEMAS_ELEM_CIRCULAR
XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
htmlParseEntityRef
@@ -268,6 +267,7 @@ A:link, A:visited, A:active { text-decoration: underline }
refs
_xmlDoc
_xmlParserCtxt
refuse
xmlNewNs
+
regex
_xmlSchemaFacet
regexp
_xmlElement
xmlAutomataCompile
xmlRegExecErrInfo
@@ -397,7 +397,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashUpdateEntry2
xmlHashUpdateEntry3
xmlNewTextChild
-xmlSchemaSAXPlug
xmlXPathTranslateFunction
replacement
xmlACatalogAdd
xmlCatalogAdd
@@ -474,6 +473,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSetStructuredErrorFunc
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
resides
xmlTextReaderConstXmlLang
xmlTextReaderXmlLang
resize
xmlBufferResize
@@ -504,7 +504,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGFreeParserCtxt
xmlRelaxNGFreeValidCtxt
xmlSchemaFreeParserCtxt
-xmlSchemaFreeValidCtxt
xmlSchematronFreeParserCtxt
xmlSchematronFreeValidCtxt
xmlTextReaderClose
@@ -516,8 +515,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoHTTPContentLength
responsible
xmlC14NDocDumpMemory
xmlCanonicPath
-
restored
xmlSchemaSAXUnplug
-xmlTextReaderSetErrorHandler
+
restored
xmlTextReaderSetErrorHandler
xmlTextReaderSetStructuredErrorHandler
restrict
xmlParseExternalID
restriction
XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
@@ -586,7 +584,6 @@ A:link, A:visited, A:active { text-decoration: underline } internalSubsetSAXFunc
xmlDocGetRootElement
xmlDocSetRootElement
-xmlNewGlobalNs
xmlParseDocTypeDecl
xmlParseNamespace
xmlPatternFromRoot
@@ -595,6 +592,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlShellPwd
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlValidateRoot
xmlXPathNewValueTree
xmlXPathRoot
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index ed6bc81..63d494b 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -80,6 +80,7 @@ A:link, A:visited, A:active { text-decoration: underline }
saving
LIBXML_OUTPUT_ENABLED
LIBXML_WRITER_ENABLED
xmlKeepBlanksDefault
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -89,6 +90,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveFlush
xmlSaveSetAttrEscape
xmlSaveSetEscape
+xmlSaveToBuffer
xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
@@ -124,13 +126,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetFacetValueAsULong
xmlSchemaGetValType
xmlSchemaNewMemParserCtxt
-xmlSchemaValidateDoc
xmlSchemaValidateFacet
xmlSchemaValidateFacetWhtsp
-xmlSchemaValidateFile
-xmlSchemaValidateStream
xmlSchematronNewMemParserCtxt
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
schematron
xmlSchematronValidateDoc
scheme
_xmlURI
xmlBufferSetAllocationScheme
@@ -186,8 +186,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateOneElement
xmlValidateOneNamespace
seq
xmlParseElementChildrenContentDecl
-
sequence
_xmlSchemaElement
-_xmlSchemaFacet
+
sequence
_xmlSchemaFacet
_xmlSchemaType
xmlCharEncOutFunc
xmlClearNodeInfoSeq
@@ -214,6 +213,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNormalizeFunction
sequqnce
xmlExpIsNillable
serialization
LIBXML_OUTPUT_ENABLED
+xmlSaveToBuffer
xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
@@ -221,7 +221,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlShellWrite
xmlValidatePopElement
xmlValidatePushElement
-
serializing
xmlSaveToFd
+
serializing
xmlSaveToBuffer
+xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
server
_xmlURI
@@ -327,6 +328,7 @@ A:link, A:visited, A:active { text-decoration: underline }
simple
XML_SCHEMAS_TYPE_ABSTRACT
XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
+_xmlSchemaType
xlinkSimpleLinkFunk
xmlAttrSerializeTxtContent
xmlFreeMutex
@@ -348,7 +350,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_VARIETY_UNION
simply
xmlSetGenericErrorFunc
xmlSetStructuredErrorFunc
-
since
xmlBuildRelativeURI
+
since
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+xmlBuildRelativeURI
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
xmlParseExternalID
@@ -438,6 +441,7 @@ A:link, A:visited, A:active { text-decoration: underline }
spaces
_xmlParserCtxt
htmlDocContentDumpFormatOutput
htmlDocContentDumpOutput
+htmlDocDumpMemoryFormat
htmlNodeDumpFileFormat
htmlNodeDumpFormatOutput
htmlNodeDumpOutput
@@ -555,7 +559,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewCharRef
xmlNewTextWriterTree
xmlSaveTree
-xmlSchemaValidateOneElement
xmlXPathOrderDocElems
xmlXPathSubstringFunction
xmlXPtrNewCollapsedRange
@@ -646,8 +649,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrdup
xmlStrdupFunc
streamable
xmlPatternStreamable
-xmlSchemaValidateFile
streaming
xmlPatternGetStreamCtxt
+xmlStreamWantsAnyNode
streams
_xmlParserCtxt
xmlSkipBlankChars
strict
XML_SCHEMAS_ANYATTR_STRICT
@@ -669,8 +672,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegExecErrInfo
xmlRegExecNextValues
xmlRegexpCompile
+xmlStrEqual
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlStrncatNew
stripping
xmlXPathNormalizeFunction
strncasecmp
xmlStrncasecmp
@@ -690,7 +695,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewQNameValue
xmlSchemaNewStringValue
structured
xmlRelaxNGSetValidStructuredErrors
-xmlSchemaSetValidStructuredErrors
+xmlSchemaSetParserStructuredErrors
xmlSetStructuredErrorFunc
structures
xmlFreeDoc
xmlFreeNs
@@ -715,8 +720,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlExpSubsume
subexpressions
xmlExpParse
subject
xmlParseSDDecl
-xmlRelaxNGParse
-xmlSchemaParse
sublanguage
xmlXPathLangFunction
submits
xmlRegisterHTTPPostCallbacks
subsequent
xmlIOHTTPOpenW
@@ -763,7 +766,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
xmlRelaxNGValidateFullElement
xmlSaveTree
-xmlSchemaValidateOneElement
xmlShellDu
xmlShellWrite
xmlTextReaderExpand
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index 98b46a8..594667e 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -101,6 +101,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNotEqualValues
tested
_xmlParserInput
testing
xmlRegexpCompile
+
text-
xmlStreamPushNode
+xmlStreamWantsAnyNode
text-node
xmlIsBlankNode
textDecl?
xmlParseExternalSubset
than
xmlCheckUTF8
@@ -166,6 +168,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashUpdateEntry3
xmlXPathSubstringFunction
xmlXPathTranslateFunction
+
this?
_xmlSchemaType
those
xmlCheckLanguageID
xmlKeepBlanksDefault
xmlParseSDDecl
@@ -400,15 +403,17 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPtrLocationSetMerge
xmlXPtrNewLocationSetNodes
two-character
xmlCurrentChar
-
typ
_xmlSchemaTypeLink
+
type:
xmlStreamPushNode
typefixed
XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
types
XML_SCHEMAS_FACET_COLLAPSE
+_xmlSchemaType
_xmlXPathContext
xmlExternalEntityLoader
xmlParseSDDecl
xmlSchemaGetCanonValue
xmlSchemaNewStringValue
xmlSchemaValidateFacetWhtsp
+xmlStreamWantsAnyNode
typo
xmlParseTextDecl

A-B C-C diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index 8a0befa..0f38063 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -68,6 +68,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_FINAL_UNION
XML_SCHEMAS_TYPE_VARIETY_ATOMIC
XML_SCHEMAS_TYPE_VARIETY_UNION
+_xmlSchemaType
xmlXPathIdFunction

unique
_xmlParserInput
_xmlSchema
@@ -117,7 +118,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseEntityRef
xmlParserHandleReference
xmlSAX2UnparsedEntityDecl
-
unplug
xmlSchemaSAXPlug
unpredictable
UTF8ToHtml
UTF8Toisolat1
docbEncodeEntities
@@ -150,7 +150,6 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlXPathContext
xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
-xmlSchemaValidateFile
xmlShellBase
xmlShellCat
xmlShellDir
@@ -182,6 +181,8 @@ A:link, A:visited, A:active { text-decoration: underline }
usage
xmlGetBufferAllocationScheme
xmlSetBufferAllocationScheme
used:
XML_DEFAULT_VERSION
+
used?
_xmlSchemaAttribute
+_xmlSchemaElement
useful
xmlGcMemGet
xmlGcMemSetup
xmlNewRMutex
diff --git a/doc/APIchunk27.html b/doc/APIchunk27.html index 2db1f05..a5257c9 100644 --- a/doc/APIchunk27.html +++ b/doc/APIchunk27.html @@ -63,9 +63,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetValidErrors
xmlSAX2InitDefaultSAXHandler
xmlSchemaGetParserErrors
-xmlSchemaGetValidErrors
xmlSchemaSetParserErrors
-xmlSchemaSetValidErrors
xmlSearchNs
xmlTextReaderSetErrorHandler
xmlTextReaderSetStructuredErrorHandler
@@ -115,7 +113,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCheckLanguageID
xmlKeepBlanksDefault
xmlMemShow
-xmlSchemaIsValid
xmlXIncludeProcess
xmlXIncludeProcessFlags
xmlXIncludeProcessNode
diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html index 232b492..8fb67a9 100644 --- a/doc/APIchunk28.html +++ b/doc/APIchunk28.html @@ -109,7 +109,9 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlBuffer
xmlCharEncFirstLine
xmlCharEncInFunc
xmlCharEncOutFunc
+xmlOutputBufferCreateBuffer
xmlBufferPtr
xmlNewTextWriterMemory
+xmlOutputBufferCreateBuffer
xmlBuildURI
xmlBuildRelativeURI
xmlBytesConsumed
xmlTextReaderByteConsumed
xmlCatalogAllow
xmlCatalogGetDefaults
@@ -339,6 +341,7 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlPatternGetStreamCtxt
xmlPatternStreamable
xmlPatterncompile
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlPopInput:
xmlPopInput
xmlPushInput:
xmlPushInput
xmlRFreeMutex
xmlFreeRMutex
@@ -385,22 +388,20 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlSAX2StartDocument
startDocument
xmlSAX2StartElement
startElement
xmlSAX2UnparsedEntityDecl
unparsedEntityDecl
-
xmlSAXHandlerPtr
xmlSchemaSAXPlug
xmlSAXVersion
xmlSAXDefaultVersion
-
xmlSaveOptions
xmlSaveToFd
+
xmlSaveOptions
xmlSaveToBuffer
+xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
-
xmlSchemaAttributeGroupPtr
_xmlSchemaAttributeGroup
-
xmlSchemaSAXPlug
xmlSchemaSAXUnplug
xmlSchemaValType
xmlSchemaGetValType
-
xmlSchemaValidOption
xmlSchemaSetValidOptions
xmlSchematronValidOptions
xmlSchematronNewValidCtxt
xmlSetExternalEntityLoader
resolveEntity
resolveEntitySAXFunc
xmlSAX2ResolveEntity
xmlSnprintfElementContent
xmlSprintfElementContent
-
xmlStrEqual
xmlStrEqual
+
xmlStrcmp
xmlStrEqual
xmlStrdup
xmlNewNode
+
xmlStreamPush
xmlStreamPushNode
xmlStringDecodeEntities
xmlDecodeEntities
xmlStringGetNodeList
xmlParseAttValue
xmlStrncat
xmlStrncatNew
diff --git a/doc/APIchunk29.html b/doc/APIchunk29.html index e9edd2c..3469fca 100644 --- a/doc/APIchunk29.html +++ b/doc/APIchunk29.html @@ -54,6 +54,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveTree
xmlSchemaGetCanonValue
xmlSchemaGetCanonValueWhtsp
+xmlTextReaderSchemaValidateCtxt
you
xmlNewDocNode
xmlNewDocNodeEatName
xmlNewTextChild
diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html index e2ac654..7d6d9e0 100644 --- a/doc/APIchunk3.html +++ b/doc/APIchunk3.html @@ -176,6 +176,7 @@ A:link, A:visited, A:active { text-decoration: underline }
HighSurrogates
xmlUCSIsHighSurrogates
Hiragana
xmlUCSIsHiragana
Hmm
xmlSchemaValueGetAsBoolean
+
Holds
_xmlSchemaType
How
_xmlParserInput
However
docbFreeParserCtxt
htmlFreeParserCtxt
diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html index 858dadd..01c825a 100644 --- a/doc/APIchunk4.html +++ b/doc/APIchunk4.html @@ -86,6 +86,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXParseDTD
Local
_xmlOutputBuffer
_xmlParserInputBuffer
+_xmlSchemaType
LocalPart
xmlNamespaceParseQName
xmlSplitQName
xmlSplitQName2
@@ -212,6 +213,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserHandlePEReference
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlTextReaderCurrentDoc
NRK
_htmlElemDesc
NSDef
xmlNamespaceParseNSDef
@@ -275,6 +277,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Non-static
xmlIOHTTPOpenW
Normalization
xmlNormalizeURIPath
Normalization:
xmlParseAttValue
+
Not
_xmlSchemaElement
NotaNumber
xmlXPathIsNaN
Notation
_xmlNotation
xmlParseEntityDecl
@@ -311,6 +314,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveFormatFile
xmlSaveFormatFileEnc
xmlSchemaValidateFacetWhtsp
+xmlStrncat
xmlTextReaderSetParserProp
xmlValidateDtd
Note:
fatalErrorSAXFunc
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index 31e1e79..f54bb37 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -45,12 +45,17 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegExecErrInfo
xmlRegExecNextValues
OUT:
htmlDocDumpMemory
+htmlDocDumpMemoryFormat
xmlDocDumpFormatMemory
xmlDocDumpMemory
Obsolete
XML_SCHEMAS_ANYATTR_LAX
XML_SCHEMAS_ANYATTR_SKIP
XML_SCHEMAS_ANYATTR_STRICT
XML_SCHEMAS_ELEM_NSDEFAULT
+_xmlSchema
+_xmlSchemaElement
+_xmlSchemaFacet
+_xmlSchemaType
Obtain
xmlTextReaderLocatorBaseURI
xmlTextReaderLocatorLineNumber
Ogham
xmlUCSIsOgham
@@ -65,6 +70,8 @@ A:link, A:visited, A:active { text-decoration: underline }
Optional
_htmlElemDesc
Oriya
xmlUCSIsOriya
Osmanya
xmlUCSIsOsmanya
+
Otherwise
xmlStreamPush
+xmlStreamPushAttr
Output
xmlOutputCloseCallback
xmlOutputMatchCallback
xmlOutputOpenCallback
@@ -145,7 +152,6 @@ A:link, A:visited, A:active { text-decoration: underline }
People
xmlEncodeEntities
PhoneticExtensions
xmlUCSIsPhoneticExtensions
Please
xmlNormalizeWindowsPath
-
Plug
xmlSchemaSAXPlug
Pointer
xmlCheckUTF8
Points
xmlXPtrNewRangePoints
Pop
xmlRelaxNGValidatePopElement
@@ -235,6 +241,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGValidatePushElement
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlValidatePushElement
Pushes
inputPush
namePush
diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index b6d4741..3f790bb 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -58,6 +58,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Qualified
xmlSplitQName3
Query
xmlDictSize
xmlHashSize
+xmlStreamWantsAnyNode
Question:
xmlParseTextDecl

Letter R:

REC
IS_BASECHAR
IS_COMBINING
@@ -88,6 +89,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
Reader
xmlTextReaderPreserve
xmlTextReaderPreservePattern
@@ -109,7 +111,6 @@ A:link, A:visited, A:active { text-decoration: underline }
Recurse
xmlSearchNsByHref
Recursion
xmlParsePEReference
xmlParserHandlePEReference
-
Redefinitions
_xmlSchemaAttributeGroup
Ref
_xmlRef
xmlAddRef
xmlFreeRefTable
@@ -170,7 +171,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetValidErrors
xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidateDoc
-
RelaxNG
xmlRelaxNGCleanupTypes
+
RelaxNG
_xmlSchemaElement
+xmlRelaxNGCleanupTypes
xmlRelaxNGDump
xmlRelaxNGDumpTree
xmlRelaxNGFree
@@ -182,7 +184,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxParserSetFlag
xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
-xmlTextReaderSchemaValidate
RelaxNGs
xmlRelaxNGNewDocParserCtxt
xmlRelaxNGNewMemParserCtxt
xmlRelaxNGNewParserCtxt
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html index 5c9847c..5b71d96 100644 --- a/doc/APIchunk7.html +++ b/doc/APIchunk7.html @@ -50,7 +50,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2InitDocbDefaultSAXHandler
xmlSAX2InitHtmlDefaultSAXHandler
xmlSAX2StartElementNs
-xmlSchemaValidateStream
SAX::substituteEntities
xmlSubstituteEntitiesDefault
SDDecl
xmlParseSDDecl
SDDecl?
xmlParseXMLDecl
@@ -107,6 +106,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetBuiltInListSimpleTypeItemType
xmlSchemaGetCanonValue
xmlSchemaParse
+xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
Schemas
LIBXML_SCHEMAS_ENABLED
xmlRegexpCompile
@@ -118,7 +119,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewDocParserCtxt
xmlSchemaNewMemParserCtxt
xmlSchemaNewParserCtxt
-xmlSchemaNewValidCtxt
Schematron
LIBXML_SCHEMATRON_ENABLED
xmlSchematronFree
xmlSchematronParse
@@ -168,7 +168,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlExpDump
Sets
htmlSetMetaEncoding
xmlBufferSetAllocationScheme
-xmlSchemaSetValidOptions
xmlXPathDifference
xmlXPathDistinct
xmlXPathDistinctSorted
diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index 0407e65..8c3b0a4 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -51,7 +51,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenGetNodeList
TODO
xmlParseElementChildrenContentDecl
xmlParseSDDecl
-
TODO:
htmlEntityLookup
+
TODO:
XML_SCHEMAS_TYPE_VARIETY_ABSENT
+htmlEntityLookup
htmlEntityValueLookup
htmlNodeDumpFileFormat
xmlDecodeEntities
@@ -161,7 +162,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateOneElement
xmlValidateOneNamespace
xmlValidateRoot
-
Type
xmlParseAttribute
+
Type
_xmlSchemaType
+xmlParseAttribute
xmlParseAttributeType
xmlParseDocTypeDecl
xmlParseElement
@@ -218,7 +220,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReplaceNode
xmlUnlinkNode
Unlinks
xmlDOMWrapRemoveNode
-
Unplug
xmlSchemaSAXUnplug
Unregisters
xmlCleanupEncodingAliases
xmlDelEncodingAlias
Update
xmlNanoFTPUpdateURL
@@ -245,11 +246,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
Used
XML_SCHEMAS_ANY_LAX
XML_SCHEMAS_ANY_STRICT
XML_SCHEMAS_ATTR_USE_PROHIBITED
XML_SKIP_IDS
+_xmlSchemaType
xmlCatalogGetDefaults
xmlCatalogSetDebug
xmlCatalogSetDefaults
diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index 91895db..ac0163d 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -41,9 +41,6 @@ A:link, A:visited, A:active { text-decoration: underline }
Validate
XML_SCHEMAS_ANY_LAX
xmlRelaxNGValidateDoc
xmlRelaxNGValidateFullElement
-xmlSchemaValidateDoc
-xmlSchemaValidateOneElement
-xmlSchemaValidateStream
xmlSchematronValidateDoc
xmlShellValidate
xmlValidateAttributeValue
@@ -74,8 +71,7 @@ A:link, A:visited, A:active { text-decoration: underline }
VersionNum
xmlParseVersionInfo
xmlParseVersionNum

Letter W:

W3C
xmlTextReaderSchemaValidate
-
WARNING
xmlRelaxNGParse
-xmlSchemaParse
+xmlTextReaderSchemaValidateCtxt
WARNING:
xmlDOMWrapAdoptNode
xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
@@ -92,6 +88,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserHandlePEReference
xmlParserHandleReference
WWW-Authenticate
xmlNanoHTTPAuthHeader
+
WXS
_xmlSchemaElement
Walk
xmlListReverseWalk
xmlListWalk
Warning
xmlSaveFileTo
@@ -156,7 +153,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateOneElement
xmlValidateOneNamespace
xmlValidateRoot
-
XML-Schema
xmlSchemaGetValidErrors
XMLDecl
xmlParseXMLDecl
XMLDecl?
xmlParseDocument
XMLSchema
xmlSchemaGetPredefinedType
@@ -186,6 +182,7 @@ A:link, A:visited, A:active { text-decoration: underline }
XML_ENTITY_DECL
_xmlEntity
XML_ERR_OK
xmlParseInNodeContext
XML_SCHEMAS_ELEM_GLOBAL
XML_SCHEMAS_ELEM_TOPLEVEL
+
XML_SCHEMAS_FACET_PRESERVE
_xmlSchemaFacet
XML_SCHEMAS_STRING
xmlSchemaNewStringValue
XML_SUBSTITUTE_PEREF
xmlDecodeEntities
xmlStringDecodeEntities
@@ -209,6 +206,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPtrRangeToFunction
XSD
xmlAutomataNewNegTrans
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetSchema
XSLT
_xmlNode
_xmlXPathContext
diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index 9598e49..7029c33 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -430,6 +430,7 @@ A:link, A:visited, A:active { text-decoration: underline }

Type xmlOutputBufferCreateFilenameFunc:

xmlOutputBufferCreateFilenameDefault
xmlThrDefOutputBufferCreateFilenameDefault

Type xmlOutputBufferPtr:

xmlAllocOutputBuffer
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -481,7 +482,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGNewParserCtxt

Type xmlRelaxNGPtr:

xmlRelaxNGParse

Type xmlRelaxNGValidCtxtPtr:

xmlRelaxNGNewValidCtxt
-

Type xmlSaveCtxtPtr:

xmlSaveToFd
+

Type xmlSaveCtxtPtr:

xmlSaveToBuffer
+xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO

Type xmlSchemaFacetPtr:

xmlSchemaNewFacet
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 744feb1..4f960e0 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -102,6 +102,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlDocContentDumpOutput
htmlDocDump
htmlDocDumpMemory
+htmlDocDumpMemoryFormat
htmlGetMetaEncoding
htmlIsBooleanAttr
htmlNewDoc
@@ -914,6 +915,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPop
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
+xmlStreamWantsAnyNode

Module relaxng:

XML_RELAXNGP_CRNG
XML_RELAXNGP_FREE_DOC
XML_RELAXNGP_NONE
@@ -1000,7 +1003,9 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_ANY_SKIP
XML_SCHEMAS_ANY_STRICT
XML_SCHEMAS_ATTRGROUP_GLOBAL
+XML_SCHEMAS_ATTRGROUP_HAS_REFS
XML_SCHEMAS_ATTRGROUP_MARKED
+XML_SCHEMAS_ATTRGROUP_REDEFINED
XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
XML_SCHEMAS_ATTR_FIXED
XML_SCHEMAS_ATTR_GLOBAL
@@ -1103,6 +1108,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_MIXED
XML_SCHEMAS_TYPE_NORMVALUENEEDED
XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
+XML_SCHEMAS_TYPE_REDEFINED
XML_SCHEMAS_TYPE_VARIETY_ABSENT
XML_SCHEMAS_TYPE_VARIETY_ATOMIC
XML_SCHEMAS_TYPE_VARIETY_LIST
@@ -1124,6 +1130,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS
XML_SCHEMA_CONTENT_SIMPLE
XML_SCHEMA_CONTENT_UNKNOWN
+XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
XML_SCHEMA_EXTRA_QNAMEREF
XML_SCHEMA_FACET_ENUMERATION
XML_SCHEMA_FACET_FRACTIONDIGITS
@@ -1142,6 +1149,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMA_TYPE_ANY_ATTRIBUTE
XML_SCHEMA_TYPE_ATTRIBUTE
XML_SCHEMA_TYPE_ATTRIBUTEGROUP
+XML_SCHEMA_TYPE_ATTRIBUTE_USE
XML_SCHEMA_TYPE_BASIC
XML_SCHEMA_TYPE_CHOICE
XML_SCHEMA_TYPE_COMPLEX
@@ -1707,6 +1715,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNoNetExternalEntityLoader
xmlNormalizeWindowsPath
xmlOutputBufferClose
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -2187,13 +2196,18 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SAVE_NOT_UTF8
XML_SAVE_NO_DOCTYPE
XML_SAVE_UNKNOWN_ENCODING
+XML_SCHEMAP_AG_PROPS_CORRECT
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE
XML_SCHEMAP_ATTRGRP_NONAME_NOREF
XML_SCHEMAP_ATTR_NONAME_NOREF
+XML_SCHEMAP_AU_PROPS_CORRECT
XML_SCHEMAP_AU_PROPS_CORRECT_2
XML_SCHEMAP_A_PROPS_CORRECT_2
+XML_SCHEMAP_A_PROPS_CORRECT_3
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF
+XML_SCHEMAP_COS_ALL_LIMITED
XML_SCHEMAP_COS_CT_EXTENDS_1_1
+XML_SCHEMAP_COS_CT_EXTENDS_1_2
XML_SCHEMAP_COS_CT_EXTENDS_1_3
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2
@@ -2692,6 +2706,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetErrorHandler
xmlTextReaderSetParserProp
xmlTextReaderSetSchema
@@ -2759,6 +2774,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveOption
xmlSaveSetAttrEscape
xmlSaveSetEscape
+xmlSaveToBuffer
xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
@@ -2811,6 +2827,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSAXPlugStruct
xmlSchemaSAXUnplug
xmlSchemaSetParserErrors
+xmlSchemaSetParserStructuredErrors
xmlSchemaSetValidErrors
xmlSchemaSetValidOptions
xmlSchemaSetValidStructuredErrors
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 3d660c4..593cc82 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -371,6 +371,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrdup
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
xmlStringCurrentChar
xmlStringDecodeEntities
xmlStringGetNodeList
@@ -557,6 +558,7 @@ A:link, A:visited, A:active { text-decoration: underline } UTF8Toisolat1
docbEncodeEntities
htmlDocDumpMemory
+htmlDocDumpMemoryFormat
htmlEncodeEntities
isolat1ToUTF8
xmlCharEncodingInputFunc
@@ -839,6 +841,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXUserParseMemory
xmlSaveToIO
xmlSchemaSetParserErrors
+xmlSchemaSetParserStructuredErrors
xmlSchemaSetValidErrors
xmlSchemaSetValidStructuredErrors
xmlSchemaValidateStream
@@ -960,6 +963,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewTextWriterMemory
xmlNodeBufGetContent
xmlNodeDump
+xmlOutputBufferCreateBuffer
+xmlSaveToBuffer

Type xmlC14NIsVisibleCallback:

xmlC14NExecute

Type xmlCatalogAllow:

xmlCatalogSetDefaults

Type xmlCatalogPrefer:

xmlCatalogSetDefaultPrefer
@@ -1003,6 +1008,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrncat
xmlXPathWrapString

Type xmlChar **:

htmlDocDumpMemory
+htmlDocDumpMemoryFormat
xmlC14NDocDumpMemory
xmlC14NDocSave
xmlC14NDocSaveTo
@@ -1042,6 +1048,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCharEncInFunc
xmlCharEncOutFunc

Type xmlCharEncodingHandlerPtr:

xmlAllocOutputBuffer
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -1076,6 +1083,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlDocContentDumpOutput
htmlDocDump
htmlDocDumpMemory
+htmlDocDumpMemoryFormat
htmlNodeDump
htmlNodeDumpFile
htmlNodeDumpFileFormat
@@ -1865,6 +1873,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetParserErrors
xmlSchemaParse
xmlSchemaSetParserErrors
+xmlSchemaSetParserStructuredErrors

Type xmlSchemaPtr:

xmlSchemaDump
xmlSchemaFree
xmlSchemaNewValidCtxt
@@ -1913,6 +1922,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaValidateFile
xmlSchemaValidateOneElement
xmlSchemaValidateStream
+xmlTextReaderSchemaValidateCtxt

Type xmlSchemaValidityErrorFunc:

xmlSchemaSetParserErrors
xmlSchemaSetValidErrors

Type xmlSchemaValidityErrorFunc *:

xmlSchemaGetParserErrors
@@ -1952,7 +1962,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPop
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
+xmlStreamWantsAnyNode

Type xmlStructuredErrorFunc:

xmlRelaxNGSetValidStructuredErrors
+xmlSchemaSetParserStructuredErrors
xmlSchemaSetValidStructuredErrors
xmlSetStructuredErrorFunc
xmlTextReaderSetStructuredErrorHandler
@@ -2028,6 +2041,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetErrorHandler
xmlTextReaderSetParserProp
xmlTextReaderSetSchema
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index a335a81..36d294c 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -779,13 +779,18 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SAVE_NO_XHTML
XML_SAVE_UNKNOWN_ENCODING
XML_SAX2_MAGIC
+XML_SCHEMAP_AG_PROPS_CORRECT
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE
XML_SCHEMAP_ATTRGRP_NONAME_NOREF
XML_SCHEMAP_ATTR_NONAME_NOREF
+XML_SCHEMAP_AU_PROPS_CORRECT
XML_SCHEMAP_AU_PROPS_CORRECT_2
XML_SCHEMAP_A_PROPS_CORRECT_2
+XML_SCHEMAP_A_PROPS_CORRECT_3
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF
+XML_SCHEMAP_COS_ALL_LIMITED
XML_SCHEMAP_COS_CT_EXTENDS_1_1
+XML_SCHEMAP_COS_CT_EXTENDS_1_2
XML_SCHEMAP_COS_CT_EXTENDS_1_3
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2
@@ -977,7 +982,9 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_ANY_SKIP
XML_SCHEMAS_ANY_STRICT
XML_SCHEMAS_ATTRGROUP_GLOBAL
+XML_SCHEMAS_ATTRGROUP_HAS_REFS
XML_SCHEMAS_ATTRGROUP_MARKED
+XML_SCHEMAS_ATTRGROUP_REDEFINED
XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
XML_SCHEMAS_ATTR_FIXED
XML_SCHEMAS_ATTR_GLOBAL
@@ -1106,6 +1113,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_MIXED
XML_SCHEMAS_TYPE_NORMVALUENEEDED
XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
+XML_SCHEMAS_TYPE_REDEFINED
XML_SCHEMAS_TYPE_VARIETY_ABSENT
XML_SCHEMAS_TYPE_VARIETY_ATOMIC
XML_SCHEMAS_TYPE_VARIETY_LIST
@@ -1211,6 +1219,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS
XML_SCHEMA_CONTENT_SIMPLE
XML_SCHEMA_CONTENT_UNKNOWN
+XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
XML_SCHEMA_EXTRA_QNAMEREF
XML_SCHEMA_FACET_ENUMERATION
XML_SCHEMA_FACET_FRACTIONDIGITS
@@ -1229,6 +1238,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMA_TYPE_ANY_ATTRIBUTE
XML_SCHEMA_TYPE_ATTRIBUTE
XML_SCHEMA_TYPE_ATTRIBUTEGROUP
+XML_SCHEMA_TYPE_ATTRIBUTE_USE
XML_SCHEMA_TYPE_BASIC
XML_SCHEMA_TYPE_CHOICE
XML_SCHEMA_TYPE_COMPLEX
@@ -1534,6 +1544,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlDocContentDumpOutput
htmlDocDump
htmlDocDumpMemory
+htmlDocDumpMemoryFormat
htmlDocPtr
htmlElemDesc
htmlElemDescPtr
@@ -2331,6 +2342,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNsType
xmlOutputBuffer
xmlOutputBufferClose
+xmlOutputBufferCreateBuffer
xmlOutputBufferCreateFd
xmlOutputBufferCreateFile
xmlOutputBufferCreateFilename
@@ -2637,6 +2649,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveOption
xmlSaveSetAttrEscape
xmlSaveSetEscape
+xmlSaveToBuffer
xmlSaveToFd
xmlSaveToFilename
xmlSaveToIO
@@ -2704,6 +2717,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSAXPlugStruct
xmlSchemaSAXUnplug
xmlSchemaSetParserErrors
+xmlSchemaSetParserStructuredErrors
xmlSchemaSetValidErrors
xmlSchemaSetValidOptions
xmlSchemaSetValidStructuredErrors
@@ -2819,6 +2833,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPop
xmlStreamPush
xmlStreamPushAttr
+xmlStreamPushNode
+xmlStreamWantsAnyNode
xmlStringComment
xmlStringCurrentChar
xmlStringDecodeEntities
@@ -2910,6 +2926,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
xmlTextReaderSchemaValidate
+xmlTextReaderSchemaValidateCtxt
xmlTextReaderSetErrorHandler
xmlTextReaderSetParserProp
xmlTextReaderSetSchema
diff --git a/doc/FAQ.html b/doc/FAQ.html index 7f68c99..da553fb 100644 --- a/doc/FAQ.html +++ b/doc/FAQ.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -FAQ
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

The XML C parser and toolkit of Gnome

FAQ

Main Menu
Related links

Table of Contents:

  • License(s)
  • +FAQ
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    FAQ

    Main Menu
    Related links

    Table of Contents:

    • License(s)
    • Installation
    • Compilation
    • Developer corner
    • @@ -118,40 +118,47 @@ A:link, A:visited, A:active { text-decoration: underline }

      CFLAGS=`xml2-config --cflags`

      LIBS=`xml2-config --libs`

      -
    • I want to install my own copy of libxml2 in my home directory and link - my programs against it, but it doesn't work +
    • I want to install my own copy of libxml2 in my home directory and + link my programs against it, but it doesn't work

      There are many different ways to accomplish this. Here is one way to - do this under Linux. Suppose your home directory is /home/user. - Then:

      + do this under Linux. Suppose your home directory is /home/user. + Then:

      • Create a subdirectory, let's call it myxml
      • unpack the libxml2 distribution into that subdirectory
      • -
      • chdir into the unpacked distribution (/home/user/myxml/libxml2 - )
      • +
      • chdir into the unpacked distribution + (/home/user/myxml/libxml2 )
      • configure the library using the "--prefix" switch, - specifying an installation subdirectory in /home/user/myxml, - e.g. -

        ./configure --prefix /home/user/myxml/xmlinst {other - configuration options}

      • + specifying an installation subdirectory in + /home/user/myxml, e.g. +

        ./configure --prefix /home/user/myxml/xmlinst {other + configuration options}

        +
      • now run make followed by make install
      • At this point, the installation subdirectory contains the complete - "private" include files, library files and binary program files (e.g. - xmllint), located in -

        /home/user/myxml/xmlinst/lib, /home/user/myxml/xmlinst/include - and /home/user/myxml/xmlinst/bin

        - respectively.
      • -
      • In order to use this "private" library, you should first add it - to the beginning of your default PATH (so that your own private - program files such as xmllint will be used instead of the normal - system ones). To do this, the Bash command would be -

        export PATH=/home/user/myxml/xmlinst/bin:$PATH

      • + "private" include files, library files and binary program files (e.g. + xmllint), located in +

        /home/user/myxml/xmlinst/lib, + /home/user/myxml/xmlinst/include and + /home/user/myxml/xmlinst/bin

        + respectively. +
      • In order to use this "private" library, you should first add it to + the beginning of your default PATH (so that your own private program + files such as xmllint will be used instead of the normal system + ones). To do this, the Bash command would be +

        export PATH=/home/user/myxml/xmlinst/bin:$PATH

        +
      • Now suppose you have a program test1.c that you would - like to compile with your "private" library. Simply compile it - using the command

        gcc `xml2-config --cflags --libs` -o test - test.c

        Note that, because your PATH has been set with - /home/user/myxml/xmlinst/bin at the beginning, the - xml2-config program which you just installed will be used instead of - the system default one, and this will automatically get the - correct libraries linked with your program.
    • + like to compile with your "private" library. Simply compile it using + the command +

      gcc `xml2-config --cflags --libs` -o test test.c

      + Note that, because your PATH has been set with + /home/user/myxml/xmlinst/bin at the beginning, the xml2-config + program which you just installed will be used instead of the system + default one, and this will automatically get the correct + libraries linked with your program. +
    + +

  • xmlDocDump() generates output on one line.

    Libxml2 will not invent spaces in the content of a document since all spaces in the content of a document are diff --git a/doc/Makefile.am b/doc/Makefile.am index 7332659..55c5ef5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -110,7 +110,6 @@ install-data-local: $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html -@INSTALL@ -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(HTML_DIR)/html -@INSTALL@ -m 0644 $(srcdir)/html/*.png $(DESTDIR)$(HTML_DIR)/html - -@INSTALL@ -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(HTML_DIR)/html $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/tutorial -@INSTALL@ -m 0644 $(srcdir)/tutorial/*.* \ $(DESTDIR)$(HTML_DIR)/tutorial diff --git a/doc/Makefile.in b/doc/Makefile.in index b8b3d34..f80c05f 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -731,7 +731,6 @@ install-data-local: $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html -@INSTALL@ -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(HTML_DIR)/html -@INSTALL@ -m 0644 $(srcdir)/html/*.png $(DESTDIR)$(HTML_DIR)/html - -@INSTALL@ -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(HTML_DIR)/html $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/tutorial -@INSTALL@ -m 0644 $(srcdir)/tutorial/*.* \ $(DESTDIR)$(HTML_DIR)/tutorial diff --git a/doc/XMLinfo.html b/doc/XMLinfo.html index e89bdad..ad43eff 100644 --- a/doc/XMLinfo.html +++ b/doc/XMLinfo.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -XML
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XML

    Main Menu
    Related links

    XML is a standard for +XML
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XML

    Main Menu
    Related links

    XML is a standard for markup-based structured documents. Here is an example XML document:

    <?xml version="1.0"?>
     <EXAMPLE prop1="gnome is great" prop2="&amp; linux too">
    diff --git a/doc/XSLT.html b/doc/XSLT.html
    index 7212cb6..41adf2f 100644
    --- a/doc/XSLT.html
    +++ b/doc/XSLT.html
    @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica}
     H2 {font-family: Verdana,Arial,Helvetica}
     H3 {font-family: Verdana,Arial,Helvetica}
     A:link, A:visited, A:active { text-decoration: underline }
    -XSLT
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XSLT

    Main Menu
    Related links

    Check the separate libxslt page

    XSL Transformations, is a +XSLT
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XSLT

    Main Menu
    Related links

    Check the separate libxslt page

    XSL Transformations, is a language for transforming XML documents into other XML documents (or HTML/textual output).

    A separate library called libxslt is available implementing XSLT-1.0 for libxml2. This module "libxslt" too can be found in the Gnome CVS base.

    You can check the progresses on the libxslt Changelog.

    Daniel Veillard

    diff --git a/doc/bugs.html b/doc/bugs.html index cadebe8..f598051 100644 --- a/doc/bugs.html +++ b/doc/bugs.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Reporting bugs and getting help
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    Reporting bugs and getting help

    Main Menu
    Related links

    Well, bugs or missing features are always possible, and I will make a +Reporting bugs and getting help
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    Reporting bugs and getting help

    Main Menu
    Related links

    Well, bugs or missing features are always possible, and I will make a point of fixing them in a timely fashion. The best way to report a bug is to use the Gnome bug tracking database (make sure to use the "libxml2" module name). I diff --git a/doc/catalog.html b/doc/catalog.html index 9947f90..3750123 100644 --- a/doc/catalog.html +++ b/doc/catalog.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Catalog support
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    Catalog support

    Main Menu
    Related links

    Table of Content:

    1. General overview
    2. +Catalog support
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Catalog support

      Main Menu
      Related links

      Table of Content:

      1. General overview
      2. The definition
      3. Using catalogs
      4. Some examples
      5. diff --git a/doc/contribs.html b/doc/contribs.html index 8ea1843..a89c9ea 100644 --- a/doc/contribs.html +++ b/doc/contribs.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Contributions
        Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
        Made with Libxml2 Logo

        The XML C parser and toolkit of Gnome

        Contributions

        Main Menu
        Related links
        • Bjorn Reese, William Brack and Thomas Broyer have provided a number of +Contributions
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Contributions

          Main Menu
          Related links

          Daniel Veillard

          diff --git a/doc/devhelp/libxml2-HTMLtree.html b/doc/devhelp/libxml2-HTMLtree.html index b7c35b4..6430f8b 100644 --- a/doc/devhelp/libxml2-HTMLtree.html +++ b/doc/devhelp/libxml2-HTMLtree.html @@ -51,9 +51,10 @@ int htmlNodeDumpFileFormat (FILE * out,
          xmlDocPtr doc,
          xmlNodePtr cur,
          const char * encoding,
          int format); void htmlDocDumpMemory (xmlDocPtr cur,
          xmlChar ** mem,
          int * size); int htmlSaveFile (const char * filename,
          xmlDocPtr cur); -htmlDocPtr htmlNewDocNoDtD (const xmlChar * URI,
          const xmlChar * ExternalID); int htmlDocDump (FILE * f,
          xmlDocPtr cur); +void htmlDocDumpMemoryFormat (xmlDocPtr cur,
          xmlChar ** mem,
          int * size,
          int format); int htmlIsBooleanAttr (const xmlChar * name); +int htmlSaveFileFormat (const char * filename,
          xmlDocPtr cur,
          const char * encoding,
          int format); void htmlNodeDumpFormatOutput (xmlOutputBufferPtr buf,
          xmlDocPtr doc,
          xmlNodePtr cur,
          const char * encoding,
          int format); int htmlSetMetaEncoding (htmlDocPtr doc,
          const xmlChar * encoding); int htmlSaveFileEnc (const char * filename,
          xmlDocPtr cur,
          const char * encoding); @@ -63,7 +64,7 @@ int htmlNodeDump (xmlChar * htmlGetMetaEncoding (htmlDocPtr doc); void htmlNodeDumpFile (FILE * out,
          xmlDocPtr doc,
          xmlNodePtr cur); void htmlDocContentDumpFormatOutput (xmlOutputBufferPtr buf,
          xmlDocPtr cur,
          const char * encoding,
          int format); -int htmlSaveFileFormat (const char * filename,
          xmlDocPtr cur,
          const char * encoding,
          int format); +htmlDocPtr htmlNewDocNoDtD (const xmlChar * URI,
          const xmlChar * ExternalID); void htmlDocContentDumpOutput (xmlOutputBufferPtr buf,
          xmlDocPtr cur,
          const char * encoding); @@ -108,6 +109,10 @@ void htmlDocContentDumpOutput (

          htmlDocDumpMemory ()

          void	htmlDocDumpMemory		(xmlDocPtr cur, 
          xmlChar ** mem,
          int * size)

          Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

          cur:the document
          mem:OUT: the memory pointer
          size:OUT: the memory length
          +
          +

          htmlDocDumpMemoryFormat ()

          void	htmlDocDumpMemoryFormat		(xmlDocPtr cur, 
          xmlChar ** mem,
          int * size,
          int format)
          +

          Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

          +
          cur:the document
          mem:OUT: the memory pointer
          size:OUT: the memory length
          format:should formatting spaces been added

          htmlGetMetaEncoding ()

          const xmlChar *	htmlGetMetaEncoding	(htmlDocPtr doc)

          Encoding definition lookup in the Meta tags

          diff --git a/doc/devhelp/libxml2-pattern.html b/doc/devhelp/libxml2-pattern.html index 621767e..321bd79 100644 --- a/doc/devhelp/libxml2-pattern.html +++ b/doc/devhelp/libxml2-pattern.html @@ -55,11 +55,13 @@ void xmlFreePatternList (xmlPatternStreamable (xmlPatternPtr comp); int xmlStreamPushAttr (xmlStreamCtxtPtr stream,
          const xmlChar * name,
          const xmlChar * ns); int xmlPatternMatch (xmlPatternPtr comp,
          xmlNodePtr node); +int xmlStreamWantsAnyNode (xmlStreamCtxtPtr streamCtxt); int xmlStreamPop (xmlStreamCtxtPtr stream); void xmlFreePattern (xmlPatternPtr comp); int xmlStreamPush (xmlStreamCtxtPtr stream,
          const xmlChar * name,
          const xmlChar * ns); int xmlPatternMaxDepth (xmlPatternPtr comp); xmlPatternPtr xmlPatterncompile (const xmlChar * pattern,
          xmlDict * dict,
          int flags,
          const xmlChar ** namespaces); +int xmlStreamPushNode (xmlStreamCtxtPtr stream,
          const xmlChar * name,
          const xmlChar * ns,
          int nodeType); void xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
          @@ -143,13 +145,21 @@ The content of this structure is not made public by the API.
          stream:the stream context
          Returns:-1 in case of error, 0 otherwise.

          xmlStreamPush ()

          int	xmlStreamPush			(xmlStreamCtxtPtr stream, 
          const xmlChar * name,
          const xmlChar * ns)
          -

          Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.

          +

          Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an element-node.

          stream:the stream context
          name:the current name
          ns:the namespace name
          Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

          xmlStreamPushAttr ()

          int	xmlStreamPushAttr		(xmlStreamCtxtPtr stream, 
          const xmlChar * name,
          const xmlChar * ns)
          -

          Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.

          +

          Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an attribute-node.

          stream:the stream context
          name:the current name
          ns:the namespace name
          Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

          +

          xmlStreamPushNode ()

          int	xmlStreamPushNode		(xmlStreamCtxtPtr stream, 
          const xmlChar * name,
          const xmlChar * ns,
          int nodeType)
          +

          Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Different from xmlStreamPush() this function can be fed with nodes of type: element-, attribute-, text-, cdata-section-, comment- and processing-instruction-node.

          +
          stream:the stream context
          name:the current name
          ns:the namespace name
          nodeType:the type of the node being pushed
          Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.
          +
          +

          xmlStreamWantsAnyNode ()

          int	xmlStreamWantsAnyNode		(xmlStreamCtxtPtr streamCtxt)
          +

          Query if the streaming pattern additionally needs to be fed with text-, cdata-section-, comment- and processing-instruction-nodes. If the result is 0 then only element-nodes and attribute-nodes need to be pushed.

          +
          streamCtxt:the stream context
          Returns:1 in case of need of nodes of the above described types, 0 otherwise. -1 on API errors.
          +
          diff --git a/doc/devhelp/libxml2-relaxng.html b/doc/devhelp/libxml2-relaxng.html index a10bd11..9dd4bb1 100644 --- a/doc/devhelp/libxml2-relaxng.html +++ b/doc/devhelp/libxml2-relaxng.html @@ -228,7 +228,7 @@ The content of this structure is not made public by the API.
          schema:a precompiled XML RelaxNGs
          Returns:the validation context or NULL in case of error

          xmlRelaxNGParse ()

          xmlRelaxNGPtr	xmlRelaxNGParse		(xmlRelaxNGParserCtxtPtr ctxt)
          -

          parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change

          +

          parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

          ctxt:a Relax-NG parser context
          Returns:the internal XML RelaxNG structure built from the resource or NULL in case of error

          xmlRelaxNGSetParserErrors ()

          void	xmlRelaxNGSetParserErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
          xmlRelaxNGValidityErrorFunc err,
          xmlRelaxNGValidityWarningFunc warn,
          void * ctx)
          diff --git a/doc/devhelp/libxml2-schemasInternals.html b/doc/devhelp/libxml2-schemasInternals.html index ba7d1c1..2f9cbc9 100644 --- a/doc/devhelp/libxml2-schemasInternals.html +++ b/doc/devhelp/libxml2-schemasInternals.html @@ -39,7 +39,7 @@ schemasInternals

          schemasInternals - internal interfaces for XML Schemas

          -

          internal interfaces for the XML Schemas handling and schema validity checking

          +

          internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not garanteed to be API or ABI stable !

          Author(s): Daniel Veillard

          Synopsis

          @@ -66,11 +66,12 @@ #define XML_SCHEMAS_ATTR_USE_PROHIBITED; #define XML_SCHEMAS_ELEM_NILLABLE; #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION; -#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED; +#define XML_SCHEMAS_ATTRGROUP_REDEFINED; #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD; #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT; #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION; #define XML_SCHEMAS_TYPE_FINAL_EXTENSION; +#define XML_SCHEMAS_TYPE_REDEFINED; #define XML_SCHEMAS_ELEM_FIXED; #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD; #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC; @@ -90,7 +91,9 @@ #define XML_SCHEMAS_ANYATTR_LAX; #define XML_SCHEMAS_TYPE_GLOBAL; #define XML_SCHEMAS_TYPE_ABSTRACT; +#define XML_SCHEMAS_TYPE_MIXED; #define XML_SCHEMAS_ATTR_FIXED; +#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED; #define XML_SCHEMAS_ANY_SKIP; #define XML_SCHEMAS_FINAL_DEFAULT_LIST; #define XML_SCHEMAS_TYPE_VARIETY_ABSENT; @@ -99,7 +102,7 @@ #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; #define XML_SCHEMAS_ELEM_NSDEFAULT; #define XML_SCHEMAS_ELEM_GLOBAL; -#define XML_SCHEMAS_TYPE_MIXED; +#define XML_SCHEMAS_ELEM_TOPLEVEL; #define XML_SCHEMAS_ANY_LAX; #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION; #define XML_SCHEMAS_TYPE_HAS_FACETS; @@ -108,7 +111,7 @@ #define XML_SCHEMAS_ELEM_FINAL_ABSENT; #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION; #define XML_SCHEMAS_TYPE_INTERNAL_INVALID; -#define XML_SCHEMAS_ELEM_TOPLEVEL; +#define XML_SCHEMAS_ATTRGROUP_HAS_REFS; #define XML_SCHEMAS_ELEM_ABSTRACT; #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION; #define XML_SCHEMAS_TYPE_FINAL_UNION; @@ -187,10 +190,18 @@ void xmlSchemaFreeWildcard (

          Macro XML_SCHEMAS_ATTRGROUP_GLOBAL

          #define XML_SCHEMAS_ATTRGROUP_GLOBAL;
           

          The attribute wildcard has been already builded.

          +
          +
          +

          Macro XML_SCHEMAS_ATTRGROUP_HAS_REFS

          #define XML_SCHEMAS_ATTRGROUP_HAS_REFS;
          +

          Whether this attr. group contains attr. group references.


          Macro XML_SCHEMAS_ATTRGROUP_MARKED

          #define XML_SCHEMAS_ATTRGROUP_MARKED;
           

          Marks the attr group as marked; used for circular checks.

          +
          +
          +

          Macro XML_SCHEMAS_ATTRGROUP_REDEFINED

          #define XML_SCHEMAS_ATTRGROUP_REDEFINED;
          +

          The attr group was redefined.


          Macro XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED

          #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED;
          @@ -443,10 +454,14 @@ void	xmlSchemaFreeWildcard		(

          Macro XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD

          #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
           

          the complexType owns an attribute wildcard, i.e. it can be freed by the complexType

          +
          +
          +

          Macro XML_SCHEMAS_TYPE_REDEFINED

          #define XML_SCHEMAS_TYPE_REDEFINED;
          +

          The type was redefined.


          Macro XML_SCHEMAS_TYPE_VARIETY_ABSENT

          #define XML_SCHEMAS_TYPE_VARIETY_ABSENT;
          -

          the simpleType has a variety of "absent".

          +

          the simpleType has a variety of "absent". TODO: Actually not necessary :-/, since if none of the variety flags occur then it's automatically absent.


          Macro XML_SCHEMAS_TYPE_VARIETY_ATOMIC

          #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
          @@ -489,25 +504,25 @@ void	xmlSchemaFreeWildcard		(

          Structure xmlSchemaAttribute

          struct _xmlSchemaAttribute {
          -    xmlSchemaTypeType	type	: The kind of type
          -    struct _xmlSchemaAttribute *	next	: the next attribute if in a group ...
          -    const xmlChar *	name	: name of the declaration or empty if particle
          -    const xmlChar *	id
          -    const xmlChar *	ref	: the local name of the attribute decl. if a particle
          -    const xmlChar *	refNs	: the ns URI of the attribute decl. if a particle
          +    xmlSchemaTypeType	type
          +    struct _xmlSchemaAttribute *	next	: the next attribute (not used?)
          +    const xmlChar *	name	: the name of the declaration
          +    const xmlChar *	id	: Deprecated; not used
          +    const xmlChar *	ref	: Deprecated; not used
          +    const xmlChar *	refNs	: Deprecated; not used
               const xmlChar *	typeName	: the local name of the type definition
               const xmlChar *	typeNs	: the ns URI of the type definition
               xmlSchemaAnnotPtr	annot
          -    xmlSchemaTypePtr	base	: obsolete, not used
          -    int	occurs
          -    const xmlChar *	defValue
          +    xmlSchemaTypePtr	base	: Deprecated; not used
          +    int	occurs	: Deprecated; not used
          +    const xmlChar *	defValue	: The initial value of the value constraint
               xmlSchemaTypePtr	subtypes	: the type definition
               xmlNodePtr	node
               const xmlChar *	targetNamespace
               int	flags
          -    const xmlChar *	refPrefix
          -    xmlSchemaValPtr	defVal
          -    xmlSchemaAttributePtr	refDecl
          +    const xmlChar *	refPrefix	: Deprecated; not used
          +    xmlSchemaValPtr	defVal	: The compiled value constraint
          +    xmlSchemaAttributePtr	refDecl	: Deprecated; not used
           } xmlSchemaAttribute;
           

          @@ -517,16 +532,17 @@ void xmlSchemaFreeWildcard (attribute if in a group ... const xmlChar * name const xmlChar * id - const xmlChar * ref - const xmlChar * refNs + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used xmlSchemaAnnotPtr annot - xmlSchemaAttributePtr attributes + xmlSchemaAttributePtr attributes : Deprecated; not used xmlNodePtr node int flags xmlSchemaWildcardPtr attributeWildcard - const xmlChar * refPrefix - xmlSchemaAttributeGroupPtr refItem : The referenced attribute group - const xmlChar * targetNamespace : xmlSchemaAttributeGroupPtr redef Redefinitions + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaAttributeGroupPtr refItem : Deprecated; not used + const xmlChar * targetNamespace + void * attrUses } xmlSchemaAttributeGroup;

          @@ -556,7 +572,7 @@ void xmlSchemaFreeWildcard (XML_SCHEMA_CONTENT_ELEMENTS = 2 XML_SCHEMA_CONTENT_MIXED = 3 XML_SCHEMA_CONTENT_SIMPLE = 4 - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5 /* obsolete, not used */ + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5 /* Obsolete */ XML_SCHEMA_CONTENT_BASIC = 6 XML_SCHEMA_CONTENT_ANY = 7 }; @@ -565,17 +581,17 @@ void xmlSchemaFreeWildcard (

          Structure xmlSchemaElement

          struct _xmlSchemaElement {
               xmlSchemaTypeType	type	: The kind of type
          -    struct _xmlSchemaType *	next	: the next type if in a sequence ...
          +    struct _xmlSchemaType *	next	: Not used?
               const xmlChar *	name
          -    const xmlChar *	id
          -    const xmlChar *	ref	: the local name of the element declaration if a particle
          -    const xmlChar *	refNs	: the ns URI of the element declaration if a particle
          +    const xmlChar *	id	: Deprecated; not used
          +    const xmlChar *	ref	: Deprecated; not used
          +    const xmlChar *	refNs	: Deprecated; not used
               xmlSchemaAnnotPtr	annot
               xmlSchemaTypePtr	subtypes	: the type definition
               xmlSchemaAttributePtr	attributes
               xmlNodePtr	node
          -    int	minOccurs
          -    int	maxOccurs
          +    int	minOccurs	: Deprecated; not used
          +    int	maxOccurs	: Deprecated; not used
               int	flags
               const xmlChar *	targetNamespace
               const xmlChar *	namedType
          @@ -583,13 +599,13 @@ void	xmlSchemaFreeWildcard		(xmlChar *	substGroup
               const xmlChar *	substGroupNs
               const xmlChar *	scope
          -    const xmlChar *	value
          +    const xmlChar *	value	: The original value of the value constraint.
               struct _xmlSchemaElement *	refDecl	: This will now be used for the substitution group affiliation
          -    xmlRegexpPtr	contModel
          +    xmlRegexpPtr	contModel	: Obsolete for WXS, maybe used for RelaxNG
               xmlSchemaContentType	contentType
          -    const xmlChar *	refPrefix
          -    xmlSchemaValPtr	defVal
          -    void *	idcs
          +    const xmlChar *	refPrefix	: Deprecated; not used
          +    xmlSchemaValPtr	defVal	: The compiled value contraint.
          +    void *	idcs	: The identity-constraint defs
           } xmlSchemaElement;
           

          @@ -601,14 +617,14 @@ void xmlSchemaFreeWildcard (

          Structure xmlSchemaFacet

          struct _xmlSchemaFacet {
               xmlSchemaTypeType	type	: The kind of type
               struct _xmlSchemaFacet *	next	: the next type if in a sequence ...
          -    const xmlChar *	value
          -    const xmlChar *	id
          +    const xmlChar *	value	: The original value
          +    const xmlChar *	id	: Obsolete
               xmlSchemaAnnotPtr	annot
               xmlNodePtr	node
          -    int	fixed
          +    int	fixed	: XML_SCHEMAS_FACET_PRESERVE, etc.
               int	whitespace
          -    xmlSchemaValPtr	val
          -    xmlRegexpPtr	regexp
          +    xmlSchemaValPtr	val	: The compiled value
          +    xmlRegexpPtr	regexp	: The regex for patterns
           } xmlSchemaFacet;
           

          @@ -646,39 +662,40 @@ void xmlSchemaFreeWildcard (xmlSchemaTypeType type : The kind of type struct _xmlSchemaType * next : the next type if in a sequence ... const xmlChar * name - const xmlChar * id - const xmlChar * ref - const xmlChar * refNs + const xmlChar * id : Deprecated; not used + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used xmlSchemaAnnotPtr annot xmlSchemaTypePtr subtypes - xmlSchemaAttributePtr attributes + xmlSchemaAttributePtr attributes : Deprecated; not used xmlNodePtr node - int minOccurs - int maxOccurs + int minOccurs : Deprecated; not used + int maxOccurs : Deprecated; not used int flags xmlSchemaContentType contentType - const xmlChar * base - const xmlChar * baseNs - xmlSchemaTypePtr baseType - xmlSchemaFacetPtr facets - struct _xmlSchemaType * redef : possible redefinitions for the type - int recurse - xmlSchemaAttributeLinkPtr attributeUses + const xmlChar * base : Base type's local name + const xmlChar * baseNs : Base type's target namespace + xmlSchemaTypePtr baseType : The base type component + xmlSchemaFacetPtr facets : Local facets + struct _xmlSchemaType * redef : Deprecated; not used + int recurse : Obsolete + xmlSchemaAttributeLinkPtr * attributeUses : Deprecated; not used xmlSchemaWildcardPtr attributeWildcard - int builtInType - xmlSchemaTypeLinkPtr memberTypes - xmlSchemaFacetLinkPtr facetSet - const xmlChar * refPrefix - xmlSchemaTypePtr contentTypeDef - xmlRegexpPtr contModel + int builtInType : Type of built-in types. + xmlSchemaTypeLinkPtr memberTypes : member-types if a union type. + xmlSchemaFacetLinkPtr facetSet : All facets (incl. inherited) + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaTypePtr contentTypeDef : Used for the simple content of complex types. Could we use @subtypes + xmlRegexpPtr contModel : Holds the automaton of the content model const xmlChar * targetNamespace + void * attrUses } xmlSchemaType;


          Structure xmlSchemaTypeLink

          struct _xmlSchemaTypeLink {
               struct _xmlSchemaTypeLink *	next	: the next type link ...
          -    xmlSchemaTypePtr	type	: the linked typ
          +    xmlSchemaTypePtr	type	: the linked type
           } xmlSchemaTypeLink;
           

          @@ -717,6 +734,7 @@ void xmlSchemaFreeWildcard (XML_SCHEMA_TYPE_IDC_KEY = 23 XML_SCHEMA_TYPE_IDC_KEYREF = 24 XML_SCHEMA_TYPE_PARTICLE = 25 + XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26 XML_SCHEMA_FACET_MININCLUSIVE = 1000 XML_SCHEMA_FACET_MINEXCLUSIVE = 1001 XML_SCHEMA_FACET_MAXINCLUSIVE = 1002 @@ -730,6 +748,7 @@ void xmlSchemaFreeWildcard (XML_SCHEMA_FACET_MAXLENGTH = 1010 XML_SCHEMA_FACET_MINLENGTH = 1011 XML_SCHEMA_EXTRA_QNAMEREF = 2000 + XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001 };

          @@ -798,11 +817,11 @@ The content of this structure is not made public by the API.


          Structure xmlSchemaWildcard

          struct _xmlSchemaWildcard {
               xmlSchemaTypeType	type	: The kind of type
          -    const xmlChar *	id
          +    const xmlChar *	id	: Deprecated; not used
               xmlSchemaAnnotPtr	annot
               xmlNodePtr	node
          -    int	minOccurs
          -    int	maxOccurs
          +    int	minOccurs	: Deprecated; not used
          +    int	maxOccurs	: Deprecated; not used
               int	processContents
               int	any	: Indicates if the ns constraint is of ##any
               xmlSchemaWildcardNsPtr	nsSet	: The list of allowed namespaces
          diff --git a/doc/devhelp/libxml2-tree.html b/doc/devhelp/libxml2-tree.html
          index 9b77b9a..9395f76 100644
          --- a/doc/devhelp/libxml2-tree.html
          +++ b/doc/devhelp/libxml2-tree.html
          @@ -1225,7 +1225,7 @@ void	xmlFreeNsList			(
          doc:the document pointer
          name:the DTD name
          ExternalID:the external ID
          SystemID:the system ID
          Returns:a pointer to the new DTD structure

          xmlNewGlobalNs ()

          xmlNsPtr	xmlNewGlobalNs		(xmlDocPtr doc, 
          const xmlChar * href,
          const xmlChar * prefix)
          -

          Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!! It now create a namespace on the root element of the document if found.

          +

          Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!!

          doc:the document carrying the namespace
          href:the URI associated
          prefix:the prefix for the namespace
          Returns:NULL this functionality had been removed

          xmlNewNode ()

          xmlNodePtr	xmlNewNode		(xmlNsPtr ns, 
          const xmlChar * name)
          diff --git a/doc/devhelp/libxml2-valid.html b/doc/devhelp/libxml2-valid.html index 7832502..3b23e67 100644 --- a/doc/devhelp/libxml2-valid.html +++ b/doc/devhelp/libxml2-valid.html @@ -81,7 +81,7 @@ int xmlValidateAttributeDecl (xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd,
          const xmlChar * name,
          const xmlChar * prefix); xmlNotationTablePtr xmlCopyNotationTable (xmlNotationTablePtr table); int xmlValidateDocument (xmlValidCtxtPtr ctxt,
          xmlDocPtr doc); -int xmlValidGetPotentialChildren (xmlElementContent * ctree,
          const xmlChar ** list,
          int * len,
          int max); +int xmlValidGetPotentialChildren (xmlElementContent * ctree,
          const xmlChar ** names,
          int * len,
          int max); xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
          xmlDtdPtr dtd,
          const xmlChar * name,
          const xmlChar * PublicID,
          const xmlChar * SystemID); int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
          xmlDocPtr doc,
          xmlElementPtr elem); xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
          xmlDtdPtr dtd,
          const xmlChar * elem,
          const xmlChar * name,
          const xmlChar * ns,
          xmlAttributeType type,
          xmlAttributeDefault def,
          const xmlChar * defaultValue,
          xmlEnumerationPtr tree); @@ -426,9 +426,9 @@ The content of this structure is not made public by the API.

          Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character. Also check VC: Standalone Document Declaration in P32, and update ctxt->valid accordingly

          ctxt:the validation context or NULL
          doc:the document
          elem:the parent
          name:the attribute name
          value:the attribute value
          Returns:a new normalized string if normalization is needed, NULL otherwise the caller must free the returned value.

          -

          xmlValidGetPotentialChildren ()

          int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
          const xmlChar ** list,
          int * len,
          int max)
          +

          xmlValidGetPotentialChildren ()

          int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
          const xmlChar ** names,
          int * len,
          int max)

          Build/extend a list of potential children allowed by the content tree

          -
          ctree:an element content tree
          list:an array to store the list of child names
          len:a pointer to the number of element in the list
          max:the size of the array
          Returns:the number of element in the list, or -1 in case of error.
          +
          ctree:an element content tree
          names:an array to store the list of child names
          len:a pointer to the number of element in the list
          max:the size of the array
          Returns:the number of element in the list, or -1 in case of error.

          xmlValidGetValidElements ()

          int	xmlValidGetValidElements	(xmlNode * prev, 
          xmlNode * next,
          const xmlChar ** names,
          int max)

          This function returns the list of authorized children to insert within an existing tree while respecting the validity constraints forced by the Dtd. The insertion point is defined using @prev and @next in the following ways: to insert before 'node': xmlValidGetValidElements(node->prev, node, ... to insert next 'node': xmlValidGetValidElements(node, node->next, ... to replace 'node': xmlValidGetValidElements(node->prev, node->next, ... to prepend a child to 'node': xmlValidGetValidElements(NULL, node->childs, to append a child to 'node': xmlValidGetValidElements(node->last, NULL, ... pointers to the element names are inserted at the beginning of the array and do not need to be freed.

          diff --git a/doc/devhelp/libxml2-xmlIO.html b/doc/devhelp/libxml2-xmlIO.html index 9e03d5f..8c41d1d 100644 --- a/doc/devhelp/libxml2-xmlIO.html +++ b/doc/devhelp/libxml2-xmlIO.html @@ -71,9 +71,10 @@ int xmlRegisterInputCallbacks (xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); void xmlRegisterDefaultInputCallbacks (void); int xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
          int len); +typedef int xmlOutputCloseCallback (void * context); xmlOutputBufferPtr xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); xmlParserInputPtr xmlNoNetExternalEntityLoader (const char * URL,
          const char * ID,
          xmlParserCtxtPtr ctxt); -typedef int xmlOutputCloseCallback (void * context); +xmlOutputBufferPtr xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
          xmlCharEncodingHandlerPtr encoder); int xmlIOHTTPMatch (const char * filename); void * xmlIOHTTPOpen (const char * filename); xmlParserInputBufferPtr xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
          xmlInputCloseCallback ioclose,
          void * ioctx,
          xmlCharEncoding enc); @@ -229,6 +230,10 @@ void * xmlIOHTTPOpenW (const char * post_uri,

          xmlOutputBufferClose ()

          int	xmlOutputBufferClose		(xmlOutputBufferPtr out)

          flushes and close the output I/O channel and free up all the associated resources

          out:a buffered output
          Returns:the number of byte written or -1 in case of error.
          +
          +

          xmlOutputBufferCreateBuffer ()

          xmlOutputBufferPtr	xmlOutputBufferCreateBuffer	(xmlBufferPtr buffer, 
          xmlCharEncodingHandlerPtr encoder)
          +

          Create a buffered output for the progressive saving to a xmlBuffer

          +
          buffer:a xmlBufferPtr
          encoder:the encoding converter or NULL
          Returns:the new parser output or NULL

          xmlOutputBufferCreateFd ()

          xmlOutputBufferPtr	xmlOutputBufferCreateFd	(int fd, 
          xmlCharEncodingHandlerPtr encoder)

          Create a buffered output for the progressive saving to a file descriptor

          diff --git a/doc/devhelp/libxml2-xmlerror.html b/doc/devhelp/libxml2-xmlerror.html index 44792da..d0eb477 100644 --- a/doc/devhelp/libxml2-xmlerror.html +++ b/doc/devhelp/libxml2-xmlerror.html @@ -811,6 +811,11 @@ void xmlResetError (XML_SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084 /* 3084 */ XML_SCHEMAP_WARN_ATTR_REDECL_PROH = 3085 /* 3085 */ XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086 /* 3085 */ + XML_SCHEMAP_AG_PROPS_CORRECT = 3087 /* 3086 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_2 = 3088 /* 3087 */ + XML_SCHEMAP_AU_PROPS_CORRECT = 3089 /* 3088 */ + XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090 /* 3089 */ + XML_SCHEMAP_COS_ALL_LIMITED = 3091 /* 3090 */ XML_MODULE_OPEN = 4900 /* 4900 */ XML_MODULE_CLOSE = 4901 /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000 diff --git a/doc/devhelp/libxml2-xmlreader.html b/doc/devhelp/libxml2-xmlreader.html index 585f47e..a3bbbb5 100644 --- a/doc/devhelp/libxml2-xmlreader.html +++ b/doc/devhelp/libxml2-xmlreader.html @@ -124,6 +124,7 @@ int xmlReaderNewMemory (xmlChar * xmlTextReaderConstValue (xmlTextReaderPtr reader); xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input,
          const char * URI); xmlChar * xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
          int no); +int xmlTextReaderSchemaValidateCtxt (xmlTextReaderPtr reader,
          xmlSchemaValidCtxtPtr ctxt,
          int options); xmlChar * xmlTextReaderLocalName (xmlTextReaderPtr reader); xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader); const xmlChar * xmlTextReaderConstName (xmlTextReaderPtr reader); @@ -513,8 +514,12 @@ The content of this structure is not made public by the API.
          reader:the xmlTextReaderPtr used
          rng:the path to a RelaxNG schema or NULL
          Returns:0 in case the RelaxNG validation could be (des)activated and -1 in case of error.

          xmlTextReaderSchemaValidate ()

          int	xmlTextReaderSchemaValidate	(xmlTextReaderPtr reader, 
          const char * xsd)
          -

          Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). if @xsd is NULL, then RelaxNG validation is desactivated.

          -
          reader:the xmlTextReaderPtr used
          xsd:the path to a W3C XSD schema or NULL
          Returns:0 in case the schemas validation could be (des)activated and -1 in case of error.
          +

          Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). If @xsd is NULL, then XML Schema validation is deactivated.

          +
          reader:the xmlTextReaderPtr used
          xsd:the path to a W3C XSD schema or NULL
          Returns:0 in case the schemas validation could be (de)activated and -1 in case of error.
          +
          +

          xmlTextReaderSchemaValidateCtxt ()

          int	xmlTextReaderSchemaValidateCtxt	(xmlTextReaderPtr reader, 
          xmlSchemaValidCtxtPtr ctxt,
          int options)
          +

          Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then XML Schema validation is deactivated.

          +
          reader:the xmlTextReaderPtr used
          ctxt:the XML Schema validation context or NULL
          options:options (not used yet)
          Returns:0 in case the schemas validation could be (de)activated and -1 in case of error.

          xmlTextReaderSetErrorHandler ()

          void	xmlTextReaderSetErrorHandler	(xmlTextReaderPtr reader, 
          xmlTextReaderErrorFunc f,
          void * arg)

          Register a callback function that will be called on error and warnings. If @f is NULL, the default error and warning handlers are restored.

          diff --git a/doc/devhelp/libxml2-xmlregexp.html b/doc/devhelp/libxml2-xmlregexp.html index 0de6668..e783648 100644 --- a/doc/devhelp/libxml2-xmlregexp.html +++ b/doc/devhelp/libxml2-xmlregexp.html @@ -75,10 +75,10 @@ void xmlExpFree (xmlExpNodePtr xmlExpNewAtom (xmlExpCtxtPtr ctxt,
          const xmlChar * name,
          int len); int xmlRegexpExec (xmlRegexpPtr comp,
          const xmlChar * content); int xmlRegExecPushString (xmlRegExecCtxtPtr exec,
          const xmlChar * value,
          void * data); -int xmlExpGetStart (xmlExpCtxtPtr ctxt,
          xmlExpNodePtr exp,
          const xmlChar ** list,
          int len); +int xmlExpGetStart (xmlExpCtxtPtr ctxt,
          xmlExpNodePtr exp,
          const xmlChar ** tokList,
          int len); xmlExpNodePtr xmlExpParse (xmlExpCtxtPtr ctxt,
          const char * expr); xmlExpCtxtPtr xmlExpNewCtxt (int maxNodes,
          xmlDictPtr dict); -int xmlExpGetLanguage (xmlExpCtxtPtr ctxt,
          xmlExpNodePtr exp,
          const xmlChar ** list,
          int len); +int xmlExpGetLanguage (xmlExpCtxtPtr ctxt,
          xmlExpNodePtr exp,
          const xmlChar ** langList,
          int len); xmlExpNodePtr xmlExpStringDerive (xmlExpCtxtPtr ctxt,
          xmlExpNodePtr exp,
          const xmlChar * str,
          int len); int xmlExpCtxtNbNodes (xmlExpCtxtPtr ctxt); int xmlExpMaxToken (xmlExpNodePtr expr); @@ -178,13 +178,13 @@ The content of this structure is not made public by the API.

          Free an expression context

          ctxt:an expression context

          -

          xmlExpGetLanguage ()

          int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
          xmlExpNodePtr exp,
          const xmlChar ** list,
          int len)
          +

          xmlExpGetLanguage ()

          int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
          xmlExpNodePtr exp,
          const xmlChar ** langList,
          int len)

          Find all the strings used in @exp and store them in @list

          -
          ctxt:the expression context
          exp:the expression
          list:where to store the tokens
          len:the allocated lenght of @list
          Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings
          +
          ctxt:the expression context
          exp:the expression
          langList:where to store the tokens
          len:the allocated lenght of @list
          Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

          -

          xmlExpGetStart ()

          int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
          xmlExpNodePtr exp,
          const xmlChar ** list,
          int len)
          +

          xmlExpGetStart ()

          int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
          xmlExpNodePtr exp,
          const xmlChar ** tokList,
          int len)

          Find all the strings that appears at the start of the languages accepted by @exp and store them in @list. E.g. for (a, b) | c it will return the list [a, c]

          -
          ctxt:the expression context
          exp:the expression
          list:where to store the tokens
          len:the allocated lenght of @list
          Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings
          +
          ctxt:the expression context
          exp:the expression
          tokList:where to store the tokens
          len:the allocated lenght of @list
          Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

          xmlExpIsNillable ()

          int	xmlExpIsNillable		(xmlExpNodePtr exp)

          Finds if the expression is nillable, i.e. if it accepts the empty sequqnce

          diff --git a/doc/devhelp/libxml2-xmlsave.html b/doc/devhelp/libxml2-xmlsave.html index 0c416f4..910a1df 100644 --- a/doc/devhelp/libxml2-xmlsave.html +++ b/doc/devhelp/libxml2-xmlsave.html @@ -50,6 +50,7 @@ typedef xmlSaveCtxt * xmlSaveCtxtPtr xmlSaveToFd (int fd,
          const char * encoding,
          int options); int xmlSaveClose (xmlSaveCtxtPtr ctxt); int xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
          xmlCharEncodingOutputFunc escape); +xmlSaveCtxtPtr xmlSaveToBuffer (xmlBufferPtr buffer,
          const char * encoding,
          int options); xmlSaveCtxtPtr xmlSaveToFilename (const char * filename,
          const char * encoding,
          int options); int xmlSaveFlush (xmlSaveCtxtPtr ctxt); long xmlSaveDoc (xmlSaveCtxtPtr ctxt,
          xmlDocPtr doc); @@ -101,6 +102,10 @@ The content of this structure is not made public by the API.

          xmlSaveSetEscape ()

          int	xmlSaveSetEscape		(xmlSaveCtxtPtr ctxt, 
          xmlCharEncodingOutputFunc escape)

          Set a custom escaping function to be used for text in element content

          ctxt:a document saving context
          escape:the escaping function
          Returns:0 if successful or -1 in case of error.
          +
          +

          xmlSaveToBuffer ()

          xmlSaveCtxtPtr	xmlSaveToBuffer		(xmlBufferPtr buffer, 
          const char * encoding,
          int options)
          +

          Create a document saving context serializing to a buffer with the encoding and the options given

          +
          buffer:a buffer
          encoding:the encoding name to use or NULL
          options:a set of xmlSaveOptions
          Returns:a new serialization context or NULL in case of error.

          xmlSaveToFd ()

          xmlSaveCtxtPtr	xmlSaveToFd		(int fd, 
          const char * encoding,
          int options)

          Create a document saving context serializing to a file descriptor with the encoding and the options given.

          diff --git a/doc/devhelp/libxml2-xmlschemas.html b/doc/devhelp/libxml2-xmlschemas.html index bf5120e..4801ea5 100644 --- a/doc/devhelp/libxml2-xmlschemas.html +++ b/doc/devhelp/libxml2-xmlschemas.html @@ -68,7 +68,7 @@ void xmlSchemaSetValidStructuredErr void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
          xmlSchemaValidityErrorFunc err,
          xmlSchemaValidityWarningFunc warn,
          void * ctx); int xmlSchemaValidCtxtGetOptions (xmlSchemaValidCtxtPtr ctxt); int xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
          const char * filename,
          int options); -int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
          xmlDocPtr doc); +int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
          xmlDocPtr instance); void xmlSchemaFree (xmlSchemaPtr schema); xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt (const char * buffer,
          int size); int xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
          xmlSchemaValidityErrorFunc * err,
          xmlSchemaValidityWarningFunc * warn,
          void ** ctx); @@ -77,6 +77,7 @@ void xmlSchemaSetParserErrors (xmlSchemaValidityWarningFunc (void * ctx,
          const char * msg,
          ... ...); void xmlSchemaDump (FILE * output,
          xmlSchemaPtr schema); void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +void xmlSchemaSetParserStructuredErrors (xmlSchemaParserCtxtPtr ctxt,
          xmlStructuredErrorFunc serror,
          void * ctx); xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
          @@ -90,7 +91,7 @@ void xmlSchemaFreeValidCtxt (xmlChar * name : schema name const xmlChar * targetNamespace : the target namespace const xmlChar * version - const xmlChar * id + const xmlChar * id : Obsolete xmlDocPtr doc xmlSchemaAnnotPtr annot int flags @@ -106,8 +107,8 @@ void xmlSchemaFreeValidCtxt (xmlHashTablePtr idcDef - void * volatiles : Deprecated; not used anymore. + xmlHashTablePtr idcDef : All identity-constraint defs. + void * volatiles : Obsolete } xmlSchema;

          @@ -204,20 +205,20 @@ The content of this structure is not made public by the API.
          ctxt:the schema parser context

          xmlSchemaFreeValidCtxt ()

          void	xmlSchemaFreeValidCtxt		(xmlSchemaValidCtxtPtr ctxt)
          -

          Free the resources associated to the schema validation context

          -
          ctxt:the schema validation context
          +

          +

          ctxt:

          xmlSchemaGetParserErrors ()

          int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
          xmlSchemaValidityErrorFunc * err,
          xmlSchemaValidityWarningFunc * warn,
          void ** ctx)

          Get the callback information used to handle errors for a parser context

          ctxt:a XMl-Schema parser context
          err:the error callback result
          warn:the warning callback result
          ctx:contextual data for the callbacks result
          Returns:-1 in case of failure, 0 otherwise

          xmlSchemaGetValidErrors ()

          int	xmlSchemaGetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
          xmlSchemaValidityErrorFunc * err,
          xmlSchemaValidityWarningFunc * warn,
          void ** ctx)
          -

          Get the error and warning callback informations

          -
          ctxt:a XML-Schema validation context
          err:the error function result
          warn:the warning function result
          ctx:the functions context result
          Returns:-1 in case of error and 0 otherwise
          +

          +

          ctxt:
          err:
          warn:
          ctx:
          Returns:

          xmlSchemaIsValid ()

          int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
          -

          Check if any error was detected during validation.

          -
          ctxt:the schema validation context
          Returns:1 if valid so far, 0 if errors were detected, and -1 in case of internal error.
          +

          +

          ctxt:
          Returns:

          xmlSchemaNewDocParserCtxt ()

          xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)

          Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.

          @@ -232,56 +233,60 @@ The content of this structure is not made public by the API.
          URL:the location of the schema
          Returns:the parser context or NULL in case of error

          xmlSchemaNewValidCtxt ()

          xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
          -

          Create an XML Schemas validation context based on the given schema.

          -
          schema:a precompiled XML Schemas
          Returns:the validation context or NULL in case of error
          +

          +

          schema:
          Returns:

          xmlSchemaParse ()

          xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
          -

          parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change

          +

          parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

          ctxt:a schema validation context
          Returns:the internal XML Schema structure built from the resource or NULL in case of error

          xmlSchemaSAXPlug ()

          xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt, 
          xmlSAXHandlerPtr * sax,
          void ** user_data)
          -

          Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained.

          -
          ctxt:a schema validation context
          sax:a pointer to the original xmlSAXHandlerPtr
          user_data:a pointer to the original SAX user data pointer
          Returns:a pointer to a data structure needed to unplug the validation layer or NULL in case of errors.
          +

          +

          ctxt:
          sax:
          user_data:
          Returns:

          xmlSchemaSAXUnplug ()

          int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
          -

          Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored.

          -
          plug:a data structure returned by xmlSchemaSAXPlug
          Returns:0 in case of success and -1 in case of failure.
          +

          +

          plug:
          Returns:

          xmlSchemaSetParserErrors ()

          void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
          xmlSchemaValidityErrorFunc err,
          xmlSchemaValidityWarningFunc warn,
          void * ctx)

          Set the callback functions used to handle errors for a validation context

          ctxt:a schema validation context
          err:the error callback
          warn:the warning callback
          ctx:contextual data for the callbacks
          +
          +

          xmlSchemaSetParserStructuredErrors ()

          void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt, 
          xmlStructuredErrorFunc serror,
          void * ctx)
          +

          Set the structured error callback

          +
          ctxt:a schema parser context
          serror:the structured error function
          ctx:the functions context

          xmlSchemaSetValidErrors ()

          void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
          xmlSchemaValidityErrorFunc err,
          xmlSchemaValidityWarningFunc warn,
          void * ctx)
          -

          Set the error and warning callback informations

          -
          ctxt:a schema validation context
          err:the error function
          warn:the warning function
          ctx:the functions context
          +

          +

          ctxt:
          err:
          warn:
          ctx:

          xmlSchemaSetValidOptions ()

          int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
          int options)
          -

          Sets the options to be used during the validation.

          -
          ctxt:a schema validation context
          options:a combination of xmlSchemaValidOption
          Returns:0 in case of success, -1 in case of an API error.
          +

          +

          ctxt:
          options:
          Returns:

          xmlSchemaSetValidStructuredErrors ()

          void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
          xmlStructuredErrorFunc serror,
          void * ctx)
          -

          Set the structured error callback

          -
          ctxt:a schema validation context
          serror:the structured error function
          ctx:the functions context
          +

          +

          ctxt:
          serror:
          ctx:

          xmlSchemaValidCtxtGetOptions ()

          int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
          -

          Get the validation context options.

          -
          ctxt:a schema validation context
          Returns:the option combination or -1 on error.
          +

          +

          ctxt:
          Returns:

          -

          xmlSchemaValidateDoc ()

          int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
          xmlDocPtr doc)
          -

          Validate a document tree in memory.

          -
          ctxt:a schema validation context
          doc:a parsed document tree
          Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.
          +

          xmlSchemaValidateFile ()

          int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
          const char * filename,
          int options)
          -

          Do a schemas validation of the given resource, it will use the SAX streamable validation internally.

          -
          ctxt:a schema validation context
          filename:the URI of the instance
          options:a future set of options, currently unused
          Returns:0 if the document is valid, a positive error code number otherwise and -1 in case of an internal or API error.
          +

          +

          ctxt:
          filename:
          options:
          Returns:

          xmlSchemaValidateOneElement ()

          int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
          xmlNodePtr elem)
          -

          Validate a branch of a tree, starting with the given @elem.

          -
          ctxt:a schema validation context
          elem:an element node
          Returns:0 if the element and its subtree is valid, a positive error code number otherwise and -1 in case of an internal or API error.
          +

          +

          ctxt:
          elem:
          Returns:

          xmlSchemaValidateStream ()

          int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
          xmlParserInputBufferPtr input,
          xmlCharEncoding enc,
          xmlSAXHandlerPtr sax,
          void * user_data)
          -

          Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one.

          -
          ctxt:a schema validation context
          input:the input to use for reading the data
          enc:an optional encoding information
          sax:a SAX handler for the resulting events
          user_data:the context to provide to the SAX handler.
          Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.
          +

          +

          ctxt:
          input:
          enc:
          sax:
          user_data:
          Returns:

          diff --git a/doc/devhelp/libxml2-xmlstring.html b/doc/devhelp/libxml2-xmlstring.html index f7abfa3..43da9a4 100644 --- a/doc/devhelp/libxml2-xmlstring.html +++ b/doc/devhelp/libxml2-xmlstring.html @@ -108,7 +108,7 @@ int xmlUTF8Strloc (const
          utf:a sequence of UTF-8 encoded bytes
          len:a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence.
          Returns:the char value or -1 in case of error, and sets *len to the actual number of bytes consumed (0 in case of error)

          xmlStrEqual ()

          int	xmlStrEqual			(const xmlChar * str1, 
          const xmlChar * str2)
          -

          Check if both string are equal of have same content Should be a bit more readable and faster than xmlStrEqual()

          +

          Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp()

          str1:the first xmlChar *
          str2:the second xmlChar *
          Returns:1 if they are equal, 0 if they are different


          xmlStrncat ()

          xmlChar *	xmlStrncat		(xmlChar * cur, 
          const xmlChar * add,
          int len)
          -

          a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add.

          +

          a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned.

          cur:the original xmlChar * array
          add:the xmlChar * array added
          len:the length of @add
          Returns:a new xmlChar *, the original @cur is reallocated if needed and should not be freed

          xmlStrncatNew ()

          xmlChar *	xmlStrncatNew		(const xmlChar * str1, 
          const xmlChar * str2,
          int len)
          -

          same as xmlStrncat, but creates a new string. The original two strings are not freed.

          -
          str1:first xmlChar string
          str2:second xmlChar string
          len:the len of @str2
          Returns:a new xmlChar * or NULL
          +

          same as xmlStrncat, but creates a new string. The original two strings are not freed. If @len is < 0 then the length will be calculated automatically.

          +
          str1:first xmlChar string
          str2:second xmlChar string
          len:the len of @str2 or < 0
          Returns:a new xmlChar * or NULL

          xmlStrncmp ()

          int	xmlStrncmp			(const xmlChar * str1, 
          const xmlChar * str2,
          int len)

          a strncmp for xmlChar's

          diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index edc74cd..c8d5572 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -166,7 +166,9 @@ + + @@ -230,6 +232,7 @@ + @@ -956,13 +959,18 @@ + + + + + @@ -1309,6 +1317,7 @@ + @@ -1327,6 +1336,7 @@ + @@ -1922,6 +1932,7 @@ + @@ -2521,6 +2532,7 @@ + @@ -2757,6 +2769,7 @@ + @@ -2801,6 +2814,7 @@ + @@ -2881,6 +2895,8 @@ + + @@ -2961,6 +2977,7 @@ + diff --git a/doc/downloads.html b/doc/downloads.html index b0347d7..8dcfab9 100644 --- a/doc/downloads.html +++ b/doc/downloads.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Downloads
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Downloads

          Main Menu
          Related links

          The latest versions of libxml2 can be found on the xmlsoft.org server ( HTTP, FTP and rsync are available), there is also +Downloads
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Downloads

          Main Menu
          Related links

          The latest versions of libxml2 can be found on the xmlsoft.org server ( HTTP, FTP and rsync are available), there is also mirrors (Australia( Web), France) or on the Gnome FTP server as source archive , Antonin Sprinzl also provide a mirror in Austria. (NOTE that you need both the libxml(2) and libxml(2)-devel @@ -17,12 +17,13 @@ Windows binaries made by Igor Zlatovic are available in the Igor Zlatkovic is now the maintainer of the Windows port, he provides binaries. -

        • Blastwave provides - Solaris binaries.
        • +
        • Blastwave provides Solaris + binaries.
        • Steve Ball provides Mac Os X binaries.
        • The HP-UX porting center provides HP-UX binaries
        • -
        • Bull provides precompiled RPMs for AIX as patr of their GNOME packages
        • +
        • Bull provides precompiled RPMs for AIX as + patr of their GNOME packages
        • If you know other supported binary ports, please contact me.

          Snapshot:

          Contributions:

          I do accept external contributions, especially if compiling on another diff --git a/doc/encoding.html b/doc/encoding.html index 04d54e7..47171f7 100644 --- a/doc/encoding.html +++ b/doc/encoding.html @@ -7,14 +7,13 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Encodings support
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Encodings support

          Main Menu
          Related links

          If you are not really familiar with Internationalization (usual shortcut +Encodings support
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Encodings support

          Main Menu
          Related links

          If you are not really familiar with Internationalization (usual shortcut is I18N) , Unicode, characters and glyphs, I suggest you read a presentation by Tim Bray on Unicode and why you should care about it.

          If you don't understand why it does not make sense to have a string -without knowing what encoding it uses, then as Joel Spolsky said -please do -not write another line of code until you finish reading that article.. -It is a prerequisite to understand this page, and avoid a lot of problems -with libxml2, XML or text processing in general.

          Table of Content:

          1. What does internationalization support +without knowing what encoding it uses, then as Joel Spolsky said please do not +write another line of code until you finish reading that article.. It is +a prerequisite to understand this page, and avoid a lot of problems with +libxml2, XML or text processing in general.

            Table of Content:

            1. What does internationalization support mean ?
            2. The internal encoding, how and why
            3. @@ -185,7 +184,10 @@ detecting such a tag on input. Except for that the processing is the same set of encodings supported by iconv can be instantly be used by libxml. On a linux machine with glibc-2.1 the list of supported encodings and aliases fill 3 full pages, and include UCS-4, the full set of ISO-Latin encodings, and the -various Japanese ones.

              Encoding aliases

              From 2.2.3, libxml2 has support to register encoding names aliases. The +various Japanese ones.

              To convert from the UTF-8 values returned from the API to another encoding +then it is possible to use the function provided from the encoding module like UTF8Toisolat1, or use the +POSIX iconv() +API directly.

              Encoding aliases

              From 2.2.3, libxml2 has support to register encoding names aliases. The goal is to be able to parse document whose encoding is supported but where the name differs (for example from the default set of names accepted by iconv). The following functions allow to register and handle new aliases for diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index 0bc8934..55a674d 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -15,20 +15,40 @@ install-data-local: $(mkinstalldirs) $(DESTDIR)$(HTML_DIR) -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) -EXTRA_DIST=examples.xsl index.py test3.xml tst.xml test2.xml writer.xml test1.xml examples.xml xpath1.res tree2.res reader3.res tree1.res reader1.res xpath2.res reader4.res io2.res io1.res +EXTRA_DIST=examples.xsl index.py examples.xml test1.xml test2.xml test3.xml tst.xml writer.xml io1.res io2.res reader1.res reader3.res reader4.res tree1.res tree2.res xpath1.res xpath2.res -noinst_PROGRAMS=reader3 io2 reader1 reader2 reader4 testWriter parse3 tree2 tree1 xpath2 parse1 xpath1 io1 parse4 parse2 +noinst_PROGRAMS=io1 io2 parse1 parse2 parse3 parse4 reader1 reader2 reader3 reader4 testWriter tree1 tree2 xpath1 xpath2 -reader3_SOURCES=reader3.c -reader3_LDFLAGS= -reader3_DEPENDENCIES= $(DEPS) -reader3_LDADD= @RDL_LIBS@ $(LDADDS) +io1_SOURCES=io1.c +io1_LDFLAGS= +io1_DEPENDENCIES= $(DEPS) +io1_LDADD= @RDL_LIBS@ $(LDADDS) io2_SOURCES=io2.c io2_LDFLAGS= io2_DEPENDENCIES= $(DEPS) io2_LDADD= @RDL_LIBS@ $(LDADDS) +parse1_SOURCES=parse1.c +parse1_LDFLAGS= +parse1_DEPENDENCIES= $(DEPS) +parse1_LDADD= @RDL_LIBS@ $(LDADDS) + +parse2_SOURCES=parse2.c +parse2_LDFLAGS= +parse2_DEPENDENCIES= $(DEPS) +parse2_LDADD= @RDL_LIBS@ $(LDADDS) + +parse3_SOURCES=parse3.c +parse3_LDFLAGS= +parse3_DEPENDENCIES= $(DEPS) +parse3_LDADD= @RDL_LIBS@ $(LDADDS) + +parse4_SOURCES=parse4.c +parse4_LDFLAGS= +parse4_DEPENDENCIES= $(DEPS) +parse4_LDADD= @RDL_LIBS@ $(LDADDS) + reader1_SOURCES=reader1.c reader1_LDFLAGS= reader1_DEPENDENCIES= $(DEPS) @@ -39,6 +59,11 @@ reader2_LDFLAGS= reader2_DEPENDENCIES= $(DEPS) reader2_LDADD= @RDL_LIBS@ $(LDADDS) +reader3_SOURCES=reader3.c +reader3_LDFLAGS= +reader3_DEPENDENCIES= $(DEPS) +reader3_LDADD= @RDL_LIBS@ $(LDADDS) + reader4_SOURCES=reader4.c reader4_LDFLAGS= reader4_DEPENDENCIES= $(DEPS) @@ -49,50 +74,25 @@ testWriter_LDFLAGS= testWriter_DEPENDENCIES= $(DEPS) testWriter_LDADD= @RDL_LIBS@ $(LDADDS) -parse3_SOURCES=parse3.c -parse3_LDFLAGS= -parse3_DEPENDENCIES= $(DEPS) -parse3_LDADD= @RDL_LIBS@ $(LDADDS) - -tree2_SOURCES=tree2.c -tree2_LDFLAGS= -tree2_DEPENDENCIES= $(DEPS) -tree2_LDADD= @RDL_LIBS@ $(LDADDS) - tree1_SOURCES=tree1.c tree1_LDFLAGS= tree1_DEPENDENCIES= $(DEPS) tree1_LDADD= @RDL_LIBS@ $(LDADDS) -xpath2_SOURCES=xpath2.c -xpath2_LDFLAGS= -xpath2_DEPENDENCIES= $(DEPS) -xpath2_LDADD= @RDL_LIBS@ $(LDADDS) - -parse1_SOURCES=parse1.c -parse1_LDFLAGS= -parse1_DEPENDENCIES= $(DEPS) -parse1_LDADD= @RDL_LIBS@ $(LDADDS) +tree2_SOURCES=tree2.c +tree2_LDFLAGS= +tree2_DEPENDENCIES= $(DEPS) +tree2_LDADD= @RDL_LIBS@ $(LDADDS) xpath1_SOURCES=xpath1.c xpath1_LDFLAGS= xpath1_DEPENDENCIES= $(DEPS) xpath1_LDADD= @RDL_LIBS@ $(LDADDS) -io1_SOURCES=io1.c -io1_LDFLAGS= -io1_DEPENDENCIES= $(DEPS) -io1_LDADD= @RDL_LIBS@ $(LDADDS) - -parse4_SOURCES=parse4.c -parse4_LDFLAGS= -parse4_DEPENDENCIES= $(DEPS) -parse4_LDADD= @RDL_LIBS@ $(LDADDS) - -parse2_SOURCES=parse2.c -parse2_LDFLAGS= -parse2_DEPENDENCIES= $(DEPS) -parse2_LDADD= @RDL_LIBS@ $(LDADDS) +xpath2_SOURCES=xpath2.c +xpath2_LDFLAGS= +xpath2_DEPENDENCIES= $(DEPS) +xpath2_LDADD= @RDL_LIBS@ $(LDADDS) valgrind: $(MAKE) CHECKER='valgrind' tests @@ -100,35 +100,35 @@ valgrind: tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse1 test1.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse2 test2.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse3) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse4 test3.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse3) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse1 test1.xml) + @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse4 test3.xml) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse2 test2.xml) + @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index de15f68..4f45c76 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -38,11 +38,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = reader3$(EXEEXT) io2$(EXEEXT) reader1$(EXEEXT) \ - reader2$(EXEEXT) reader4$(EXEEXT) testWriter$(EXEEXT) \ - parse3$(EXEEXT) tree2$(EXEEXT) tree1$(EXEEXT) xpath2$(EXEEXT) \ - parse1$(EXEEXT) xpath1$(EXEEXT) io1$(EXEEXT) parse4$(EXEEXT) \ - parse2$(EXEEXT) +noinst_PROGRAMS = io1$(EXEEXT) io2$(EXEEXT) parse1$(EXEEXT) \ + parse2$(EXEEXT) parse3$(EXEEXT) parse4$(EXEEXT) \ + reader1$(EXEEXT) reader2$(EXEEXT) reader3$(EXEEXT) \ + reader4$(EXEEXT) testWriter$(EXEEXT) tree1$(EXEEXT) \ + tree2$(EXEEXT) xpath1$(EXEEXT) xpath2$(EXEEXT) subdir = doc/examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -325,15 +325,31 @@ target_alias = @target_alias@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@ DEPS = $(top_builddir)/libxml2.la LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@ -EXTRA_DIST = examples.xsl index.py test3.xml tst.xml test2.xml writer.xml test1.xml examples.xml xpath1.res tree2.res reader3.res tree1.res reader1.res xpath2.res reader4.res io2.res io1.res -reader3_SOURCES = reader3.c -reader3_LDFLAGS = -reader3_DEPENDENCIES = $(DEPS) -reader3_LDADD = @RDL_LIBS@ $(LDADDS) +EXTRA_DIST = examples.xsl index.py examples.xml test1.xml test2.xml test3.xml tst.xml writer.xml io1.res io2.res reader1.res reader3.res reader4.res tree1.res tree2.res xpath1.res xpath2.res +io1_SOURCES = io1.c +io1_LDFLAGS = +io1_DEPENDENCIES = $(DEPS) +io1_LDADD = @RDL_LIBS@ $(LDADDS) io2_SOURCES = io2.c io2_LDFLAGS = io2_DEPENDENCIES = $(DEPS) io2_LDADD = @RDL_LIBS@ $(LDADDS) +parse1_SOURCES = parse1.c +parse1_LDFLAGS = +parse1_DEPENDENCIES = $(DEPS) +parse1_LDADD = @RDL_LIBS@ $(LDADDS) +parse2_SOURCES = parse2.c +parse2_LDFLAGS = +parse2_DEPENDENCIES = $(DEPS) +parse2_LDADD = @RDL_LIBS@ $(LDADDS) +parse3_SOURCES = parse3.c +parse3_LDFLAGS = +parse3_DEPENDENCIES = $(DEPS) +parse3_LDADD = @RDL_LIBS@ $(LDADDS) +parse4_SOURCES = parse4.c +parse4_LDFLAGS = +parse4_DEPENDENCIES = $(DEPS) +parse4_LDADD = @RDL_LIBS@ $(LDADDS) reader1_SOURCES = reader1.c reader1_LDFLAGS = reader1_DEPENDENCIES = $(DEPS) @@ -342,6 +358,10 @@ reader2_SOURCES = reader2.c reader2_LDFLAGS = reader2_DEPENDENCIES = $(DEPS) reader2_LDADD = @RDL_LIBS@ $(LDADDS) +reader3_SOURCES = reader3.c +reader3_LDFLAGS = +reader3_DEPENDENCIES = $(DEPS) +reader3_LDADD = @RDL_LIBS@ $(LDADDS) reader4_SOURCES = reader4.c reader4_LDFLAGS = reader4_DEPENDENCIES = $(DEPS) @@ -350,42 +370,22 @@ testWriter_SOURCES = testWriter.c testWriter_LDFLAGS = testWriter_DEPENDENCIES = $(DEPS) testWriter_LDADD = @RDL_LIBS@ $(LDADDS) -parse3_SOURCES = parse3.c -parse3_LDFLAGS = -parse3_DEPENDENCIES = $(DEPS) -parse3_LDADD = @RDL_LIBS@ $(LDADDS) -tree2_SOURCES = tree2.c -tree2_LDFLAGS = -tree2_DEPENDENCIES = $(DEPS) -tree2_LDADD = @RDL_LIBS@ $(LDADDS) tree1_SOURCES = tree1.c tree1_LDFLAGS = tree1_DEPENDENCIES = $(DEPS) tree1_LDADD = @RDL_LIBS@ $(LDADDS) -xpath2_SOURCES = xpath2.c -xpath2_LDFLAGS = -xpath2_DEPENDENCIES = $(DEPS) -xpath2_LDADD = @RDL_LIBS@ $(LDADDS) -parse1_SOURCES = parse1.c -parse1_LDFLAGS = -parse1_DEPENDENCIES = $(DEPS) -parse1_LDADD = @RDL_LIBS@ $(LDADDS) +tree2_SOURCES = tree2.c +tree2_LDFLAGS = +tree2_DEPENDENCIES = $(DEPS) +tree2_LDADD = @RDL_LIBS@ $(LDADDS) xpath1_SOURCES = xpath1.c xpath1_LDFLAGS = xpath1_DEPENDENCIES = $(DEPS) xpath1_LDADD = @RDL_LIBS@ $(LDADDS) -io1_SOURCES = io1.c -io1_LDFLAGS = -io1_DEPENDENCIES = $(DEPS) -io1_LDADD = @RDL_LIBS@ $(LDADDS) -parse4_SOURCES = parse4.c -parse4_LDFLAGS = -parse4_DEPENDENCIES = $(DEPS) -parse4_LDADD = @RDL_LIBS@ $(LDADDS) -parse2_SOURCES = parse2.c -parse2_LDFLAGS = -parse2_DEPENDENCIES = $(DEPS) -parse2_LDADD = @RDL_LIBS@ $(LDADDS) +xpath2_SOURCES = xpath2.c +xpath2_LDFLAGS = +xpath2_DEPENDENCIES = $(DEPS) +xpath2_LDADD = @RDL_LIBS@ $(LDADDS) all: all-am .SUFFIXES: @@ -710,35 +710,35 @@ valgrind: tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse1 test1.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse2 test2.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse3) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse4 test3.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse3) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse1 test1.xml) + @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse4 test3.xml) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse2 test2.xml) + @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 91122ad..22f730c 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -1,28 +1,28 @@ - - Show how to extract subdocuments with xmlReader - Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader3 - reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp + + Example of custom Input/Output + Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way. + io1 + io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp Daniel Veillard see Copyright for the status of this software. -

              xmlReader
              +
              InputOutput
              - <libxml/xmlreader.h> + <libxml/parser.h> + <libxml/xmlIO.h> + <libxml/xinclude.h> + <libxml/tree.h> - - - - - - - - - - - - + + + + + + + + + @@ -48,6 +48,97 @@ + + Parse an XML file to a tree and free it + Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree + parse1 test1.xml + parse1 test1.xml + Daniel Veillard + see Copyright for the status of this software. +
              Parsing
              + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + +
              + + Parse and validate an XML file to a tree and free the result + Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree. + parse2 test2.xml + parse2 test2.xml + Daniel Veillard + see Copyright for the status of this software. +
              Parsing
              + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + + + + + +
              + + Parse an XML document in memory to a tree and free it + Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree + parse3 + parse3 + Daniel Veillard + see Copyright for the status of this software. +
              Parsing
              + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + +
              + + Parse an XML document chunk by chunk to a tree and free it + Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree + parse4 test3.xml + parse4 test3.xml + Daniel Veillard + see Copyright for the status of this software. +
              Parsing
              + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + + + + +
              Parse an XML file with an xmlReader Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.) @@ -89,17 +180,14 @@ - - - @@ -108,6 +196,27 @@ + + Show how to extract subdocuments with xmlReader + Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader3 + reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp + Daniel Veillard + see Copyright for the status of this software. +
              xmlReader
              + + <libxml/xmlreader.h> + + + + + + + + + + +
              Parse multiple XML files reusing an xmlReader Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.) @@ -120,17 +229,12 @@ <libxml/xmlreader.h> - - - - - @@ -152,9 +256,7 @@ - - @@ -163,10 +265,8 @@ - - @@ -175,32 +275,28 @@ - - - Parse an XML document in memory to a tree and free it - Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree - parse3 - parse3 - Daniel Veillard + + Navigates a tree to print element names + Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. + tree1 filename_or_URL + tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp + Dodji Seketeli see Copyright for the status of this software. -
              Parsing
              +
              Tree
              <libxml/tree.h> <libxml/parser.h> - - - - - - + + +
              @@ -224,73 +320,9 @@ - - - Navigates a tree to print element names - Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. - tree1 filename_or_URL - tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp - Dodji Seketeli - see Copyright for the status of this software. -
              Tree
              - - <libxml/tree.h> - <libxml/parser.h> - - - - - - -
              - - Load a document, locate subelements with XPath, modify said elements and save the resulting document. - Shows how to make a full round-trip from a load/edit/save - xpath2 <xml-file> <xpath-expr> <new-value> - xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp - Aleksey Sanin and Daniel Veillard - see Copyright for the status of this software. -
              XPath
              - - <libxml/parser.h> - <libxml/xpath.h> - <libxml/xpathInternals.h> - <libxml/tree.h> - - - - - - - - - - - - - - - -
              - - Parse an XML file to a tree and free it - Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree - parse1 test1.xml - parse1 test1.xml - Daniel Veillard - see Copyright for the status of this software. -
              Parsing
              - - <libxml/tree.h> - <libxml/parser.h> - - - - -
              Evaluate XPath expression and prints result node set. Shows how to evaluate XPath expression and register known namespaces in XPath context. @@ -324,74 +356,42 @@ - - Example of custom Input/Output - Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way. - io1 - io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp - Daniel Veillard - see Copyright for the status of this software. -
              InputOutput
              - - <libxml/parser.h> - <libxml/xmlIO.h> - <libxml/xinclude.h> - <libxml/tree.h> - - - - - - - -
              - - Parse an XML document chunk by chunk to a tree and free it - Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree - parse4 test3.xml - parse4 test3.xml - Daniel Veillard + + Load a document, locate subelements with XPath, modify said elements and save the resulting document. + Shows how to make a full round-trip from a load/edit/save + xpath2 <xml-file> <xpath-expr> <new-value> + xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp + Aleksey Sanin and Daniel Veillard see Copyright for the status of this software. -
              Parsing
              +
              XPath
              - <libxml/tree.h> <libxml/parser.h> - - - - - - - -
              - - Parse and validate an XML file to a tree and free the result - Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree. - parse2 test2.xml - parse2 test2.xml - Daniel Veillard - see Copyright for the status of this software. -
              Parsing
              - + <libxml/xpath.h> + <libxml/xpathInternals.h> <libxml/tree.h> - <libxml/parser.h> - - - - - + + + + + + + + + + +
              - - - - - + + + + + @@ -401,15 +401,15 @@ - + - + @@ -430,12 +430,12 @@ - - - - - + + + + + @@ -447,9 +447,9 @@ + - @@ -458,12 +458,12 @@ - + - - + + - + @@ -479,40 +479,40 @@ - + - - + + - + - + - + - + - - - - - + + + + + @@ -566,25 +566,25 @@ - + - + - + - + - + @@ -647,15 +647,15 @@ - + - + @@ -692,28 +692,28 @@ - + - + - + - + - + - + @@ -721,27 +721,27 @@
              - +
              - - + +
              - +
              - +
              - +
              diff --git a/doc/help.html b/doc/help.html index 3148b84..a9925b2 100644 --- a/doc/help.html +++ b/doc/help.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -How to help
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              How to help

              Main Menu
              Related links

              You can help the project in various ways, the best thing to do first is to +How to help
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              How to help

              Main Menu
              Related links

              You can help the project in various ways, the best thing to do first is to subscribe to the mailing-list as explained before, check the archives and the Gnome bug database:

              1. Provide patches when you find problems.
              2. Provide the diffs when you port libxml2 to a new platform. They may not diff --git a/doc/html/libxml-HTMLtree.html b/doc/html/libxml-HTMLtree.html index bc9bbe9..55ff739 100644 --- a/doc/html/libxml-HTMLtree.html +++ b/doc/html/libxml-HTMLtree.html @@ -14,6 +14,7 @@ A:link, A:visited, A:active { text-decoration: underline }
                void	htmlDocContentDumpOutput	(xmlOutputBufferPtr buf, 
                xmlDocPtr cur,
                const char * encoding)
                int	htmlDocDump			(FILE * f, 
                xmlDocPtr cur)
                void	htmlDocDumpMemory		(xmlDocPtr cur, 
                xmlChar ** mem,
                int * size)
                +
                void	htmlDocDumpMemoryFormat		(xmlDocPtr cur, 
                xmlChar ** mem,
                int * size,
                int format)
                const xmlChar *	htmlGetMetaEncoding	(htmlDocPtr doc)
                int	htmlIsBooleanAttr		(const xmlChar * name)
                htmlDocPtr	htmlNewDoc		(const xmlChar * URI, 
                const xmlChar * ExternalID)
                @@ -41,7 +42,9 @@ A:link, A:visited, A:active { text-decoration: underline }

                Dump an HTML document to an open FILE.

                f:the FILE*
                cur:the document
                Returns:the number of byte written or -1 in case of failure.

                Function: htmlDocDumpMemory

                void	htmlDocDumpMemory		(xmlDocPtr cur, 
                xmlChar ** mem,
                int * size)

                Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

                -
                cur:the document
                mem:OUT: the memory pointer
                size:OUT: the memory length

                Function: htmlGetMetaEncoding

                const xmlChar *	htmlGetMetaEncoding	(htmlDocPtr doc)
                +
                cur:the document
                mem:OUT: the memory pointer
                size:OUT: the memory length

                Function: htmlDocDumpMemoryFormat

                void	htmlDocDumpMemoryFormat		(xmlDocPtr cur, 
                xmlChar ** mem,
                int * size,
                int format)
                +

                Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

                +
                cur:the document
                mem:OUT: the memory pointer
                size:OUT: the memory length
                format:should formatting spaces been added

                Function: htmlGetMetaEncoding

                const xmlChar *	htmlGetMetaEncoding	(htmlDocPtr doc)

                Encoding definition lookup in the Meta tags

                doc:the document
                Returns:the current encoding as flagged in the HTML source

                Function: htmlIsBooleanAttr

                int	htmlIsBooleanAttr		(const xmlChar * name)

                Determine if a given attribute is a boolean attribute.

                diff --git a/doc/html/libxml-pattern.html b/doc/html/libxml-pattern.html index 2415881..ac1de26 100644 --- a/doc/html/libxml-pattern.html +++ b/doc/html/libxml-pattern.html @@ -30,6 +30,8 @@ The content of this structure is not made public by the API.
                int	xmlStreamPop			(xmlStreamCtxtPtr stream)
                int	xmlStreamPush			(xmlStreamCtxtPtr stream, 
                const xmlChar * name,
                const xmlChar * ns)
                int	xmlStreamPushAttr		(xmlStreamCtxtPtr stream, 
                const xmlChar * name,
                const xmlChar * ns)
                +
                int	xmlStreamPushNode		(xmlStreamCtxtPtr stream, 
                const xmlChar * name,
                const xmlChar * ns,
                int nodeType)
                +
                int	xmlStreamWantsAnyNode		(xmlStreamCtxtPtr streamCtxt)

                Description

                Structure xmlPattern

                Structure xmlPattern
                struct _xmlPattern { The content of this structure is not made public by the API. @@ -64,7 +66,11 @@ The content of this structure is not made public by the API.
                pattern:the pattern to compile
                dict:an optional dictionary for interned strings
                flags:compilation flags, see xmlPatternFlags
                namespaces:the prefix definitions, array of [URI, prefix] or NULL
                Returns:the compiled form of the pattern or NULL in case of error

                Function: xmlStreamPop

                int	xmlStreamPop			(xmlStreamCtxtPtr stream)

                push one level from the stream.

                stream:the stream context
                Returns:-1 in case of error, 0 otherwise.

                Function: xmlStreamPush

                int	xmlStreamPush			(xmlStreamCtxtPtr stream, 
                const xmlChar * name,
                const xmlChar * ns)
                -

                Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.

                +

                Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an element-node.

                stream:the stream context
                name:the current name
                ns:the namespace name
                Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

                Function: xmlStreamPushAttr

                int	xmlStreamPushAttr		(xmlStreamCtxtPtr stream, 
                const xmlChar * name,
                const xmlChar * ns)
                -

                Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.

                -
                stream:the stream context
                name:the current name
                ns:the namespace name
                Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

                Daniel Veillard

              +

              Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an attribute-node.

              +
              stream:the stream context
              name:the current name
              ns:the namespace name
              Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

              Function: xmlStreamPushNode

              int	xmlStreamPushNode		(xmlStreamCtxtPtr stream, 
              const xmlChar * name,
              const xmlChar * ns,
              int nodeType)
              +

              Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Different from xmlStreamPush() this function can be fed with nodes of type: element-, attribute-, text-, cdata-section-, comment- and processing-instruction-node.

              +
              stream:the stream context
              name:the current name
              ns:the namespace name
              nodeType:the type of the node being pushed
              Returns:-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

              Function: xmlStreamWantsAnyNode

              int	xmlStreamWantsAnyNode		(xmlStreamCtxtPtr streamCtxt)
              +

              Query if the streaming pattern additionally needs to be fed with text-, cdata-section-, comment- and processing-instruction-nodes. If the result is 0 then only element-nodes and attribute-nodes need to be pushed.

              +
              streamCtxt:the stream context
              Returns:1 in case of need of nodes of the above described types, 0 otherwise. -1 on API errors.

              Daniel Veillard

              diff --git a/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html index 637f27f..fd95083 100644 --- a/doc/html/libxml-relaxng.html +++ b/doc/html/libxml-relaxng.html @@ -131,7 +131,7 @@ The content of this structure is not made public by the API.
              URL:the location of the schema
              Returns:the parser context or NULL in case of error

              Function: xmlRelaxNGNewValidCtxt

              xmlRelaxNGValidCtxtPtr	xmlRelaxNGNewValidCtxt	(xmlRelaxNGPtr schema)

              Create an XML RelaxNGs validation context based on the given schema

              schema:a precompiled XML RelaxNGs
              Returns:the validation context or NULL in case of error

              Function: xmlRelaxNGParse

              xmlRelaxNGPtr	xmlRelaxNGParse		(xmlRelaxNGParserCtxtPtr ctxt)
              -

              parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change

              +

              parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

              ctxt:a Relax-NG parser context
              Returns:the internal XML RelaxNG structure built from the resource or NULL in case of error

              Function: xmlRelaxNGSetParserErrors

              void	xmlRelaxNGSetParserErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
              xmlRelaxNGValidityErrorFunc err,
              xmlRelaxNGValidityWarningFunc warn,
              void * ctx)

              Set the callback functions used to handle errors for a validation context

              ctxt:a Relax-NG validation context
              err:the error callback
              warn:the warning callback
              ctx:contextual data for the callbacks

              Function: xmlRelaxNGSetValidErrors

              void	xmlRelaxNGSetValidErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
              xmlRelaxNGValidityErrorFunc err,
              xmlRelaxNGValidityWarningFunc warn,
              void * ctx)
              diff --git a/doc/html/libxml-schemasInternals.html b/doc/html/libxml-schemasInternals.html index 26b8df2..b25f070 100644 --- a/doc/html/libxml-schemasInternals.html +++ b/doc/html/libxml-schemasInternals.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module schemasInternals from libxml2
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              Module schemasInternals from libxml2

              API Menu
              API Indexes
              Related links

              internal interfaces for the XML Schemas handling and schema validity checking

              Table of Contents

              #define XML_SCHEMAS_ANYATTR_LAX
              #define XML_SCHEMAS_ANYATTR_SKIP
              #define XML_SCHEMAS_ANYATTR_STRICT
              #define XML_SCHEMAS_ANY_LAX
              #define XML_SCHEMAS_ANY_SKIP
              #define XML_SCHEMAS_ANY_STRICT
              #define XML_SCHEMAS_ATTRGROUP_GLOBAL
              #define XML_SCHEMAS_ATTRGROUP_MARKED
              #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
              #define XML_SCHEMAS_ATTR_FIXED
              #define XML_SCHEMAS_ATTR_GLOBAL
              #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
              #define XML_SCHEMAS_ATTR_NSDEFAULT
              #define XML_SCHEMAS_ATTR_USE_OPTIONAL
              #define XML_SCHEMAS_ATTR_USE_PROHIBITED
              #define XML_SCHEMAS_ATTR_USE_REQUIRED
              #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION
              #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
              #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION
              #define XML_SCHEMAS_ELEM_ABSTRACT
              #define XML_SCHEMAS_ELEM_BLOCK_ABSENT
              #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION
              #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION
              #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION
              #define XML_SCHEMAS_ELEM_CIRCULAR
              #define XML_SCHEMAS_ELEM_DEFAULT
              #define XML_SCHEMAS_ELEM_FINAL_ABSENT
              #define XML_SCHEMAS_ELEM_FINAL_EXTENSION
              #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION
              #define XML_SCHEMAS_ELEM_FIXED
              #define XML_SCHEMAS_ELEM_GLOBAL
              #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED
              #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
              #define XML_SCHEMAS_ELEM_NILLABLE
              #define XML_SCHEMAS_ELEM_NSDEFAULT
              #define XML_SCHEMAS_ELEM_REF
              #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD
              #define XML_SCHEMAS_ELEM_TOPLEVEL
              #define XML_SCHEMAS_FACET_COLLAPSE
              #define XML_SCHEMAS_FACET_PRESERVE
              #define XML_SCHEMAS_FACET_REPLACE
              #define XML_SCHEMAS_FACET_UNKNOWN
              #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION
              #define XML_SCHEMAS_FINAL_DEFAULT_LIST
              #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION
              #define XML_SCHEMAS_FINAL_DEFAULT_UNION
              #define XML_SCHEMAS_INCLUDING_CONVERT_NS
              #define XML_SCHEMAS_QUALIF_ATTR
              #define XML_SCHEMAS_QUALIF_ELEM
              #define XML_SCHEMAS_TYPE_ABSTRACT
              #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT
              #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION
              #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION
              #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE
              #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
              #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
              #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE
              #define XML_SCHEMAS_TYPE_FINAL_DEFAULT
              #define XML_SCHEMAS_TYPE_FINAL_EXTENSION
              #define XML_SCHEMAS_TYPE_FINAL_LIST
              #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION
              #define XML_SCHEMAS_TYPE_FINAL_UNION
              #define XML_SCHEMAS_TYPE_FIXUP_1
              #define XML_SCHEMAS_TYPE_GLOBAL
              #define XML_SCHEMAS_TYPE_HAS_FACETS
              #define XML_SCHEMAS_TYPE_INTERNAL_INVALID
              #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
              #define XML_SCHEMAS_TYPE_MARKED
              #define XML_SCHEMAS_TYPE_MIXED
              #define XML_SCHEMAS_TYPE_NORMVALUENEEDED
              #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
              #define XML_SCHEMAS_TYPE_VARIETY_ABSENT
              #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC
              #define XML_SCHEMAS_TYPE_VARIETY_LIST
              #define XML_SCHEMAS_TYPE_VARIETY_UNION
              #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE
              #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE
              #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE
              #define XML_SCHEMAS_WILDCARD_COMPLETE
              Structure xmlSchemaAnnot
              struct _xmlSchemaAnnot + Module schemasInternals from libxml2
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              Module schemasInternals from libxml2

              API Menu
              API Indexes
              Related links

              internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not garanteed to be API or ABI stable !

              Table of Contents

              #define XML_SCHEMAS_ANYATTR_LAX
              #define XML_SCHEMAS_ANYATTR_SKIP
              #define XML_SCHEMAS_ANYATTR_STRICT
              #define XML_SCHEMAS_ANY_LAX
              #define XML_SCHEMAS_ANY_SKIP
              #define XML_SCHEMAS_ANY_STRICT
              #define XML_SCHEMAS_ATTRGROUP_GLOBAL
              #define XML_SCHEMAS_ATTRGROUP_HAS_REFS
              #define XML_SCHEMAS_ATTRGROUP_MARKED
              #define XML_SCHEMAS_ATTRGROUP_REDEFINED
              #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
              #define XML_SCHEMAS_ATTR_FIXED
              #define XML_SCHEMAS_ATTR_GLOBAL
              #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
              #define XML_SCHEMAS_ATTR_NSDEFAULT
              #define XML_SCHEMAS_ATTR_USE_OPTIONAL
              #define XML_SCHEMAS_ATTR_USE_PROHIBITED
              #define XML_SCHEMAS_ATTR_USE_REQUIRED
              #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION
              #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
              #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION
              #define XML_SCHEMAS_ELEM_ABSTRACT
              #define XML_SCHEMAS_ELEM_BLOCK_ABSENT
              #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION
              #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION
              #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION
              #define XML_SCHEMAS_ELEM_CIRCULAR
              #define XML_SCHEMAS_ELEM_DEFAULT
              #define XML_SCHEMAS_ELEM_FINAL_ABSENT
              #define XML_SCHEMAS_ELEM_FINAL_EXTENSION
              #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION
              #define XML_SCHEMAS_ELEM_FIXED
              #define XML_SCHEMAS_ELEM_GLOBAL
              #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED
              #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
              #define XML_SCHEMAS_ELEM_NILLABLE
              #define XML_SCHEMAS_ELEM_NSDEFAULT
              #define XML_SCHEMAS_ELEM_REF
              #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD
              #define XML_SCHEMAS_ELEM_TOPLEVEL
              #define XML_SCHEMAS_FACET_COLLAPSE
              #define XML_SCHEMAS_FACET_PRESERVE
              #define XML_SCHEMAS_FACET_REPLACE
              #define XML_SCHEMAS_FACET_UNKNOWN
              #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION
              #define XML_SCHEMAS_FINAL_DEFAULT_LIST
              #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION
              #define XML_SCHEMAS_FINAL_DEFAULT_UNION
              #define XML_SCHEMAS_INCLUDING_CONVERT_NS
              #define XML_SCHEMAS_QUALIF_ATTR
              #define XML_SCHEMAS_QUALIF_ELEM
              #define XML_SCHEMAS_TYPE_ABSTRACT
              #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT
              #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION
              #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION
              #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE
              #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
              #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
              #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE
              #define XML_SCHEMAS_TYPE_FINAL_DEFAULT
              #define XML_SCHEMAS_TYPE_FINAL_EXTENSION
              #define XML_SCHEMAS_TYPE_FINAL_LIST
              #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION
              #define XML_SCHEMAS_TYPE_FINAL_UNION
              #define XML_SCHEMAS_TYPE_FIXUP_1
              #define XML_SCHEMAS_TYPE_GLOBAL
              #define XML_SCHEMAS_TYPE_HAS_FACETS
              #define XML_SCHEMAS_TYPE_INTERNAL_INVALID
              #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
              #define XML_SCHEMAS_TYPE_MARKED
              #define XML_SCHEMAS_TYPE_MIXED
              #define XML_SCHEMAS_TYPE_NORMVALUENEEDED
              #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
              #define XML_SCHEMAS_TYPE_REDEFINED
              #define XML_SCHEMAS_TYPE_VARIETY_ABSENT
              #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC
              #define XML_SCHEMAS_TYPE_VARIETY_LIST
              #define XML_SCHEMAS_TYPE_VARIETY_UNION
              #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE
              #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE
              #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE
              #define XML_SCHEMAS_WILDCARD_COMPLETE
              Structure xmlSchemaAnnot
              struct _xmlSchemaAnnot
              Typedef xmlSchemaAnnot * xmlSchemaAnnotPtr
               
              Structure xmlSchemaAttribute
              struct _xmlSchemaAttribute
              Structure xmlSchemaAttributeGroup
              struct _xmlSchemaAttributeGroup @@ -50,7 +50,9 @@ The content of this structure is not made public by the API.

              Macro: XML_SCHEMAS_ANY_SKIP

              #define XML_SCHEMAS_ANY_SKIP

              Skip unknown attribute from validation

              Macro: XML_SCHEMAS_ANY_STRICT

              #define XML_SCHEMAS_ANY_STRICT

              Used by wildcards. Apply strict validation rules

              Macro: XML_SCHEMAS_ATTRGROUP_GLOBAL

              #define XML_SCHEMAS_ATTRGROUP_GLOBAL

              The attribute wildcard has been already builded.

              +

              Macro: XML_SCHEMAS_ATTRGROUP_HAS_REFS

              #define XML_SCHEMAS_ATTRGROUP_HAS_REFS

              Whether this attr. group contains attr. group references.

              Macro: XML_SCHEMAS_ATTRGROUP_MARKED

              #define XML_SCHEMAS_ATTRGROUP_MARKED

              Marks the attr group as marked; used for circular checks.

              +

              Macro: XML_SCHEMAS_ATTRGROUP_REDEFINED

              #define XML_SCHEMAS_ATTRGROUP_REDEFINED

              The attr group was redefined.

              Macro: XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED

              #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED

              The attribute wildcard has been already builded.

              Macro: XML_SCHEMAS_ATTR_FIXED

              #define XML_SCHEMAS_ATTR_FIXED

              the attribute has a fixed value

              Macro: XML_SCHEMAS_ATTR_GLOBAL

              #define XML_SCHEMAS_ATTR_GLOBAL

              allow elements in no namespace

              @@ -114,7 +116,8 @@ The content of this structure is not made public by the API.

              Macro: XML_SCHEMAS_TYPE_MIXED

              #define XML_SCHEMAS_TYPE_MIXED

              the element content type is mixed

              Macro: XML_SCHEMAS_TYPE_NORMVALUENEEDED

              #define XML_SCHEMAS_TYPE_NORMVALUENEEDED

              indicates if the facets (pattern) need a normalized value

              Macro: XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD

              #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD

              the complexType owns an attribute wildcard, i.e. it can be freed by the complexType

              -

              Macro: XML_SCHEMAS_TYPE_VARIETY_ABSENT

              #define XML_SCHEMAS_TYPE_VARIETY_ABSENT

              the simpleType has a variety of "absent".

              +

              Macro: XML_SCHEMAS_TYPE_REDEFINED

              #define XML_SCHEMAS_TYPE_REDEFINED

              The type was redefined.

              +

              Macro: XML_SCHEMAS_TYPE_VARIETY_ABSENT

              #define XML_SCHEMAS_TYPE_VARIETY_ABSENT

              the simpleType has a variety of "absent". TODO: Actually not necessary :-/, since if none of the variety flags occur then it's automatically absent.

              Macro: XML_SCHEMAS_TYPE_VARIETY_ATOMIC

              #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC

              the simpleType has a variety of "union".

              Macro: XML_SCHEMAS_TYPE_VARIETY_LIST

              #define XML_SCHEMAS_TYPE_VARIETY_LIST

              the simpleType has a variety of "list".

              Macro: XML_SCHEMAS_TYPE_VARIETY_UNION

              #define XML_SCHEMAS_TYPE_VARIETY_UNION

              the simpleType has a variety of "union".

              @@ -126,40 +129,41 @@ The content of this structure is not made public by the API. struct _xmlSchemaAnnot * next xmlNodePtr content : the annotation }

              Structure xmlSchemaAttribute

              Structure xmlSchemaAttribute
              struct _xmlSchemaAttribute { - xmlSchemaTypeType type : The kind of type - struct _xmlSchemaAttribute * next : the next attribute if in a group ... - const xmlChar * name : name of the declaration or empty if par - const xmlChar * id - const xmlChar * ref : the local name of the attribute decl. i - const xmlChar * refNs : the ns URI of the attribute decl. if a + xmlSchemaTypeType type + struct _xmlSchemaAttribute * next : the next attribute (not used?) + const xmlChar * name : the name of the declaration + const xmlChar * id : Deprecated; not used + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used const xmlChar * typeName : the local name of the type definition const xmlChar * typeNs : the ns URI of the type definition xmlSchemaAnnotPtr annot - xmlSchemaTypePtr base : obsolete, not used - int occurs - const xmlChar * defValue + xmlSchemaTypePtr base : Deprecated; not used + int occurs : Deprecated; not used + const xmlChar * defValue : The initial value of the value constrai xmlSchemaTypePtr subtypes : the type definition xmlNodePtr node const xmlChar * targetNamespace int flags - const xmlChar * refPrefix - xmlSchemaValPtr defVal - xmlSchemaAttributePtr refDecl + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaValPtr defVal : The compiled value constraint + xmlSchemaAttributePtr refDecl : Deprecated; not used }

              Structure xmlSchemaAttributeGroup

              Structure xmlSchemaAttributeGroup
              struct _xmlSchemaAttributeGroup { xmlSchemaTypeType type : The kind of type struct _xmlSchemaAttribute * next : the next attribute if in a group ... const xmlChar * name const xmlChar * id - const xmlChar * ref - const xmlChar * refNs + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used xmlSchemaAnnotPtr annot - xmlSchemaAttributePtr attributes + xmlSchemaAttributePtr attributes : Deprecated; not used xmlNodePtr node int flags xmlSchemaWildcardPtr attributeWildcard - const xmlChar * refPrefix - xmlSchemaAttributeGroupPtr refItem : The referenced attribute group - const xmlChar * targetNamespace : xmlSchemaAttributeGroupPtr redef Redefi + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaAttributeGroupPtr refItem : Deprecated; not used + const xmlChar * targetNamespace + void * attrUses }

              Structure xmlSchemaAttributeLink

              Structure xmlSchemaAttributeLink
              struct _xmlSchemaAttributeLink { struct _xmlSchemaAttributeLink * next : the next attribute link ... struct _xmlSchemaAttribute * attr : the linked attribute @@ -169,23 +173,23 @@ The content of this structure is not made public by the API. XML_SCHEMA_CONTENT_ELEMENTS = 2 XML_SCHEMA_CONTENT_MIXED = 3 XML_SCHEMA_CONTENT_SIMPLE = 4 - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5 : obsolete, not used + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5 : Obsolete XML_SCHEMA_CONTENT_BASIC = 6 XML_SCHEMA_CONTENT_ANY = 7 }

              Structure xmlSchemaElement

              Structure xmlSchemaElement
              struct _xmlSchemaElement { xmlSchemaTypeType type : The kind of type - struct _xmlSchemaType * next : the next type if in a sequence ... + struct _xmlSchemaType * next : Not used? const xmlChar * name - const xmlChar * id - const xmlChar * ref : the local name of the element declarati - const xmlChar * refNs : the ns URI of the element declaration i + const xmlChar * id : Deprecated; not used + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used xmlSchemaAnnotPtr annot xmlSchemaTypePtr subtypes : the type definition xmlSchemaAttributePtr attributes xmlNodePtr node - int minOccurs - int maxOccurs + int minOccurs : Deprecated; not used + int maxOccurs : Deprecated; not used int flags const xmlChar * targetNamespace const xmlChar * namedType @@ -193,24 +197,24 @@ The content of this structure is not made public by the API. const xmlChar * substGroup const xmlChar * substGroupNs const xmlChar * scope - const xmlChar * value + const xmlChar * value : The original value of the value constra struct _xmlSchemaElement * refDecl : This will now be used for the substitut - xmlRegexpPtr contModel + xmlRegexpPtr contModel : Obsolete for WXS, maybe used for RelaxN xmlSchemaContentType contentType - const xmlChar * refPrefix - xmlSchemaValPtr defVal - void * idcs + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaValPtr defVal : The compiled value contraint. + void * idcs : The identity-constraint defs }

              Structure xmlSchemaFacet

              Structure xmlSchemaFacet
              struct _xmlSchemaFacet { xmlSchemaTypeType type : The kind of type struct _xmlSchemaFacet * next : the next type if in a sequence ... - const xmlChar * value - const xmlChar * id + const xmlChar * value : The original value + const xmlChar * id : Obsolete xmlSchemaAnnotPtr annot xmlNodePtr node - int fixed + int fixed : XML_SCHEMAS_FACET_PRESERVE, etc. int whitespace - xmlSchemaValPtr val - xmlRegexpPtr regexp + xmlSchemaValPtr val : The compiled value + xmlRegexpPtr regexp : The regex for patterns }

              Structure xmlSchemaFacetLink

              Structure xmlSchemaFacetLink
              struct _xmlSchemaFacetLink { struct _xmlSchemaFacetLink * next : the next facet link ... xmlSchemaFacetPtr facet : the linked facet @@ -224,35 +228,36 @@ The content of this structure is not made public by the API. xmlSchemaTypeType type : The kind of type struct _xmlSchemaType * next : the next type if in a sequence ... const xmlChar * name - const xmlChar * id - const xmlChar * ref - const xmlChar * refNs + const xmlChar * id : Deprecated; not used + const xmlChar * ref : Deprecated; not used + const xmlChar * refNs : Deprecated; not used xmlSchemaAnnotPtr annot xmlSchemaTypePtr subtypes - xmlSchemaAttributePtr attributes + xmlSchemaAttributePtr attributes : Deprecated; not used xmlNodePtr node - int minOccurs - int maxOccurs + int minOccurs : Deprecated; not used + int maxOccurs : Deprecated; not used int flags xmlSchemaContentType contentType - const xmlChar * base - const xmlChar * baseNs - xmlSchemaTypePtr baseType - xmlSchemaFacetPtr facets - struct _xmlSchemaType * redef : possible redefinitions for the type - int recurse - xmlSchemaAttributeLinkPtr attributeUses + const xmlChar * base : Base type's local name + const xmlChar * baseNs : Base type's target namespace + xmlSchemaTypePtr baseType : The base type component + xmlSchemaFacetPtr facets : Local facets + struct _xmlSchemaType * redef : Deprecated; not used + int recurse : Obsolete + xmlSchemaAttributeLinkPtr * attributeUses : Deprecated; not used xmlSchemaWildcardPtr attributeWildcard - int builtInType - xmlSchemaTypeLinkPtr memberTypes - xmlSchemaFacetLinkPtr facetSet - const xmlChar * refPrefix - xmlSchemaTypePtr contentTypeDef - xmlRegexpPtr contModel + int builtInType : Type of built-in types. + xmlSchemaTypeLinkPtr memberTypes : member-types if a union type. + xmlSchemaFacetLinkPtr facetSet : All facets (incl. inherited) + const xmlChar * refPrefix : Deprecated; not used + xmlSchemaTypePtr contentTypeDef : Used for the simple content of complex + xmlRegexpPtr contModel : Holds the automaton of the content mode const xmlChar * targetNamespace + void * attrUses }

              Structure xmlSchemaTypeLink

              Structure xmlSchemaTypeLink
              struct _xmlSchemaTypeLink { struct _xmlSchemaTypeLink * next : the next type link ... - xmlSchemaTypePtr type : the linked typ + xmlSchemaTypePtr type : the linked type }

              Enum xmlSchemaTypeType

              Enum xmlSchemaTypeType {
                   XML_SCHEMA_TYPE_BASIC = 1 : A built-in datatype
                   XML_SCHEMA_TYPE_ANY = 2
              @@ -279,6 +284,7 @@ The content of this structure is not made public by the API.
                   XML_SCHEMA_TYPE_IDC_KEY = 23
                   XML_SCHEMA_TYPE_IDC_KEYREF = 24
                   XML_SCHEMA_TYPE_PARTICLE = 25
              +    XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
                   XML_SCHEMA_FACET_MININCLUSIVE = 1000
                   XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
                   XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
              @@ -292,6 +298,7 @@ The content of this structure is not made public by the API.
                   XML_SCHEMA_FACET_MAXLENGTH = 1010
                   XML_SCHEMA_FACET_MINLENGTH = 1011
                   XML_SCHEMA_EXTRA_QNAMEREF = 2000
              +    XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
               }
               

              Structure xmlSchemaVal

              Structure xmlSchemaVal
              struct _xmlSchemaVal { The content of this structure is not made public by the API. @@ -346,11 +353,11 @@ The content of this structure is not made public by the API. }

              Structure xmlSchemaWildcard

              Structure xmlSchemaWildcard
              struct _xmlSchemaWildcard { xmlSchemaTypeType type : The kind of type - const xmlChar * id + const xmlChar * id : Deprecated; not used xmlSchemaAnnotPtr annot xmlNodePtr node - int minOccurs - int maxOccurs + int minOccurs : Deprecated; not used + int maxOccurs : Deprecated; not used int processContents int any : Indicates if the ns constraint is of ## xmlSchemaWildcardNsPtr nsSet : The list of allowed namespaces diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index 5a33b38..af8fefc 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -782,7 +782,7 @@ A:link, A:visited, A:active { text-decoration: underline }
              doc:the document
              content:the text content
              len:the text len.
              Returns:a pointer to the new node object.

              Function: xmlNewDtd

              xmlDtdPtr	xmlNewDtd		(xmlDocPtr doc, 
              const xmlChar * name,
              const xmlChar * ExternalID,
              const xmlChar * SystemID)

              Creation of a new DTD for the external subset. To create an internal subset, use xmlCreateIntSubset().

              doc:the document pointer
              name:the DTD name
              ExternalID:the external ID
              SystemID:the system ID
              Returns:a pointer to the new DTD structure

              Function: xmlNewGlobalNs

              xmlNsPtr	xmlNewGlobalNs		(xmlDocPtr doc, 
              const xmlChar * href,
              const xmlChar * prefix)
              -

              Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!! It now create a namespace on the root element of the document if found.

              +

              Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!!

              doc:the document carrying the namespace
              href:the URI associated
              prefix:the prefix for the namespace
              Returns:NULL this functionality had been removed

              Function: xmlNewNode

              xmlNodePtr	xmlNewNode		(xmlNsPtr ns, 
              const xmlChar * name)

              Creation of a new node element. @ns is optional (NULL).

              ns:namespace if any
              name:the node name
              Returns:a pointer to the new node object. Uses xmlStrdup() to make copy of @name.

              Function: xmlNewNodeEatName

              xmlNodePtr	xmlNewNodeEatName	(xmlNsPtr ns, 
              xmlChar * name)
              diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html index 8ec2c68..631c49c 100644 --- a/doc/html/libxml-valid.html +++ b/doc/html/libxml-valid.html @@ -76,7 +76,7 @@ The content of this structure is not made public by the API.
              void	xmlSprintfElementContent	(char * buf, 
              xmlElementContentPtr content,
              int englob)
              int	xmlValidBuildContentModel	(xmlValidCtxtPtr ctxt, 
              xmlElementPtr elem)
              xmlChar *	xmlValidCtxtNormalizeAttributeValue	(xmlValidCtxtPtr ctxt, 
              xmlDocPtr doc,
              xmlNodePtr elem,
              const xmlChar * name,
              const xmlChar * value)
              -
              int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
              const xmlChar ** list,
              int * len,
              int max)
              +
              int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
              const xmlChar ** names,
              int * len,
              int max)
              int	xmlValidGetValidElements	(xmlNode * prev, 
              xmlNode * next,
              const xmlChar ** names,
              int max)
              xmlChar *	xmlValidNormalizeAttributeValue	(xmlDocPtr doc, 
              xmlNodePtr elem,
              const xmlChar * name,
              const xmlChar * value)
              int	xmlValidateAttributeDecl	(xmlValidCtxtPtr ctxt, 
              xmlDocPtr doc,
              xmlAttributePtr attr)
              @@ -232,9 +232,9 @@ The content of this structure is not made public by the API.

              (Re)Build the automata associated to the content model of this element

              ctxt:a validation context
              elem:an element declaration node
              Returns:1 in case of success, 0 in case of error

              Function: xmlValidCtxtNormalizeAttributeValue

              xmlChar *	xmlValidCtxtNormalizeAttributeValue	(xmlValidCtxtPtr ctxt, 
              xmlDocPtr doc,
              xmlNodePtr elem,
              const xmlChar * name,
              const xmlChar * value)

              Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character. Also check VC: Standalone Document Declaration in P32, and update ctxt->valid accordingly

              -
              ctxt:the validation context or NULL
              doc:the document
              elem:the parent
              name:the attribute name
              value:the attribute value
              Returns:a new normalized string if normalization is needed, NULL otherwise the caller must free the returned value.

              Function: xmlValidGetPotentialChildren

              int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
              const xmlChar ** list,
              int * len,
              int max)
              +
              ctxt:the validation context or NULL
              doc:the document
              elem:the parent
              name:the attribute name
              value:the attribute value
              Returns:a new normalized string if normalization is needed, NULL otherwise the caller must free the returned value.

              Function: xmlValidGetPotentialChildren

              int	xmlValidGetPotentialChildren	(xmlElementContent * ctree, 
              const xmlChar ** names,
              int * len,
              int max)

              Build/extend a list of potential children allowed by the content tree

              -
              ctree:an element content tree
              list:an array to store the list of child names
              len:a pointer to the number of element in the list
              max:the size of the array
              Returns:the number of element in the list, or -1 in case of error.

              Function: xmlValidGetValidElements

              int	xmlValidGetValidElements	(xmlNode * prev, 
              xmlNode * next,
              const xmlChar ** names,
              int max)
              +
              ctree:an element content tree
              names:an array to store the list of child names
              len:a pointer to the number of element in the list
              max:the size of the array
              Returns:the number of element in the list, or -1 in case of error.

              Function: xmlValidGetValidElements

              int	xmlValidGetValidElements	(xmlNode * prev, 
              xmlNode * next,
              const xmlChar ** names,
              int max)

              This function returns the list of authorized children to insert within an existing tree while respecting the validity constraints forced by the Dtd. The insertion point is defined using @prev and @next in the following ways: to insert before 'node': xmlValidGetValidElements(node->prev, node, ... to insert next 'node': xmlValidGetValidElements(node, node->next, ... to replace 'node': xmlValidGetValidElements(node->prev, node->next, ... to prepend a child to 'node': xmlValidGetValidElements(NULL, node->childs, to append a child to 'node': xmlValidGetValidElements(node->last, NULL, ... pointers to the element names are inserted at the beginning of the array and do not need to be freed.

              prev:an element to insert after
              next:an element to insert next
              names:an array to store the list of child names
              max:the size of the array
              Returns:the number of element in the list, or -1 in case of error. If the function returns the value @max the caller is invited to grow the receiving array and retry.

              Function: xmlValidNormalizeAttributeValue

              xmlChar *	xmlValidNormalizeAttributeValue	(xmlDocPtr doc, 
              xmlNodePtr elem,
              const xmlChar * name,
              const xmlChar * value)

              Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character.

              diff --git a/doc/html/libxml-xmlIO.html b/doc/html/libxml-xmlIO.html index 76b6dcd..2edd017 100644 --- a/doc/html/libxml-xmlIO.html +++ b/doc/html/libxml-xmlIO.html @@ -45,6 +45,7 @@ int xmlInputReadCallback (void * context, <
              xmlParserInputPtr	xmlNoNetExternalEntityLoader	(const char * URL, 
              const char * ID,
              xmlParserCtxtPtr ctxt)
              xmlChar *	xmlNormalizeWindowsPath	(const xmlChar * path)
              int	xmlOutputBufferClose		(xmlOutputBufferPtr out)
              +
              xmlOutputBufferPtr	xmlOutputBufferCreateBuffer	(xmlBufferPtr buffer, 
              xmlCharEncodingHandlerPtr encoder)
              xmlOutputBufferPtr	xmlOutputBufferCreateFd	(int fd, 
              xmlCharEncodingHandlerPtr encoder)
              xmlOutputBufferPtr	xmlOutputBufferCreateFile	(FILE * file, 
              xmlCharEncodingHandlerPtr encoder)
              xmlOutputBufferPtr	xmlOutputBufferCreateFilename	(const char * URI, 
              xmlCharEncodingHandlerPtr encoder,
              int compression)
              @@ -140,7 +141,9 @@ int xmlInputReadCallback (void * context,
              char * buffer,

              This function is obsolete. Please see xmlURIFromPath in uri.c for a better solution.

              path:the input file path
              Returns:a canonicalized version of the path

              Function: xmlOutputBufferClose

              int	xmlOutputBufferClose		(xmlOutputBufferPtr out)

              flushes and close the output I/O channel and free up all the associated resources

              -
              out:a buffered output
              Returns:the number of byte written or -1 in case of error.

              Function: xmlOutputBufferCreateFd

              xmlOutputBufferPtr	xmlOutputBufferCreateFd	(int fd, 
              xmlCharEncodingHandlerPtr encoder)
              +
              out:a buffered output
              Returns:the number of byte written or -1 in case of error.

              Function: xmlOutputBufferCreateBuffer

              xmlOutputBufferPtr	xmlOutputBufferCreateBuffer	(xmlBufferPtr buffer, 
              xmlCharEncodingHandlerPtr encoder)
              +

              Create a buffered output for the progressive saving to a xmlBuffer

              +
              buffer:a xmlBufferPtr
              encoder:the encoding converter or NULL
              Returns:the new parser output or NULL

              Function: xmlOutputBufferCreateFd

              xmlOutputBufferPtr	xmlOutputBufferCreateFd	(int fd, 
              xmlCharEncodingHandlerPtr encoder)

              Create a buffered output for the progressive saving to a file descriptor

              fd:a file descriptor number
              encoder:the encoding converter or NULL
              Returns:the new parser output or NULL

              Function: xmlOutputBufferCreateFile

              xmlOutputBufferPtr	xmlOutputBufferCreateFile	(FILE * file, 
              xmlCharEncodingHandlerPtr encoder)

              Create a buffered output for the progressive saving to a FILE * buffered C I/O

              diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html index 8f96ae4..f8f0a90 100644 --- a/doc/html/libxml-xmlerror.html +++ b/doc/html/libxml-xmlerror.html @@ -761,6 +761,11 @@ void xmlStructuredErrorFunc (void * userD XML_SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084 : 3084 XML_SCHEMAP_WARN_ATTR_REDECL_PROH = 3085 : 3085 XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086 : 3085 + XML_SCHEMAP_AG_PROPS_CORRECT = 3087 : 3086 + XML_SCHEMAP_COS_CT_EXTENDS_1_2 = 3088 : 3087 + XML_SCHEMAP_AU_PROPS_CORRECT = 3089 : 3088 + XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090 : 3089 + XML_SCHEMAP_COS_ALL_LIMITED = 3091 : 3090 XML_MODULE_OPEN = 4900 : 4900 XML_MODULE_CLOSE = 4901 : 4901 XML_CHECK_FOUND_ELEMENT = 5000 diff --git a/doc/html/libxml-xmlreader.html b/doc/html/libxml-xmlreader.html index 6036ccb..0ffa0a4 100644 --- a/doc/html/libxml-xmlreader.html +++ b/doc/html/libxml-xmlreader.html @@ -97,6 +97,7 @@ void xmlTextReaderErrorFunc (void * arg,
              int	xmlTextReaderRelaxNGSetSchema	(xmlTextReaderPtr reader, 
              xmlRelaxNGPtr schema)
              int	xmlTextReaderRelaxNGValidate	(xmlTextReaderPtr reader, 
              const char * rng)
              int	xmlTextReaderSchemaValidate	(xmlTextReaderPtr reader, 
              const char * xsd)
              +
              int	xmlTextReaderSchemaValidateCtxt	(xmlTextReaderPtr reader, 
              xmlSchemaValidCtxtPtr ctxt,
              int options)
              void	xmlTextReaderSetErrorHandler	(xmlTextReaderPtr reader, 
              xmlTextReaderErrorFunc f,
              void * arg)
              int	xmlTextReaderSetParserProp	(xmlTextReaderPtr reader, 
              int prop,
              int value)
              int	xmlTextReaderSetSchema		(xmlTextReaderPtr reader, 
              xmlSchemaPtr schema)
              @@ -303,8 +304,10 @@ void xmlTextReaderErrorFunc (void * arg,
              const char * msg,
              reader:the xmlTextReaderPtr used
              schema:a precompiled RelaxNG schema
              Returns:0 in case the RelaxNG validation could be (des)activated and -1 in case of error.

              Function: xmlTextReaderRelaxNGValidate

              int	xmlTextReaderRelaxNGValidate	(xmlTextReaderPtr reader, 
              const char * rng)

              Use RelaxNG to validate the document as it is processed. Activation is only possible before the first Read(). if @rng is NULL, then RelaxNG validation is desactivated.

              reader:the xmlTextReaderPtr used
              rng:the path to a RelaxNG schema or NULL
              Returns:0 in case the RelaxNG validation could be (des)activated and -1 in case of error.

              Function: xmlTextReaderSchemaValidate

              int	xmlTextReaderSchemaValidate	(xmlTextReaderPtr reader, 
              const char * xsd)
              -

              Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). if @xsd is NULL, then RelaxNG validation is desactivated.

              -
              reader:the xmlTextReaderPtr used
              xsd:the path to a W3C XSD schema or NULL
              Returns:0 in case the schemas validation could be (des)activated and -1 in case of error.

              Function: xmlTextReaderSetErrorHandler

              void	xmlTextReaderSetErrorHandler	(xmlTextReaderPtr reader, 
              xmlTextReaderErrorFunc f,
              void * arg)
              +

              Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). If @xsd is NULL, then XML Schema validation is deactivated.

              +
              reader:the xmlTextReaderPtr used
              xsd:the path to a W3C XSD schema or NULL
              Returns:0 in case the schemas validation could be (de)activated and -1 in case of error.

              Function: xmlTextReaderSchemaValidateCtxt

              int	xmlTextReaderSchemaValidateCtxt	(xmlTextReaderPtr reader, 
              xmlSchemaValidCtxtPtr ctxt,
              int options)
              +

              Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then XML Schema validation is deactivated.

              +
              reader:the xmlTextReaderPtr used
              ctxt:the XML Schema validation context or NULL
              options:options (not used yet)
              Returns:0 in case the schemas validation could be (de)activated and -1 in case of error.

              Function: xmlTextReaderSetErrorHandler

              void	xmlTextReaderSetErrorHandler	(xmlTextReaderPtr reader, 
              xmlTextReaderErrorFunc f,
              void * arg)

              Register a callback function that will be called on error and warnings. If @f is NULL, the default error and warning handlers are restored.

              reader:the xmlTextReaderPtr used
              f:the callback function to call on error and warnings
              arg:a user argument to pass to the callback function

              Function: xmlTextReaderSetParserProp

              int	xmlTextReaderSetParserProp	(xmlTextReaderPtr reader, 
              int prop,
              int value)

              Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done.

              diff --git a/doc/html/libxml-xmlregexp.html b/doc/html/libxml-xmlregexp.html index b507f34..b36155d 100644 --- a/doc/html/libxml-xmlregexp.html +++ b/doc/html/libxml-xmlregexp.html @@ -29,8 +29,8 @@ The content of this structure is not made public by the API.
              xmlExpNodePtr	xmlExpExpDerive		(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              xmlExpNodePtr sub)
              void	xmlExpFree			(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp)
              void	xmlExpFreeCtxt			(xmlExpCtxtPtr ctxt)
              -
              int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** list,
              int len)
              -
              int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** list,
              int len)
              +
              int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** langList,
              int len)
              +
              int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** tokList,
              int len)
              int	xmlExpIsNillable		(xmlExpNodePtr exp)
              int	xmlExpMaxToken			(xmlExpNodePtr expr)
              xmlExpNodePtr	xmlExpNewAtom		(xmlExpCtxtPtr ctxt, 
              const xmlChar * name,
              int len)
              @@ -89,11 +89,11 @@ The content of this structure is not made public by the API.

              Dereference the expression

              ctxt:the expression context
              exp:the expression

              Function: xmlExpFreeCtxt

              void	xmlExpFreeCtxt			(xmlExpCtxtPtr ctxt)

              Free an expression context

              -
              ctxt:an expression context

              Function: xmlExpGetLanguage

              int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** list,
              int len)
              +
              ctxt:an expression context

              Function: xmlExpGetLanguage

              int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** langList,
              int len)

              Find all the strings used in @exp and store them in @list

              -
              ctxt:the expression context
              exp:the expression
              list:where to store the tokens
              len:the allocated lenght of @list
              Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

              Function: xmlExpGetStart

              int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** list,
              int len)
              +
              ctxt:the expression context
              exp:the expression
              langList:where to store the tokens
              len:the allocated lenght of @list
              Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

              Function: xmlExpGetStart

              int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
              xmlExpNodePtr exp,
              const xmlChar ** tokList,
              int len)

              Find all the strings that appears at the start of the languages accepted by @exp and store them in @list. E.g. for (a, b) | c it will return the list [a, c]

              -
              ctxt:the expression context
              exp:the expression
              list:where to store the tokens
              len:the allocated lenght of @list
              Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

              Function: xmlExpIsNillable

              int	xmlExpIsNillable		(xmlExpNodePtr exp)
              +
              ctxt:the expression context
              exp:the expression
              tokList:where to store the tokens
              len:the allocated lenght of @list
              Returns:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

              Function: xmlExpIsNillable

              int	xmlExpIsNillable		(xmlExpNodePtr exp)

              Finds if the expression is nillable, i.e. if it accepts the empty sequqnce

              exp:the expression
              Returns:1 if nillable, 0 if not and -1 in case of error

              Function: xmlExpMaxToken

              int	xmlExpMaxToken			(xmlExpNodePtr expr)

              Indicate the maximum number of input a expression can accept

              diff --git a/doc/html/libxml-xmlsave.html b/doc/html/libxml-xmlsave.html index 6863beb..f0e10b0 100644 --- a/doc/html/libxml-xmlsave.html +++ b/doc/html/libxml-xmlsave.html @@ -19,6 +19,7 @@ The content of this structure is not made public by the API.
              int	xmlSaveFlush			(xmlSaveCtxtPtr ctxt)
              int	xmlSaveSetAttrEscape		(xmlSaveCtxtPtr ctxt, 
              xmlCharEncodingOutputFunc escape)
              int	xmlSaveSetEscape		(xmlSaveCtxtPtr ctxt, 
              xmlCharEncodingOutputFunc escape)
              +
              xmlSaveCtxtPtr	xmlSaveToBuffer		(xmlBufferPtr buffer, 
              const char * encoding,
              int options)
              xmlSaveCtxtPtr	xmlSaveToFd		(int fd, 
              const char * encoding,
              int options)
              xmlSaveCtxtPtr	xmlSaveToFilename	(const char * filename, 
              const char * encoding,
              int options)
              xmlSaveCtxtPtr	xmlSaveToIO		(xmlOutputWriteCallback iowrite, 
              xmlOutputCloseCallback ioclose,
              void * ioctx,
              const char * encoding,
              int options)
              @@ -42,7 +43,9 @@ The content of this structure is not made public by the API.

              Set a custom escaping function to be used for text in attribute content

              ctxt:a document saving context
              escape:the escaping function
              Returns:0 if successful or -1 in case of error.

              Function: xmlSaveSetEscape

              int	xmlSaveSetEscape		(xmlSaveCtxtPtr ctxt, 
              xmlCharEncodingOutputFunc escape)

              Set a custom escaping function to be used for text in element content

              -
              ctxt:a document saving context
              escape:the escaping function
              Returns:0 if successful or -1 in case of error.

              Function: xmlSaveToFd

              xmlSaveCtxtPtr	xmlSaveToFd		(int fd, 
              const char * encoding,
              int options)
              +
              ctxt:a document saving context
              escape:the escaping function
              Returns:0 if successful or -1 in case of error.

              Function: xmlSaveToBuffer

              xmlSaveCtxtPtr	xmlSaveToBuffer		(xmlBufferPtr buffer, 
              const char * encoding,
              int options)
              +

              Create a document saving context serializing to a buffer with the encoding and the options given

              +
              buffer:a buffer
              encoding:the encoding name to use or NULL
              options:a set of xmlSaveOptions
              Returns:a new serialization context or NULL in case of error.

              Function: xmlSaveToFd

              xmlSaveCtxtPtr	xmlSaveToFd		(int fd, 
              const char * encoding,
              int options)

              Create a document saving context serializing to a file descriptor with the encoding and the options given.

              fd:a file descriptor number
              encoding:the encoding name to use or NULL
              options:a set of xmlSaveOptions
              Returns:a new serialization context or NULL in case of error.

              Function: xmlSaveToFilename

              xmlSaveCtxtPtr	xmlSaveToFilename	(const char * filename, 
              const char * encoding,
              int options)

              Create a document saving context serializing to a filename or possibly to an URL (but this is less reliable) with the encoding and the options given.

              diff --git a/doc/html/libxml-xmlschemas.html b/doc/html/libxml-xmlschemas.html index 19afcec..d919fcc 100644 --- a/doc/html/libxml-xmlschemas.html +++ b/doc/html/libxml-xmlschemas.html @@ -38,11 +38,12 @@ The content of this structure is not made public by the API.
              xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt, 
              xmlSAXHandlerPtr * sax,
              void ** user_data)
              int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
              void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)
              +
              void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlStructuredErrorFunc serror,
              void * ctx)
              void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)
              int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
              int options)
              void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
              xmlStructuredErrorFunc serror,
              void * ctx)
              int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
              -
              int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
              xmlDocPtr doc)
              +
              int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
              xmlDocPtr instance)
              int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
              const char * filename,
              int options)
              int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
              xmlNodePtr elem)
              int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
              xmlParserInputBufferPtr input,
              xmlCharEncoding enc,
              xmlSAXHandlerPtr sax,
              void * user_data)
              @@ -57,7 +58,7 @@ void xmlSchemaValidityWarningFunc (v const xmlChar * name : schema name const xmlChar * targetNamespace : the target namespace const xmlChar * version - const xmlChar * id + const xmlChar * id : Obsolete xmlDocPtr doc xmlSchemaAnnotPtr annot int flags @@ -73,8 +74,8 @@ void xmlSchemaValidityWarningFunc (v void * includes : the includes, this is opaque for now int preserve : whether to free the document int counter : used to give ononymous components uniqu - xmlHashTablePtr idcDef - void * volatiles : Deprecated; not used anymore. + xmlHashTablePtr idcDef : All identity-constraint defs. + void * volatiles : Obsolete }

              Structure xmlSchemaParserCtxt

              Structure xmlSchemaParserCtxt
              struct _xmlSchemaParserCtxt { The content of this structure is not made public by the API. }

              Structure xmlSchemaSAXPlugStruct

              Structure xmlSchemaSAXPlugStruct
              struct _xmlSchemaSAXPlug { @@ -119,46 +120,48 @@ The content of this structure is not made public by the API.
              schema:a schema structure

              Function: xmlSchemaFreeParserCtxt

              void	xmlSchemaFreeParserCtxt		(xmlSchemaParserCtxtPtr ctxt)

              Free the resources associated to the schema parser context

              ctxt:the schema parser context

              Function: xmlSchemaFreeValidCtxt

              void	xmlSchemaFreeValidCtxt		(xmlSchemaValidCtxtPtr ctxt)
              -

              Free the resources associated to the schema validation context

              -
              ctxt:the schema validation context

              Function: xmlSchemaGetParserErrors

              int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc * err,
              xmlSchemaValidityWarningFunc * warn,
              void ** ctx)
              +

              +
              ctxt:

              Function: xmlSchemaGetParserErrors

              int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc * err,
              xmlSchemaValidityWarningFunc * warn,
              void ** ctx)

              Get the callback information used to handle errors for a parser context

              ctxt:a XMl-Schema parser context
              err:the error callback result
              warn:the warning callback result
              ctx:contextual data for the callbacks result
              Returns:-1 in case of failure, 0 otherwise

              Function: xmlSchemaGetValidErrors

              int	xmlSchemaGetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc * err,
              xmlSchemaValidityWarningFunc * warn,
              void ** ctx)
              -

              Get the error and warning callback informations

              -
              ctxt:a XML-Schema validation context
              err:the error function result
              warn:the warning function result
              ctx:the functions context result
              Returns:-1 in case of error and 0 otherwise

              Function: xmlSchemaIsValid

              int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
              -

              Check if any error was detected during validation.

              -
              ctxt:the schema validation context
              Returns:1 if valid so far, 0 if errors were detected, and -1 in case of internal error.

              Function: xmlSchemaNewDocParserCtxt

              xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)
              +

              +
              ctxt:
              err:
              warn:
              ctx:
              Returns:

              Function: xmlSchemaIsValid

              int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
              +

              +
              ctxt:
              Returns:

              Function: xmlSchemaNewDocParserCtxt

              xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)

              Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.

              doc:a preparsed document tree
              Returns:the parser context or NULL in case of error

              Function: xmlSchemaNewMemParserCtxt

              xmlSchemaParserCtxtPtr	xmlSchemaNewMemParserCtxt	(const char * buffer, 
              int size)

              Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.

              buffer:a pointer to a char array containing the schemas
              size:the size of the array
              Returns:the parser context or NULL in case of error

              Function: xmlSchemaNewParserCtxt

              xmlSchemaParserCtxtPtr	xmlSchemaNewParserCtxt	(const char * URL)

              Create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.

              URL:the location of the schema
              Returns:the parser context or NULL in case of error

              Function: xmlSchemaNewValidCtxt

              xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
              -

              Create an XML Schemas validation context based on the given schema.

              -
              schema:a precompiled XML Schemas
              Returns:the validation context or NULL in case of error

              Function: xmlSchemaParse

              xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
              -

              parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change

              +

              +
              schema:
              Returns:

              Function: xmlSchemaParse

              xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
              +

              parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

              ctxt:a schema validation context
              Returns:the internal XML Schema structure built from the resource or NULL in case of error

              Function: xmlSchemaSAXPlug

              xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt, 
              xmlSAXHandlerPtr * sax,
              void ** user_data)
              -

              Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained.

              -
              ctxt:a schema validation context
              sax:a pointer to the original xmlSAXHandlerPtr
              user_data:a pointer to the original SAX user data pointer
              Returns:a pointer to a data structure needed to unplug the validation layer or NULL in case of errors.

              Function: xmlSchemaSAXUnplug

              int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
              -

              Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored.

              -
              plug:a data structure returned by xmlSchemaSAXPlug
              Returns:0 in case of success and -1 in case of failure.

              Function: xmlSchemaSetParserErrors

              void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)
              +

              +
              ctxt:
              sax:
              user_data:
              Returns:

              Function: xmlSchemaSAXUnplug

              int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
              +

              +
              plug:
              Returns:

              Function: xmlSchemaSetParserErrors

              void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)

              Set the callback functions used to handle errors for a validation context

              -
              ctxt:a schema validation context
              err:the error callback
              warn:the warning callback
              ctx:contextual data for the callbacks

              Function: xmlSchemaSetValidErrors

              void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)
              -

              Set the error and warning callback informations

              -
              ctxt:a schema validation context
              err:the error function
              warn:the warning function
              ctx:the functions context

              Function: xmlSchemaSetValidOptions

              int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
              int options)
              -

              Sets the options to be used during the validation.

              -
              ctxt:a schema validation context
              options:a combination of xmlSchemaValidOption
              Returns:0 in case of success, -1 in case of an API error.

              Function: xmlSchemaSetValidStructuredErrors

              void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
              xmlStructuredErrorFunc serror,
              void * ctx)
              +
              ctxt:a schema validation context
              err:the error callback
              warn:the warning callback
              ctx:contextual data for the callbacks

              Function: xmlSchemaSetParserStructuredErrors

              void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt, 
              xmlStructuredErrorFunc serror,
              void * ctx)

              Set the structured error callback

              -
              ctxt:a schema validation context
              serror:the structured error function
              ctx:the functions context

              Function: xmlSchemaValidCtxtGetOptions

              int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
              -

              Get the validation context options.

              -
              ctxt:a schema validation context
              Returns:the option combination or -1 on error.

              Function: xmlSchemaValidateDoc

              int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
              xmlDocPtr doc)
              -

              Validate a document tree in memory.

              -
              ctxt:a schema validation context
              doc:a parsed document tree
              Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

              Function: xmlSchemaValidateFile

              int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
              const char * filename,
              int options)
              -

              Do a schemas validation of the given resource, it will use the SAX streamable validation internally.

              -
              ctxt:a schema validation context
              filename:the URI of the instance
              options:a future set of options, currently unused
              Returns:0 if the document is valid, a positive error code number otherwise and -1 in case of an internal or API error.

              Function: xmlSchemaValidateOneElement

              int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
              xmlNodePtr elem)
              -

              Validate a branch of a tree, starting with the given @elem.

              -
              ctxt:a schema validation context
              elem:an element node
              Returns:0 if the element and its subtree is valid, a positive error code number otherwise and -1 in case of an internal or API error.

              Function: xmlSchemaValidateStream

              int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
              xmlParserInputBufferPtr input,
              xmlCharEncoding enc,
              xmlSAXHandlerPtr sax,
              void * user_data)
              -

              Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one.

              -
              ctxt:a schema validation context
              input:the input to use for reading the data
              enc:an optional encoding information
              sax:a SAX handler for the resulting events
              user_data:the context to provide to the SAX handler.
              Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

              Function type: xmlSchemaValidityErrorFunc

              Function type: xmlSchemaValidityErrorFunc
              +
              ctxt:a schema parser context
              serror:the structured error function
              ctx:the functions context

              Function: xmlSchemaSetValidErrors

              void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
              xmlSchemaValidityErrorFunc err,
              xmlSchemaValidityWarningFunc warn,
              void * ctx)
              +

              +
              ctxt:
              err:
              warn:
              ctx:

              Function: xmlSchemaSetValidOptions

              int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
              int options)
              +

              +
              ctxt:
              options:
              Returns:

              Function: xmlSchemaSetValidStructuredErrors

              void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
              xmlStructuredErrorFunc serror,
              void * ctx)
              +

              +
              ctxt:
              serror:
              ctx:

              Function: xmlSchemaValidCtxtGetOptions

              int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
              +

              +
              ctxt:
              Returns:

              Function: xmlSchemaValidateDoc

              int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
              xmlDocPtr instance)
              +

              +
              ctxt:
              instance:
              Returns:

              Function: xmlSchemaValidateFile

              int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
              const char * filename,
              int options)
              +

              +
              ctxt:
              filename:
              options:
              Returns:

              Function: xmlSchemaValidateOneElement

              int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
              xmlNodePtr elem)
              +

              +
              ctxt:
              elem:
              Returns:

              Function: xmlSchemaValidateStream

              int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
              xmlParserInputBufferPtr input,
              xmlCharEncoding enc,
              xmlSAXHandlerPtr sax,
              void * user_data)
              +

              +
              ctxt:
              input:
              enc:
              sax:
              user_data:
              Returns:

              Function type: xmlSchemaValidityErrorFunc

              Function type: xmlSchemaValidityErrorFunc
               void	xmlSchemaValidityErrorFunc	(void * ctx, 
              const char * msg,
              ... ...)

              ctx:
              msg:
              ...:

              Function type: xmlSchemaValidityWarningFunc

              Function type: xmlSchemaValidityWarningFunc
              diff --git a/doc/html/libxml-xmlstring.html b/doc/html/libxml-xmlstring.html
              index bbcc85f..537aaa5 100644
              --- a/doc/html/libxml-xmlstring.html
              +++ b/doc/html/libxml-xmlstring.html
              @@ -54,7 +54,7 @@ A:link, A:visited, A:active { text-decoration: underline }
               
              utf:Pointer to putative UTF-8 encoded string.
              Returns:value: true if @utf is valid.

              Function: xmlGetUTF8Char

              int	xmlGetUTF8Char			(const unsigned char * utf, 
              int * len)

              Read the first UTF8 character from @utf

              utf:a sequence of UTF-8 encoded bytes
              len:a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence.
              Returns:the char value or -1 in case of error, and sets *len to the actual number of bytes consumed (0 in case of error)

              Function: xmlStrEqual

              int	xmlStrEqual			(const xmlChar * str1, 
              const xmlChar * str2)
              -

              Check if both string are equal of have same content Should be a bit more readable and faster than xmlStrEqual()

              +

              Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp()

              str1:the first xmlChar *
              str2:the second xmlChar *
              Returns:1 if they are equal, 0 if they are different

              Function: xmlStrPrintf

              int	xmlStrPrintf			(xmlChar * buf, 
              int len,
              const xmlChar * msg,
              ... ...)

              Formats @msg and places result into @buf.

              buf:the result buffer.
              len:the result buffer length.
              msg:the message with printf formatting.
              ...:extra parameters for the message.
              Returns:the number of characters written to @buf or -1 if an error occurs.

              Function: xmlStrQEqual

              int	xmlStrQEqual			(const xmlChar * pref, 
              const xmlChar * name,
              const xmlChar * str)
              @@ -78,10 +78,10 @@ A:link, A:visited, A:active { text-decoration: underline }
              str:the xmlChar * array
              Returns:the number of xmlChar contained in the ARRAY.

              Function: xmlStrncasecmp

              int	xmlStrncasecmp			(const xmlChar * str1, 
              const xmlChar * str2,
              int len)

              a strncasecmp for xmlChar's

              str1:the first xmlChar *
              str2:the second xmlChar *
              len:the max comparison length
              Returns:the integer result of the comparison

              Function: xmlStrncat

              xmlChar *	xmlStrncat		(xmlChar * cur, 
              const xmlChar * add,
              int len)
              -

              a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add.

              +

              a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned.

              cur:the original xmlChar * array
              add:the xmlChar * array added
              len:the length of @add
              Returns:a new xmlChar *, the original @cur is reallocated if needed and should not be freed

              Function: xmlStrncatNew

              xmlChar *	xmlStrncatNew		(const xmlChar * str1, 
              const xmlChar * str2,
              int len)
              -

              same as xmlStrncat, but creates a new string. The original two strings are not freed.

              -
              str1:first xmlChar string
              str2:second xmlChar string
              len:the len of @str2
              Returns:a new xmlChar * or NULL

              Function: xmlStrncmp

              int	xmlStrncmp			(const xmlChar * str1, 
              const xmlChar * str2,
              int len)
              +

              same as xmlStrncat, but creates a new string. The original two strings are not freed. If @len is < 0 then the length will be calculated automatically.

              +
              str1:first xmlChar string
              str2:second xmlChar string
              len:the len of @str2 or < 0
              Returns:a new xmlChar * or NULL

              Function: xmlStrncmp

              int	xmlStrncmp			(const xmlChar * str1, 
              const xmlChar * str2,
              int len)

              a strncmp for xmlChar's

              str1:the first xmlChar *
              str2:the second xmlChar *
              len:the max comparison length
              Returns:the integer result of the comparison

              Function: xmlStrndup

              xmlChar *	xmlStrndup		(const xmlChar * cur, 
              int len)

              a strndup for array of xmlChar's

              diff --git a/doc/index.html b/doc/index.html index e5cdd04..b4cfbcb 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,7 +1,8 @@ - + + Introduction
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Introduction

              Main Menu
              Related links

              This document describes libxml, the XML C parser and toolkit developed for the +Introduction
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Introduction

              Main Menu
              Related links

              This document describes libxml, the XML C parser and toolkit developed for the Gnome project. XML is a standard for building tag-based structured documents/data.

              Here are some key points about libxml:

              • Libxml2 exports Push (progressive) and Pull (blocking) type parser interfaces for both XML and HTML.
              • diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 2522c21..088d0ae 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -110,9 +110,10 @@ - + + @@ -122,7 +123,7 @@ - + @@ -1003,11 +1004,13 @@ + + @@ -1093,7 +1096,7 @@ internal interfaces for XML Schemas - internal interfaces for the XML Schemas handling and schema validity checking + internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not garanteed to be API or ABI stable ! Daniel Veillard @@ -1118,11 +1121,12 @@ - + + @@ -1142,7 +1146,9 @@ + + @@ -1151,7 +1157,7 @@ - + @@ -1160,7 +1166,7 @@ - + @@ -1223,6 +1229,7 @@ + @@ -1230,6 +1237,7 @@ + @@ -1853,9 +1861,10 @@ + - + @@ -1927,7 +1936,7 @@ - + @@ -2064,6 +2073,7 @@ + @@ -2083,6 +2093,7 @@ + @@ -2220,7 +2231,7 @@ - + @@ -2230,6 +2241,7 @@ + @@ -2333,6 +2345,7 @@ + @@ -2521,6 +2534,7 @@ + @@ -2864,6 +2878,7 @@ + @@ -2943,6 +2958,7 @@ + @@ -3014,6 +3030,7 @@ + @@ -4063,9 +4080,15 @@ The attribute wildcard has been already builded. + + Whether this attr. group contains attr. group references. + Marks the attr group as marked; used for circular checks. + + The attr group was redefined. + The attribute wildcard has been already builded. @@ -4255,8 +4278,11 @@ the complexType owns an attribute wildcard, i.e. it can be freed by the complexType + + The type was redefined. + - the simpleType has a variety of "absent". + the simpleType has a variety of "absent". TODO: Actually not necessary :-/, since if none of the variety flags occur then it's automatically absent. the simpleType has a variety of "union". @@ -5155,13 +5181,18 @@ + + + + + @@ -5505,9 +5536,10 @@ - + + @@ -5526,6 +5558,7 @@ + @@ -6343,7 +6376,7 @@ actually an xmlCharEncoding'/> - + @@ -6359,8 +6392,8 @@ actually an xmlCharEncoding'/> - - + + @@ -6368,41 +6401,42 @@ actually an xmlCharEncoding'/> - - - - - - + + + + + + - - - + + + - - - + + + - - + + - + - - - + + + + @@ -6414,17 +6448,17 @@ actually an xmlCharEncoding'/> - + - - - + + + - - + + @@ -6432,26 +6466,27 @@ actually an xmlCharEncoding'/> - - - + + + - - - + + + - - + + - + - - + + @@ -6476,36 +6511,38 @@ actually an xmlCharEncoding'/> - - - + + + - + - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + + - + @@ -6520,11 +6557,11 @@ actually an xmlCharEncoding'/> - + - - + + @@ -7288,6 +7325,15 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) + Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory. + + + + + + defined(LIBXML_HTML_ENABLED) Checks whether an HTML element may be a direct child of a parent element. Note - doesn't check for deprecated elements @@ -9412,7 +9458,7 @@ actually an xmlCharEncoding'/> - + @@ -9421,7 +9467,7 @@ actually an xmlCharEncoding'/> - + @@ -11139,7 +11185,7 @@ actually an xmlCharEncoding'/> defined(LIBXML_LEGACY_ENABLED) - Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!! It now create a namespace on the root element of the document if found. + Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!! @@ -11467,6 +11513,13 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_OUTPUT_ENABLED) + Create a buffered output for the progressive saving to a xmlBuffer + + + + defined(LIBXML_OUTPUT_ENABLED) Create a buffered output for the progressive saving to a file descriptor @@ -12611,7 +12664,7 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change + parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. @@ -13133,6 +13186,14 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_OUTPUT_ENABLED) + Create a document saving context serializing to a buffer with the encoding and the options given + + + + + defined(LIBXML_OUTPUT_ENABLED) Create a document saving context serializing to a file descriptor with the encoding and the options given. @@ -13252,9 +13313,9 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Free the resources associated to the schema validation context + - + defined(LIBXML_SCHEMAS_ENABLED) @@ -13325,12 +13386,12 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Get the error and warning callback informations - - - - - + + + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13346,9 +13407,9 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Check if any error was detected during validation. - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13397,29 +13458,29 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Create an XML Schemas validation context based on the given schema. - - + + + defined(LIBXML_SCHEMAS_ENABLED) - parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. *WARNING* this interface is highly subject to change + parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances. defined(LIBXML_SCHEMAS_ENABLED) - Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained. - - - - + + + + + defined(LIBXML_SCHEMAS_ENABLED) - Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored. - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13430,29 +13491,37 @@ actually an xmlCharEncoding'/> - + defined(LIBXML_SCHEMAS_ENABLED) - Set the error and warning callback informations + Set the structured error callback - - - + + + + defined(LIBXML_SCHEMAS_ENABLED) + + + + + + + defined(LIBXML_SCHEMAS_ENABLED) - Sets the options to be used during the validation. - - - + + + + defined(LIBXML_SCHEMAS_ENABLED) - Set the structured error callback + - - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13474,16 +13543,16 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Get the validation context options. - - + + + defined(LIBXML_SCHEMAS_ENABLED) - Validate a document tree in memory. - - - + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13507,11 +13576,11 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Do a schemas validation of the given resource, it will use the SAX streamable validation internally. - - - - + + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13545,10 +13614,10 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Validate a branch of a tree, starting with the given @elem. - - - + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13560,13 +13629,13 @@ actually an xmlCharEncoding'/> defined(LIBXML_SCHEMAS_ENABLED) - Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one. - - - - - - + + + + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13971,7 +14040,7 @@ actually an xmlCharEncoding'/> - Check if both string are equal of have same content Should be a bit more readable and faster than xmlStrEqual() + Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp() @@ -14047,7 +14116,7 @@ actually an xmlCharEncoding'/> defined(LIBXML_PATTERN_ENABLED) - Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. + Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an element-node. @@ -14055,12 +14124,27 @@ actually an xmlCharEncoding'/> defined(LIBXML_PATTERN_ENABLED) - Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. + Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an attribute-node. + + defined(LIBXML_PATTERN_ENABLED) + Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Different from xmlStreamPush() this function can be fed with nodes of type: element-, attribute-, text-, cdata-section-, comment- and processing-instruction-node. + + + + + + + + defined(LIBXML_PATTERN_ENABLED) + Query if the streaming pattern additionally needs to be fed with text-, cdata-section-, comment- and processing-instruction-nodes. If the result is 0 then only element-nodes and attribute-nodes need to be pushed. + + + The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. @@ -14115,18 +14199,18 @@ actually an xmlCharEncoding'/> - a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. + a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned. - same as xmlStrncat, but creates a new string. The original two strings are not freed. + same as xmlStrncat, but creates a new string. The original two strings are not freed. If @len is < 0 then the length will be calculated automatically. - + a strncmp for xmlChar's @@ -14546,13 +14630,13 @@ actually an xmlCharEncoding'/> - defined(LIBXML_READER_ENABLED) + defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) Reads the contents of the current node, including child nodes and markup. - defined(LIBXML_READER_ENABLED) + defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) Reads the contents of the current node, including child nodes and markup. @@ -14585,11 +14669,19 @@ actually an xmlCharEncoding'/> defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). if @xsd is NULL, then RelaxNG validation is desactivated. - + Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). If @xsd is NULL, then XML Schema validation is deactivated. + + + defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) + Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then XML Schema validation is deactivated. + + + + + defined(LIBXML_READER_ENABLED) Register a callback function that will be called on error and warnings. If @f is NULL, the default error and warning handlers are restored. @@ -16436,7 +16528,7 @@ actually an xmlCharEncoding'/> Build/extend a list of potential children allowed by the content tree - + diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index e09ad85..0b6082a 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,45 +8,21 @@ libxml2 - 2.6.21 - Sep 4 2005 + 2.6.22 + Sep 12 2005 http://xmlsoft.org/ - - build fixes: Cygwin portability fixes (Gerrit P. Haase), calling - convention problems on Windows (Marcus Boerger), cleanups based on - Linus' sparse tool, update of win32/configure.js (Rob Richards), - remove warnings on Windows(Marcus Boerger), compilation without SAX1, - detection of the Python binary, use $GCC inestad of $CC = 'gcc' (Andrew - W. Nosenko), compilation/link with threads and old gcc, compile - problem by C370 on Z/OS, - - bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 - bug (Jiri Netolicky), XPath NaN compare bug (William Brack), - htmlParseScript potential bug, Schemas regexp handling of spaces, - Base64 Schemas comparisons NIST passes, automata build error xsd:all, - xmlGetNodePath for namespaced attributes (Alexander Pohoyda), - xmlSchemas foreign namespaces handling, XML Schemas facet comparison - (Kupriyanov Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier - Buchcik), xml: namespace ahndling in Schemas (Kasimier), empty model - group in Schemas (Kasimier), wilcard in Schemas (Kasimier), URI - composition (William), xs:anyType in Schemas (Kasimier), Python resolver - emmitting error messages directly, Python xmlAttr.parent (Jakub Piotr - Clapa), trying to fix the file path/URI conversion, - xmlTextReaderGetAttribute fix (Rob Richards), xmlSchemaFreeAnnot memleak - (Kasimier), HTML UTF-8 serialization, streaming XPath, Schemas determinism - detection problem, XInclude bug, Schemas context type (Dean Hill), - validation fix (Derek Poon), xmlTextReaderGetAttribute[Ns] namespaces - (Rob Richards), Schemas type fix (Kuba Nowakowski), UTF-8 parser bug, - error in encoding handling, xmlGetLineNo fixes, bug on entities handling, - entity name extraction in error handling with XInclude, text nodes - in HTML body tags (Gary Coady), xml:id and IDness at the treee level - fixes, XPath streaming patterns bugs. - - improvements: structured interfaces for schemas and RNG error reports - (Marcus Boerger), optimization of the char data inner loop parsing - (thanks to Behdad Esfahbod for the idea), schematron validation - though not finished yet, xmlSaveOption to omit XML declaration, - keyref match error reports (Kasimier), formal expression handling - code not plugged yet, more lax mode for the HTML parser, - parser XML_PARSE_COMPACT option for text nodes allocation. - - documentation: xmllint man page had --nonet duplicated + - build fixes: compile without schematron (Stéphane Bidoul) + - bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, + CDATA push parser bug, xmlElemDump problem with XHTML1 doc, + XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some + output formatting for meta element (Rob Richards), script and style + XHTML1 serialization (David Madore), Attribute derivation fixups in XSD + (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik) + - improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add + XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for + derive (Kasimier Buchcik). + - documentation: generation of gtk-doc like docs, integration with + devhelp. diff --git a/doc/namespaces.html b/doc/namespaces.html index d2c9be3..b4936c7 100644 --- a/doc/namespaces.html +++ b/doc/namespaces.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Namespaces
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Namespaces

                Main Menu
                Related links

                The libxml2 library implements XML namespaces support by +Namespaces
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Namespaces

                Main Menu
                Related links

                The libxml2 library implements XML namespaces support by recognizing namespace constructs in the input, and does namespace lookup automatically when building the DOM tree. A namespace declaration is associated with an in-memory structure and all elements or attributes within diff --git a/doc/news.html b/doc/news.html index 8916d49..29af068 100644 --- a/doc/news.html +++ b/doc/news.html @@ -7,164 +7,202 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Releases
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Releases

                Main Menu
                Related links

                Items not finished and worked on, get in touch with the list if you want +Releases
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Releases

                Main Menu
                Related links

                Items not finished and worked on, get in touch with the list if you want to help those

                The change log describes the recents commits -to the CVS code base.

                There is the list of public releases:

                2.6.22: Sep 12 2005

                • build fixes: compile without schematron (Stéphane Bidoul)
                • +to the CVS code base.

                  There is the list of public releases:

                  2.6.23: Jan 5 2006

                  • portability fixes: Windows (Rob Richards), getaddrinfo on Windows + (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas), + --with-minimum compilation fixes (William Brack), error case handling fix + on Solaris (Albert Chin), don't use 'list' as parameter name reported by + Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin), + MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick Jones), +
                  • +
                  • code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose + (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring + parsing code (Bjorn Reese)
                  • +
                  • bug fixes: xmlBuildRelativeURI and empty path (William Brack), + combinatory explosion and performances in regexp code, leak in + xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo + Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik), + XPath pattern based evaluation bugs (DV & Kasimier), + xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in + xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of + vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF + split problem (William), issues with non-namespaced attributes in + xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), + HTML parsing of script, Python must not output to stdout (Nic Ferrier), + exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype + totalDigits bug (Kasimier Buchcik), error handling when writing to an + xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi + Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix + XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier), + fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml + (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of + runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs + (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), + compilation and build fixes (Michael Day), removed dependancies on + xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath + pattern based evaluation fixes (Kasimier)
                  • +
                  • improvements: XSD Schemas redefinitions/restrictions (Kasimier + Buchcik), node copy checks and fix for attribute (Rob Richards), counted + transition bug in regexps, ctxt->standalone = -2 to indicate no + standalone attribute was found, add xmlSchemaSetParserStructuredErrors() + (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API + (Kasimier), handle gzipped HTTP resources (Gary Coady), add + htmlDocDumpMemoryFormat. (Rob Richards),
                  • +
                  • documentation: typo (Michael Day), libxml man page (Albert Chin), save + function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik), +
                  • +

                  2.6.22: Sep 12 2005

                  • build fixes: compile without schematron (Stéphane Bidoul)
                  • bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, - CDATA push parser bug, xmlElemDump problem with XHTML1 doc, - XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, - fix some output formatting for meta element (Rob Richards), - script and style XHTML1 serialization (David Madore), Attribute - derivation fixups in XSD (Kasimier Buchcik), better IDC error - reports (Kasimier Buchcik) -
                  • -
                  • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), - add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements - preparing for derive (Kasimier Buchcik).
                  • + CDATA push parser bug, xmlElemDump problem with XHTML1 doc, + XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some + output formatting for meta element (Rob Richards), script and style + XHTML1 serialization (David Madore), Attribute derivation fixups in XSD + (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik) +
                  • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add + XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for + derive (Kasimier Buchcik).
                  • documentation: generation of gtk-doc like docs, integration with - devhelp.
                  • + devhelp.

                  2.6.21: Sep 4 2005

                  • build fixes: Cygwin portability fixes (Gerrit P. Haase), calling - convention problems on Windows (Marcus Boerger), cleanups based on - Linus' sparse tool, update of win32/configure.js (Rob Richards), - remove warnings on Windows(Marcus Boerger), compilation without SAX1, - detection of the Python binary, use $GCC inestad of $CC = 'gcc' (Andrew - W. Nosenko), compilation/link with threads and old gcc, compile - problem by C370 on Z/OS,
                  • + convention problems on Windows (Marcus Boerger), cleanups based on Linus' + sparse tool, update of win32/configure.js (Rob Richards), remove warnings + on Windows(Marcus Boerger), compilation without SAX1, detection of the + Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko), + compilation/link with threads and old gcc, compile problem by C370 on + Z/OS,
                  • bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 - bug (Jiri Netolicky), XPath NaN compare bug (William Brack), - htmlParseScript potential bug, Schemas regexp handling of spaces, - Base64 Schemas comparisons NIST passes, automata build error xsd:all, - xmlGetNodePath for namespaced attributes (Alexander Pohoyda), - xmlSchemas foreign namespaces handling, XML Schemas facet comparison - (Kupriyanov Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier - Buchcik), xml: namespace ahndling in Schemas (Kasimier), empty model - group in Schemas (Kasimier), wilcard in Schemas (Kasimier), URI - composition (William), xs:anyType in Schemas (Kasimier), Python resolver - emmitting error messages directly, Python xmlAttr.parent (Jakub Piotr - Clapa), trying to fix the file path/URI conversion, - xmlTextReaderGetAttribute fix (Rob Richards), xmlSchemaFreeAnnot memleak - (Kasimier), HTML UTF-8 serialization, streaming XPath, Schemas determinism - detection problem, XInclude bug, Schemas context type (Dean Hill), - validation fix (Derek Poon), xmlTextReaderGetAttribute[Ns] namespaces - (Rob Richards), Schemas type fix (Kuba Nowakowski), UTF-8 parser bug, - error in encoding handling, xmlGetLineNo fixes, bug on entities handling, - entity name extraction in error handling with XInclude, text nodes - in HTML body tags (Gary Coady), xml:id and IDness at the treee level - fixes, XPath streaming patterns bugs.
                  • + bug (Jiri Netolicky), XPath NaN compare bug (William Brack), + htmlParseScript potential bug, Schemas regexp handling of spaces, Base64 + Schemas comparisons NIST passes, automata build error xsd:all, + xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas + foreign namespaces handling, XML Schemas facet comparison (Kupriyanov + Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: + namespace ahndling in Schemas (Kasimier), empty model group in Schemas + (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), + xs:anyType in Schemas (Kasimier), Python resolver emmitting error + messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to + fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob + Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8 + serialization, streaming XPath, Schemas determinism detection problem, + XInclude bug, Schemas context type (Dean Hill), validation fix (Derek + Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas + type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling, + xmlGetLineNo fixes, bug on entities handling, entity name extraction in + error handling with XInclude, text nodes in HTML body tags (Gary Coady), + xml:id and IDness at the treee level fixes, XPath streaming patterns + bugs.
                  • improvements: structured interfaces for schemas and RNG error reports - (Marcus Boerger), optimization of the char data inner loop parsing - (thanks to Behdad Esfahbod for the idea), schematron validation - though not finished yet, xmlSaveOption to omit XML declaration, - keyref match error reports (Kasimier), formal expression handling - code not plugged yet, more lax mode for the HTML parser, - parser XML_PARSE_COMPACT option for text nodes allocation.
                  • + (Marcus Boerger), optimization of the char data inner loop parsing + (thanks to Behdad Esfahbod for the idea), schematron validation though + not finished yet, xmlSaveOption to omit XML declaration, keyref match + error reports (Kasimier), formal expression handling code not plugged + yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option + for text nodes allocation.
                  • documentation: xmllint man page had --nonet duplicated
                  • -

                  2.6.20: Jul 10 2005

                  • build fixes: Windows build (Rob Richards), Mingw compilation (Igor - Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and - andriy@google.com), use gcc weak references to pthread to avoid the - pthread dependancy on Linux, compilation problem (Steve Nairn), - compiling of subset (Morten Welinder), IPv6/ss_family compilation - (William Brack), compilation when disabling parts of the library, - standalone test distribution. -
                  • -
                  • bug fixes: bug in lang(), memory cleanup on errors (William Brack), - HTTP query strings (Aron Stansvik), memory leak in DTD (William), - integer overflow in XPath (William), nanoftp buffer size, pattern - "." apth fixup (Kasimier), leak in tree reported by Malcolm Rowe, - replaceNode patch (Brent Hendricks), CDATA with NULL content - (Mark Vakoc), xml:base fixup on XInclude (William), pattern - fixes (William), attribute bug in exclusive c14n (Aleksey Sanin), - xml:space and xml:lang with SAX2 (Rob Richards), namespace - trouble in complex parsing (Malcolm Rowe), XSD type QNames fixes - (Kasimier), XPath streaming fixups (William), RelaxNG bug (Rob Richards), - Schemas for Schemas fixes (Kasimier), removal of ID (Rob Richards), - a small RelaxNG leak, HTML parsing in push mode bug (James Bursa), - failure to detect UTF-8 parsing bugs in CDATA sections, areBlanks() - heuristic failure, duplicate attributes in DTD bug (William). -
                  • -
                  • improvements: lot of work on Schemas by Kasimier Buchcik both on - conformance and streaming, Schemas validation messages (Kasimier - Buchcik, Matthew Burgess), namespace removal at the python level - (Brent Hendricks), Update to new Schemas regression tests from - W3C/Nist (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation - of xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), - standalone test framework and programs, new DOM import APIs - xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and - xmlDOMWrapRemoveNode(), extension of xmllint capabilities for - SAX and Schemas regression tests, xmlStopParser() available in - pull mode too, ienhancement to xmllint --shell namespaces support, - Windows port of the standalone testing tools (Kasimier and William), - xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() - SAX Schemas APIs, Schemas xmlReader support. -
                  • -

                  2.6.19: Apr 02 2005

                  • build fixes: drop .la from RPMs, --with-minimum build fix (William - Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with - AIX 5.3 compiler, fixed elfgcchack.h generation and PLT reduction - code on Linux/ELF/gcc4
                  • -
                  • bug fixes: schemas type decimal fixups (William Brack), xmmlint return - code (Gerry Murphy), small schemas fixes (Matthew Burgess and - GUY Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey - Sanin), segfault in Schemas (Kasimier Buchcik), Schemas attribute - validation (Kasimier), Prop related functions and xmlNewNodeEatName - (Rob Richards), HTML serialization of name attribute on a elements, - Python error handlers leaks and improvement (Brent Hendricks), - uninitialized variable in encoding code, Relax-NG validation bug, - potential crash if gnorableWhitespace is NULL, xmlSAXParseDoc and - xmlParseDoc signatures, switched back to assuming UTF-8 in case - no encoding is given at serialization time
                  • -
                  • improvements: lot of work on Schemas by Kasimier Buchcik on facets - checking and also mixed handling.
                  • +

                  2.6.20: Jul 10 2005

                  • build fixes: Windows build (Rob Richards), Mingw compilation (Igor + Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and + andriy@google.com), use gcc weak references to pthread to avoid the + pthread dependancy on Linux, compilation problem (Steve Nairn), compiling + of subset (Morten Welinder), IPv6/ss_family compilation (William Brack), + compilation when disabling parts of the library, standalone test + distribution.
                  • +
                  • bug fixes: bug in lang(), memory cleanup on errors (William Brack), + HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer + overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup + (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch + (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup + on XInclude (William), pattern fixes (William), attribute bug in + exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob + Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type + QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug + (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob + Richards), a small RelaxNG leak, HTML parsing in push mode bug (James + Bursa), failure to detect UTF-8 parsing bugs in CDATA sections, + areBlanks() heuristic failure, duplicate attributes in DTD bug + (William).
                  • +
                  • improvements: lot of work on Schemas by Kasimier Buchcik both on + conformance and streaming, Schemas validation messages (Kasimier Buchcik, + Matthew Burgess), namespace removal at the python level (Brent + Hendricks), Update to new Schemas regression tests from W3C/Nist + (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of + xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), + standalone test framework and programs, new DOM import APIs + xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and + xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and + Schemas regression tests, xmlStopParser() available in pull mode too, + ienhancement to xmllint --shell namespaces support, Windows port of the + standalone testing tools (Kasimier and William), + xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX + Schemas APIs, Schemas xmlReader support.
                  • +

                  2.6.19: Apr 02 2005

                  • build fixes: drop .la from RPMs, --with-minimum build fix (William + Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX + 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on + Linux/ELF/gcc4
                  • +
                  • bug fixes: schemas type decimal fixups (William Brack), xmmlint return + code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY + Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin), + segfault in Schemas (Kasimier Buchcik), Schemas attribute validation + (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards), + HTML serialization of name attribute on a elements, Python error handlers + leaks and improvement (Brent Hendricks), uninitialized variable in + encoding code, Relax-NG validation bug, potential crash if + gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures, + switched back to assuming UTF-8 in case no encoding is given at + serialization time
                  • +
                  • improvements: lot of work on Schemas by Kasimier Buchcik on facets + checking and also mixed handling.
                  • -

                  2.6.18: Mar 13 2005

                  • build fixes: warnings (Peter Breitenlohner), testapi.c generation, - Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), - some gcc4 fixes, HP-UX portability fixes (Rick Jones).
                  • -
                  • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and - xmlreader stopping on non-fatal errors, thread support for dictionnaries - reference counting (Gary Coady), internal subset and push problem, - URL saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python - paths fixup (Stephane Bidoul), xmlGetNodePath and namespaces, - xmlSetNsProp fix (Mike Hommey), warning should not count as error - (William Brack), xmlCreatePushParser empty chunk, XInclude parser - flags (William), cleanup FTP and HTTP code to reuse the uri parsing - and IPv6 (William), xmlTextWriterStartAttributeNS fix (Rob Richards), - XMLLINT_INDENT being empty (William), xmlWriter bugs (Rob Richards), - multithreading on Windows (Rich Salz), xmlSearchNsByHref fix (Kasimier), - Python binding leak (Brent Hendricks), aliasing bug exposed by gcc4 - on s390, xmlTextReaderNext bug (Rob Richards), Schemas decimal type - fixes (William Brack), xmlByteConsumed static buffer (Ben Maurer).
                  • -
                  • improvement: speedup parsing comments and DTDs, dictionnary support for - hash tables, Schemas Identity constraints (Kasimier), streaming XPath - subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical - values handling (Kasimier), add xmlTextReaderByteConsumed (Aron - Stansvik),
                  • -
                  • Documentation: Wiki support (Joel Reed) -

                  2.6.17: Jan 16 2005

                  • build fixes: Windows, warnings removal (William Brack), - maintainer-clean dependency(William), build in a different directory - (William), fixing --with-minimum configure build (William), BeOS - build (Marcin Konicki), Python-2.4 detection (William), compilation - on AIX (Dan McNichol)
                  • +

                  2.6.18: Mar 13 2005

                  • build fixes: warnings (Peter Breitenlohner), testapi.c generation, + Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), + some gcc4 fixes, HP-UX portability fixes (Rick Jones).
                  • +
                  • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and + xmlreader stopping on non-fatal errors, thread support for dictionnaries + reference counting (Gary Coady), internal subset and push problem, URL + saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths + fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix + (Mike Hommey), warning should not count as error (William Brack), + xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup + FTP and HTTP code to reuse the uri parsing and IPv6 (William), + xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being + empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows + (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent + Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug + (Rob Richards), Schemas decimal type fixes (William Brack), + xmlByteConsumed static buffer (Ben Maurer).
                  • +
                  • improvement: speedup parsing comments and DTDs, dictionnary support for + hash tables, Schemas Identity constraints (Kasimier), streaming XPath + subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical + values handling (Kasimier), add xmlTextReaderByteConsumed (Aron + Stansvik),
                  • +
                  • Documentation: Wiki support (Joel Reed)
                  • +

                  2.6.17: Jan 16 2005

                  • build fixes: Windows, warnings removal (William Brack), + maintainer-clean dependency(William), build in a different directory + (William), fixing --with-minimum configure build (William), BeOS build + (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan + McNichol)
                  • bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile() - to use the catalog(s), loop on output (William Brack), XPath memory leak, - ID deallocation problem (Steve Shepard), debugDumpNode crash (William), - warning not using error callback (William), xmlStopParser bug (William), - UTF-16 with BOM on DTDs (William), namespace bug on empty elements - in push mode (Rob Richards), line and col computations fixups (Aleksey - Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), - patterns with too many steps, bug in RNG choice optimization, line - number sometimes missing. -
                  • -
                  • improvements: XSD Schemas (Kasimier Buchcik), python generator (William), - xmlUTF8Strpos speedup (William), unicode Python strings (William), - XSD error reports (Kasimier Buchcik), Python __str__ call serialize(). -
                  • -
                  • new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber - for the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs - (mostly Joel Reed), error extraction API from regexps, new XMLSave - option for format (Phil Shafer)
                  • -
                  • documentation: site improvement (John Fleck), FAQ entries (William).
                  • + to use the catalog(s), loop on output (William Brack), XPath memory leak, + ID deallocation problem (Steve Shepard), debugDumpNode crash (William), + warning not using error callback (William), xmlStopParser bug (William), + UTF-16 with BOM on DTDs (William), namespace bug on empty elements in + push mode (Rob Richards), line and col computations fixups (Aleksey + Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), + patterns with too many steps, bug in RNG choice optimization, line number + sometimes missing. +
                  • improvements: XSD Schemas (Kasimier Buchcik), python generator + (William), xmlUTF8Strpos speedup (William), unicode Python strings + (William), XSD error reports (Kasimier Buchcik), Python __str__ call + serialize().
                  • +
                  • new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for + the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel + Reed), error extraction API from regexps, new XMLSave option for format + (Phil Shafer)
                  • +
                  • documentation: site improvement (John Fleck), FAQ entries + (William).

                  2.6.16: Nov 10 2004

                  • general hardening and bug fixing crossing all the API based on new automated regression testing
                  • build fix: IPv6 build and test on AIX (Dodji Seketeli)
                  • @@ -174,7 +212,7 @@ to the CVS code base.

                  • documentation: fix to xmllint man page, some API function descritpion were updated.
                  • improvements: DTD validation APIs provided at the Python level (Brent - Hendricks)
                  • + Hendricks)

                  2.6.15: Oct 27 2004

                  • security fixes on the nanoftp and nanohttp modules
                  • build fixes: xmllint detection bug in configure, building outside the source tree (Thomas Fitzsimmons)
                  • diff --git a/doc/python.html b/doc/python.html index e16ca53..1659122 100644 --- a/doc/python.html +++ b/doc/python.html @@ -33,8 +33,9 @@ or libxslt wrappers or bindings:

                    • idom2, a DOM2 implementation for Kylix2/D5/D6 from Borland.
                    • -
                    • There is bindings for Ruby and - libxml2 bindings are also available in Ruby through the libgdome-ruby module +
                    • There is bindings + for Ruby and libxml2 bindings are also available in Ruby through the + libgdome-ruby module maintained by Tobias Peters.
                    • Steve Ball and contributors maintains libxml2 and libxslt bindings for Tcl.
                    • @@ -49,17 +50,15 @@ or libxslt wrappers or bindings:

                      • wxXml2 +
                      • Francesco Montorsi developped wxXml2 wrappers that interface libxml2, allowing wxWidgets applications to load/save/edit XML instances.

                      The distribution includes a set of Python bindings, which are guaranteed to be maintained as part of the library in the future, though the Python interface have not yet reached the completeness of the C API.

                      Note that some of the Python purist dislike the default set of Python -bindings, rather than complaining I suggest they have a look at -lxml the more pythonic bindings for libxml2 and libxslt and -help Martijn Faassen -complete those.

                      Stéphane Bidoul +bindings, rather than complaining I suggest they have a look at lxml the more pythonic bindings for libxml2 +and libxslt and help Martijn +Faassen complete those.

                      Stéphane Bidoul maintains a Windows port of the Python bindings.

                      Note to people interested in building bindings, the API is formalized as an XML API description file which allows to diff --git a/doc/site.xsl b/doc/site.xsl index 29e8aaf..8368a73 100644 --- a/doc/site.xsl +++ b/doc/site.xsl @@ -318,7 +318,7 @@

                      • Home
                      • -
                      • Wiki
                      • +
                      • Reference Manual
                      • diff --git a/doc/xml.html b/doc/xml.html index 638d1c9..6ecd81c 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -3,7 +3,7 @@ The XML C parser and toolkit of Gnome - + @@ -124,7 +124,6 @@ benchmark on sourceforge February 2004 (smaller is better):

                        alt="benchmark results for Expat Xerces libxml2 Oracle and Sun toolkits">

                        --------------> -

                        Logo designed by Marc Liyanage.

                        Introduction

                        @@ -315,41 +314,49 @@ libxml2

                        CFLAGS=`xml2-config --cflags`

                        LIBS=`xml2-config --libs`

                        -
                      • I want to install my own copy of libxml2 in my home directory and link - my programs against it, but it doesn't work +
                      • I want to install my own copy of libxml2 in my home directory and + link my programs against it, but it doesn't work

                        There are many different ways to accomplish this. Here is one way to - do this under Linux. Suppose your home directory is /home/user. - Then:

                        -
                        • Create a subdirectory, let's call it myxml
                        • + do this under Linux. Suppose your home directory is /home/user. + Then:

                          +
                            +
                          • Create a subdirectory, let's call it myxml
                          • unpack the libxml2 distribution into that subdirectory
                          • -
                          • chdir into the unpacked distribution (/home/user/myxml/libxml2 - )
                          • +
                          • chdir into the unpacked distribution + (/home/user/myxml/libxml2 )
                          • configure the library using the "--prefix" switch, - specifying an installation subdirectory in /home/user/myxml, - e.g. -

                            ./configure --prefix /home/user/myxml/xmlinst {other - configuration options}

                          • + specifying an installation subdirectory in + /home/user/myxml, e.g. +

                            ./configure --prefix /home/user/myxml/xmlinst {other + configuration options}

                            +
                          • now run make followed by make install
                          • At this point, the installation subdirectory contains the complete - "private" include files, library files and binary program files (e.g. - xmllint), located in -

                            /home/user/myxml/xmlinst/lib, /home/user/myxml/xmlinst/include - and /home/user/myxml/xmlinst/bin

                            - respectively.
                          • -
                          • In order to use this "private" library, you should first add it - to the beginning of your default PATH (so that your own private - program files such as xmllint will be used instead of the normal - system ones). To do this, the Bash command would be -

                            export PATH=/home/user/myxml/xmlinst/bin:$PATH

                          • + "private" include files, library files and binary program files (e.g. + xmllint), located in +

                            /home/user/myxml/xmlinst/lib, + /home/user/myxml/xmlinst/include and + /home/user/myxml/xmlinst/bin

                            + respectively. +
                          • In order to use this "private" library, you should first add it to + the beginning of your default PATH (so that your own private program + files such as xmllint will be used instead of the normal system + ones). To do this, the Bash command would be +

                            export PATH=/home/user/myxml/xmlinst/bin:$PATH

                            +
                          • Now suppose you have a program test1.c that you would - like to compile with your "private" library. Simply compile it - using the command

                            gcc `xml2-config --cflags --libs` -o test - test.c

                            Note that, because your PATH has been set with - /home/user/myxml/xmlinst/bin at the beginning, the - xml2-config program which you just installed will be used instead of - the system default one, and this will automatically get the - correct libraries linked with your program.
                          -

                          + like to compile with your "private" library. Simply compile it using + the command +

                          gcc `xml2-config --cflags --libs` -o test test.c

                          + Note that, because your PATH has been set with + /home/user/myxml/xmlinst/bin at the beginning, the xml2-config + program which you just installed will be used instead of the system + default one, and this will automatically get the correct + libraries linked with your program. +
                        +
                      • + +

                      • xmlDocDump() generates output on one line.

                        Libxml2 will not invent spaces in the content of a document since all spaces in the content of a document are @@ -663,14 +670,17 @@ href="http://xmlsoft.org/sources/win32/">win32 directory.

                        maintainer of the Windows port, he provides binaries.
                      • -
                      • Blastwave provides - Solaris binaries.
                      • +
                      • Blastwave provides Solaris + binaries.
                      • Steve Ball provides Mac Os X binaries.
                      • The HP-UX porting center provides HP-UX binaries
                      • -
                      • Bull provides precompiled RPMs for AIX as patr of their GNOME packages
                      • +
                      • Bull provides precompiled RPMs for AIX as + patr of their GNOME packages

                      If you know other supported binary ports, please CVS code base.

                      There is the list of public releases:

                      +

                      2.6.23: Jan 5 2006

                      +
                        +
                      • portability fixes: Windows (Rob Richards), getaddrinfo on Windows + (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas), + --with-minimum compilation fixes (William Brack), error case handling fix + on Solaris (Albert Chin), don't use 'list' as parameter name reported by + Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin), + MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick Jones), +
                      • +
                      • code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose + (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring + parsing code (Bjorn Reese)
                      • +
                      • bug fixes: xmlBuildRelativeURI and empty path (William Brack), + combinatory explosion and performances in regexp code, leak in + xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo + Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik), + XPath pattern based evaluation bugs (DV & Kasimier), + xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in + xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of + vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF + split problem (William), issues with non-namespaced attributes in + xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), + HTML parsing of script, Python must not output to stdout (Nic Ferrier), + exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype + totalDigits bug (Kasimier Buchcik), error handling when writing to an + xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi + Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix + XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier), + fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml + (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of + runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs + (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), + compilation and build fixes (Michael Day), removed dependancies on + xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath + pattern based evaluation fixes (Kasimier)
                      • +
                      • improvements: XSD Schemas redefinitions/restrictions (Kasimier + Buchcik), node copy checks and fix for attribute (Rob Richards), counted + transition bug in regexps, ctxt->standalone = -2 to indicate no + standalone attribute was found, add xmlSchemaSetParserStructuredErrors() + (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API + (Kasimier), handle gzipped HTTP resources (Gary Coady), add + htmlDocDumpMemoryFormat. (Rob Richards),
                      • +
                      • documentation: typo (Michael Day), libxml man page (Albert Chin), save + function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik), +
                      • +
                      +

                      2.6.22: Sep 12 2005

                      • build fixes: compile without schematron (Stéphane Bidoul)
                      • bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, - CDATA push parser bug, xmlElemDump problem with XHTML1 doc, - XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, - fix some output formatting for meta element (Rob Richards), - script and style XHTML1 serialization (David Madore), Attribute - derivation fixups in XSD (Kasimier Buchcik), better IDC error - reports (Kasimier Buchcik) -
                      • -
                      • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), - add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements - preparing for derive (Kasimier Buchcik).
                      • + CDATA push parser bug, xmlElemDump problem with XHTML1 doc, + XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some + output formatting for meta element (Rob Richards), script and style + XHTML1 serialization (David Madore), Attribute derivation fixups in XSD + (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik) +
                      • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add + XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for + derive (Kasimier Buchcik).
                      • documentation: generation of gtk-doc like docs, integration with - devhelp.
                      • + devhelp.
                      +

                      2.6.21: Sep 4 2005

                      • build fixes: Cygwin portability fixes (Gerrit P. Haase), calling - convention problems on Windows (Marcus Boerger), cleanups based on - Linus' sparse tool, update of win32/configure.js (Rob Richards), - remove warnings on Windows(Marcus Boerger), compilation without SAX1, - detection of the Python binary, use $GCC inestad of $CC = 'gcc' (Andrew - W. Nosenko), compilation/link with threads and old gcc, compile - problem by C370 on Z/OS,
                      • + convention problems on Windows (Marcus Boerger), cleanups based on Linus' + sparse tool, update of win32/configure.js (Rob Richards), remove warnings + on Windows(Marcus Boerger), compilation without SAX1, detection of the + Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko), + compilation/link with threads and old gcc, compile problem by C370 on + Z/OS,
                      • bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 - bug (Jiri Netolicky), XPath NaN compare bug (William Brack), - htmlParseScript potential bug, Schemas regexp handling of spaces, - Base64 Schemas comparisons NIST passes, automata build error xsd:all, - xmlGetNodePath for namespaced attributes (Alexander Pohoyda), - xmlSchemas foreign namespaces handling, XML Schemas facet comparison - (Kupriyanov Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier - Buchcik), xml: namespace ahndling in Schemas (Kasimier), empty model - group in Schemas (Kasimier), wilcard in Schemas (Kasimier), URI - composition (William), xs:anyType in Schemas (Kasimier), Python resolver - emmitting error messages directly, Python xmlAttr.parent (Jakub Piotr - Clapa), trying to fix the file path/URI conversion, - xmlTextReaderGetAttribute fix (Rob Richards), xmlSchemaFreeAnnot memleak - (Kasimier), HTML UTF-8 serialization, streaming XPath, Schemas determinism - detection problem, XInclude bug, Schemas context type (Dean Hill), - validation fix (Derek Poon), xmlTextReaderGetAttribute[Ns] namespaces - (Rob Richards), Schemas type fix (Kuba Nowakowski), UTF-8 parser bug, - error in encoding handling, xmlGetLineNo fixes, bug on entities handling, - entity name extraction in error handling with XInclude, text nodes - in HTML body tags (Gary Coady), xml:id and IDness at the treee level - fixes, XPath streaming patterns bugs.
                      • + bug (Jiri Netolicky), XPath NaN compare bug (William Brack), + htmlParseScript potential bug, Schemas regexp handling of spaces, Base64 + Schemas comparisons NIST passes, automata build error xsd:all, + xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas + foreign namespaces handling, XML Schemas facet comparison (Kupriyanov + Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: + namespace ahndling in Schemas (Kasimier), empty model group in Schemas + (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), + xs:anyType in Schemas (Kasimier), Python resolver emmitting error + messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to + fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob + Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8 + serialization, streaming XPath, Schemas determinism detection problem, + XInclude bug, Schemas context type (Dean Hill), validation fix (Derek + Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas + type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling, + xmlGetLineNo fixes, bug on entities handling, entity name extraction in + error handling with XInclude, text nodes in HTML body tags (Gary Coady), + xml:id and IDness at the treee level fixes, XPath streaming patterns + bugs.
                      • improvements: structured interfaces for schemas and RNG error reports - (Marcus Boerger), optimization of the char data inner loop parsing - (thanks to Behdad Esfahbod for the idea), schematron validation - though not finished yet, xmlSaveOption to omit XML declaration, - keyref match error reports (Kasimier), formal expression handling - code not plugged yet, more lax mode for the HTML parser, - parser XML_PARSE_COMPACT option for text nodes allocation.
                      • + (Marcus Boerger), optimization of the char data inner loop parsing + (thanks to Behdad Esfahbod for the idea), schematron validation though + not finished yet, xmlSaveOption to omit XML declaration, keyref match + error reports (Kasimier), formal expression handling code not plugged + yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option + for text nodes allocation.
                      • documentation: xmllint man page had --nonet duplicated
                      +

                      2.6.20: Jul 10 2005

                        -
                      • build fixes: Windows build (Rob Richards), Mingw compilation (Igor - Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and - andriy@google.com), use gcc weak references to pthread to avoid the - pthread dependancy on Linux, compilation problem (Steve Nairn), - compiling of subset (Morten Welinder), IPv6/ss_family compilation - (William Brack), compilation when disabling parts of the library, - standalone test distribution. -
                      • -
                      • bug fixes: bug in lang(), memory cleanup on errors (William Brack), - HTTP query strings (Aron Stansvik), memory leak in DTD (William), - integer overflow in XPath (William), nanoftp buffer size, pattern - "." apth fixup (Kasimier), leak in tree reported by Malcolm Rowe, - replaceNode patch (Brent Hendricks), CDATA with NULL content - (Mark Vakoc), xml:base fixup on XInclude (William), pattern - fixes (William), attribute bug in exclusive c14n (Aleksey Sanin), - xml:space and xml:lang with SAX2 (Rob Richards), namespace - trouble in complex parsing (Malcolm Rowe), XSD type QNames fixes - (Kasimier), XPath streaming fixups (William), RelaxNG bug (Rob Richards), - Schemas for Schemas fixes (Kasimier), removal of ID (Rob Richards), - a small RelaxNG leak, HTML parsing in push mode bug (James Bursa), - failure to detect UTF-8 parsing bugs in CDATA sections, areBlanks() - heuristic failure, duplicate attributes in DTD bug (William). -
                      • -
                      • improvements: lot of work on Schemas by Kasimier Buchcik both on - conformance and streaming, Schemas validation messages (Kasimier - Buchcik, Matthew Burgess), namespace removal at the python level - (Brent Hendricks), Update to new Schemas regression tests from - W3C/Nist (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation - of xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), - standalone test framework and programs, new DOM import APIs - xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and - xmlDOMWrapRemoveNode(), extension of xmllint capabilities for - SAX and Schemas regression tests, xmlStopParser() available in - pull mode too, ienhancement to xmllint --shell namespaces support, - Windows port of the standalone testing tools (Kasimier and William), - xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() - SAX Schemas APIs, Schemas xmlReader support. -
                      • +
                      • build fixes: Windows build (Rob Richards), Mingw compilation (Igor + Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and + andriy@google.com), use gcc weak references to pthread to avoid the + pthread dependancy on Linux, compilation problem (Steve Nairn), compiling + of subset (Morten Welinder), IPv6/ss_family compilation (William Brack), + compilation when disabling parts of the library, standalone test + distribution.
                      • +
                      • bug fixes: bug in lang(), memory cleanup on errors (William Brack), + HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer + overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup + (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch + (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup + on XInclude (William), pattern fixes (William), attribute bug in + exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob + Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type + QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug + (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob + Richards), a small RelaxNG leak, HTML parsing in push mode bug (James + Bursa), failure to detect UTF-8 parsing bugs in CDATA sections, + areBlanks() heuristic failure, duplicate attributes in DTD bug + (William).
                      • +
                      • improvements: lot of work on Schemas by Kasimier Buchcik both on + conformance and streaming, Schemas validation messages (Kasimier Buchcik, + Matthew Burgess), namespace removal at the python level (Brent + Hendricks), Update to new Schemas regression tests from W3C/Nist + (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of + xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), + standalone test framework and programs, new DOM import APIs + xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and + xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and + Schemas regression tests, xmlStopParser() available in pull mode too, + ienhancement to xmllint --shell namespaces support, Windows port of the + standalone testing tools (Kasimier and William), + xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX + Schemas APIs, Schemas xmlReader support.
                      +

                      2.6.19: Apr 02 2005

                        -
                      • build fixes: drop .la from RPMs, --with-minimum build fix (William - Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with - AIX 5.3 compiler, fixed elfgcchack.h generation and PLT reduction - code on Linux/ELF/gcc4
                      • -
                      • bug fixes: schemas type decimal fixups (William Brack), xmmlint return - code (Gerry Murphy), small schemas fixes (Matthew Burgess and - GUY Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey - Sanin), segfault in Schemas (Kasimier Buchcik), Schemas attribute - validation (Kasimier), Prop related functions and xmlNewNodeEatName - (Rob Richards), HTML serialization of name attribute on a elements, - Python error handlers leaks and improvement (Brent Hendricks), - uninitialized variable in encoding code, Relax-NG validation bug, - potential crash if gnorableWhitespace is NULL, xmlSAXParseDoc and - xmlParseDoc signatures, switched back to assuming UTF-8 in case - no encoding is given at serialization time
                      • -
                      • improvements: lot of work on Schemas by Kasimier Buchcik on facets - checking and also mixed handling.
                      • +
                      • build fixes: drop .la from RPMs, --with-minimum build fix (William + Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX + 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on + Linux/ELF/gcc4
                      • +
                      • bug fixes: schemas type decimal fixups (William Brack), xmmlint return + code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY + Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin), + segfault in Schemas (Kasimier Buchcik), Schemas attribute validation + (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards), + HTML serialization of name attribute on a elements, Python error handlers + leaks and improvement (Brent Hendricks), uninitialized variable in + encoding code, Relax-NG validation bug, potential crash if + gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures, + switched back to assuming UTF-8 in case no encoding is given at + serialization time
                      • +
                      • improvements: lot of work on Schemas by Kasimier Buchcik on facets + checking and also mixed handling.
                      +

                      2.6.18: Mar 13 2005

                        -
                      • build fixes: warnings (Peter Breitenlohner), testapi.c generation, - Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), - some gcc4 fixes, HP-UX portability fixes (Rick Jones).
                      • -
                      • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and - xmlreader stopping on non-fatal errors, thread support for dictionnaries - reference counting (Gary Coady), internal subset and push problem, - URL saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python - paths fixup (Stephane Bidoul), xmlGetNodePath and namespaces, - xmlSetNsProp fix (Mike Hommey), warning should not count as error - (William Brack), xmlCreatePushParser empty chunk, XInclude parser - flags (William), cleanup FTP and HTTP code to reuse the uri parsing - and IPv6 (William), xmlTextWriterStartAttributeNS fix (Rob Richards), - XMLLINT_INDENT being empty (William), xmlWriter bugs (Rob Richards), - multithreading on Windows (Rich Salz), xmlSearchNsByHref fix (Kasimier), - Python binding leak (Brent Hendricks), aliasing bug exposed by gcc4 - on s390, xmlTextReaderNext bug (Rob Richards), Schemas decimal type - fixes (William Brack), xmlByteConsumed static buffer (Ben Maurer).
                      • -
                      • improvement: speedup parsing comments and DTDs, dictionnary support for - hash tables, Schemas Identity constraints (Kasimier), streaming XPath - subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical - values handling (Kasimier), add xmlTextReaderByteConsumed (Aron - Stansvik),
                      • -
                      • Documentation: Wiki support (Joel Reed) +
                      • build fixes: warnings (Peter Breitenlohner), testapi.c generation, + Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), + some gcc4 fixes, HP-UX portability fixes (Rick Jones).
                      • +
                      • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and + xmlreader stopping on non-fatal errors, thread support for dictionnaries + reference counting (Gary Coady), internal subset and push problem, URL + saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths + fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix + (Mike Hommey), warning should not count as error (William Brack), + xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup + FTP and HTTP code to reuse the uri parsing and IPv6 (William), + xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being + empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows + (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent + Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug + (Rob Richards), Schemas decimal type fixes (William Brack), + xmlByteConsumed static buffer (Ben Maurer).
                      • +
                      • improvement: speedup parsing comments and DTDs, dictionnary support for + hash tables, Schemas Identity constraints (Kasimier), streaming XPath + subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical + values handling (Kasimier), add xmlTextReaderByteConsumed (Aron + Stansvik),
                      • +
                      • Documentation: Wiki support (Joel Reed)
                      +

                      2.6.17: Jan 16 2005

                        -
                      • build fixes: Windows, warnings removal (William Brack), - maintainer-clean dependency(William), build in a different directory - (William), fixing --with-minimum configure build (William), BeOS - build (Marcin Konicki), Python-2.4 detection (William), compilation - on AIX (Dan McNichol)
                      • +
                      • build fixes: Windows, warnings removal (William Brack), + maintainer-clean dependency(William), build in a different directory + (William), fixing --with-minimum configure build (William), BeOS build + (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan + McNichol)
                      • bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile() - to use the catalog(s), loop on output (William Brack), XPath memory leak, - ID deallocation problem (Steve Shepard), debugDumpNode crash (William), - warning not using error callback (William), xmlStopParser bug (William), - UTF-16 with BOM on DTDs (William), namespace bug on empty elements - in push mode (Rob Richards), line and col computations fixups (Aleksey - Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), - patterns with too many steps, bug in RNG choice optimization, line - number sometimes missing. -
                      • -
                      • improvements: XSD Schemas (Kasimier Buchcik), python generator (William), - xmlUTF8Strpos speedup (William), unicode Python strings (William), - XSD error reports (Kasimier Buchcik), Python __str__ call serialize(). -
                      • -
                      • new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber - for the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs - (mostly Joel Reed), error extraction API from regexps, new XMLSave - option for format (Phil Shafer)
                      • -
                      • documentation: site improvement (John Fleck), FAQ entries (William).
                      • + to use the catalog(s), loop on output (William Brack), XPath memory leak, + ID deallocation problem (Steve Shepard), debugDumpNode crash (William), + warning not using error callback (William), xmlStopParser bug (William), + UTF-16 with BOM on DTDs (William), namespace bug on empty elements in + push mode (Rob Richards), line and col computations fixups (Aleksey + Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), + patterns with too many steps, bug in RNG choice optimization, line number + sometimes missing. +
                      • improvements: XSD Schemas (Kasimier Buchcik), python generator + (William), xmlUTF8Strpos speedup (William), unicode Python strings + (William), XSD error reports (Kasimier Buchcik), Python __str__ call + serialize().
                      • +
                      • new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for + the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel + Reed), error extraction API from regexps, new XMLSave option for format + (Phil Shafer)
                      • +
                      • documentation: site improvement (John Fleck), FAQ entries + (William).

                      2.6.16: Nov 10 2004

                      @@ -899,7 +956,7 @@ to the CVS code base.

                    • documentation: fix to xmllint man page, some API function descritpion were updated.
                    • improvements: DTD validation APIs provided at the Python level (Brent - Hendricks)
                    • + Hendricks)

                    2.6.15: Oct 27 2004

                    @@ -2443,10 +2500,9 @@ or libxslt wrappers or bindings:

                  • Uwe Fechner also provides idom2, a DOM2 implementation for Kylix2/D5/D6 from Borland.
                  • -
                  • There is bindings for Ruby and - libxml2 bindings are also available in Ruby through the libgdome-ruby module +
                  • There is bindings + for Ruby and libxml2 bindings are also available in Ruby through the + libgdome-ruby module maintained by Tobias Peters.
                  • Steve Ball and contributors maintains libxml2 and libxslt bindings for @@ -2457,14 +2513,15 @@ or libxslt wrappers or bindings:

                    libxslt as part of GNU ClasspathX project.
                  • Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look for RexxXML.
                  • -
                  • Satimage +
                  • Satimage provides XMLLib osax. This is an osax for Mac OS X with a set of commands to implement in AppleScript the XML DOM, XPATH and XSLT. Also includes commands for Property-lists (Apple's fast lookup table XML format.)
                  • -
                  • Francesco Montorsi developped -wxXml2 +
                  • Francesco Montorsi developped wxXml2 wrappers that interface libxml2, allowing wxWidgets applications to load/save/edit XML instances.
                  @@ -2474,10 +2531,11 @@ to be maintained as part of the library in the future, though the Python interface have not yet reached the completeness of the C API.

                  Note that some of the Python purist dislike the default set of Python -bindings, rather than complaining I suggest they have a look at -lxml the more pythonic bindings for libxml2 and libxslt and -help Martijn Faassen -complete those.

                  +bindings, rather than complaining I suggest they have a look at lxml the more pythonic bindings for libxml2 +and libxslt and help Martijn +Faassen complete those.

                  Stéphane Bidoul maintains a Windows port @@ -3251,12 +3309,13 @@ of a number of things:

                  is I18N) , Unicode, characters and glyphs, I suggest you read a presentation by Tim Bray on Unicode and why you should care about it.

                  +

                  If you don't understand why it does not make sense to have a string -without knowing what encoding it uses, then as Joel Spolsky said -please do -not write another line of code until you finish reading that article.. -It is a prerequisite to understand this page, and avoid a lot of problems -with libxml2, XML or text processing in general.

                  +without knowing what encoding it uses, then as Joel Spolsky said please do not +write another line of code until you finish reading that article.. It is +a prerequisite to understand this page, and avoid a lot of problems with +libxml2, XML or text processing in general.

                  Table of Content:

                    @@ -3452,7 +3511,7 @@ encoding:

                    <très>là</très> ~/XML -> ./xmllint --encode UTF-8 isolat1 <?xml version="1.0" encoding="UTF-8"?> -<très>là  </très> +<très>là  </très> ~/XML ->

                    The same processing is applied (and reuse most of the code) for HTML I18N @@ -3482,6 +3541,14 @@ linux machine with glibc-2.1 the list of supported encodings and aliases fill 3 full pages, and include UCS-4, the full set of ISO-Latin encodings, and the various Japanese ones.

                    +

                    To convert from the UTF-8 values returned from the API to another encoding +then it is possible to use the function provided from the encoding module like UTF8Toisolat1, or use the +POSIX iconv() +API directly.

                    +

                    Encoding aliases

                    From 2.2.3, libxml2 has support to register encoding names aliases. The @@ -3666,19 +3733,19 @@ new output handler with the closing call deactivated:

                    the file:
                    xmlOutputBufferPtr
                     xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
                    -    xmlOutputBufferPtr ret;
                    -    
                    -    if (xmlOutputCallbackInitialized == 0)
                    -        xmlRegisterDefaultOutputCallbacks();
                    -
                    -    if (file == NULL) return(NULL);
                    -    ret = xmlAllocOutputBuffer(encoder);
                    -    if (ret != NULL) {
                    -        ret->context = file;
                    -        ret->writecallback = xmlFileWrite;
                    -        ret->closecallback = NULL;  /* No close callback */
                    -    }
                    -    return(ret);
                    +    xmlOutputBufferPtr ret;
                    +    
                    +    if (xmlOutputCallbackInitialized == 0)
                    +        xmlRegisterDefaultOutputCallbacks();
                    +
                    +    if (file == NULL) return(NULL);
                    +    ret = xmlAllocOutputBuffer(encoder);
                    +    if (ret != NULL) {
                    +        ret->context = file;
                    +        ret->writecallback = xmlFileWrite;
                    +        ret->closecallback = NULL;  /* No close callback */
                    +    }
                    +    return(ret);
                     } 
                  1. And then use it to save the document: @@ -4844,10 +4911,9 @@ Gnome CVS base under gnome-xml/example

                    XML Canonicalization and XML Digital Signature implementations for libxml2
                  2. -
                  3. Steve Ball - and contributors maintain tcl bindings for libxml2 and - libxslt, as well as Steve Ball and + contributors maintain tcl + bindings for libxml2 and libxslt, as well as tkxmllint a GUI for xmllint and tkxsltproc a GUI for xsltproc.
                  4. diff --git a/doc/xmldtd.html b/doc/xmldtd.html index 45eb249..2e0caf9 100644 --- a/doc/xmldtd.html +++ b/doc/xmldtd.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Validation & DTDs
                    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                    Made with Libxml2 Logo

                    The XML C parser and toolkit of Gnome

                    Validation & DTDs

                    Main Menu
                    Related links

                    Table of Content:

                    1. General overview
                    2. +Validation & DTDs
                      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                      Made with Libxml2 Logo

                      The XML C parser and toolkit of Gnome

                      Validation & DTDs

                      Main Menu
                      Related links

                      Table of Content:

                      1. General overview
                      2. The definition
                      3. Simple rules
                        1. How to reference a DTD from a document
                        2. diff --git a/doc/xmlreader.html b/doc/xmlreader.html index db711b8..b8382a8 100644 --- a/doc/xmlreader.html +++ b/doc/xmlreader.html @@ -466,9 +466,9 @@ affects the Read() ones, however usually once processed the full subtree is not useful anymore, and the Next() operation allows to skip it completely and process to the successor or return 0 if the document end is reached.

                          -

                          Daniel Veillard

                          +

                          Daniel Veillard

                          -

                          $Id: xmlreader.html,v 1.8 2003/11/05 04:15:16 jfleck Exp $

                          +

                          $Id: xmlreader.html,v 1.9 2005/10/18 19:11:54 veillard Exp $

                          diff --git a/elfgcchack.h b/elfgcchack.h index 44ab139..66e056c 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -301,6 +301,18 @@ extern __typeof (htmlDocDumpMemory) htmlDocDumpMemory__internal_alias __attribut #endif #endif +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocDumpMemoryFormat +extern __typeof (htmlDocDumpMemoryFormat) htmlDocDumpMemoryFormat __attribute((alias("htmlDocDumpMemoryFormat__internal_alias"))); +#else +#ifndef htmlDocDumpMemoryFormat +extern __typeof (htmlDocDumpMemoryFormat) htmlDocDumpMemoryFormat__internal_alias __attribute((visibility("hidden"))); +#define htmlDocDumpMemoryFormat htmlDocDumpMemoryFormat__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_HTML_ENABLED) #ifdef bottom_HTMLparser #undef htmlElementAllowedHere @@ -6571,6 +6583,18 @@ extern __typeof (xmlOutputBufferClose) xmlOutputBufferClose__internal_alias __at #endif #endif +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateBuffer +extern __typeof (xmlOutputBufferCreateBuffer) xmlOutputBufferCreateBuffer __attribute((alias("xmlOutputBufferCreateBuffer__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateBuffer +extern __typeof (xmlOutputBufferCreateBuffer) xmlOutputBufferCreateBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateBuffer xmlOutputBufferCreateBuffer__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_OUTPUT_ENABLED) #ifdef bottom_xmlIO #undef xmlOutputBufferCreateFd @@ -9153,6 +9177,18 @@ extern __typeof (xmlSaveSetEscape) xmlSaveSetEscape__internal_alias __attribute( #endif #endif +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveToBuffer +extern __typeof (xmlSaveToBuffer) xmlSaveToBuffer __attribute((alias("xmlSaveToBuffer__internal_alias"))); +#else +#ifndef xmlSaveToBuffer +extern __typeof (xmlSaveToBuffer) xmlSaveToBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveToBuffer xmlSaveToBuffer__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_OUTPUT_ENABLED) #ifdef bottom_xmlsave #undef xmlSaveToFd @@ -9679,6 +9715,18 @@ extern __typeof (xmlSchemaSetParserErrors) xmlSchemaSetParserErrors__internal_al #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetParserStructuredErrors +extern __typeof (xmlSchemaSetParserStructuredErrors) xmlSchemaSetParserStructuredErrors __attribute((alias("xmlSchemaSetParserStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetParserStructuredErrors +extern __typeof (xmlSchemaSetParserStructuredErrors) xmlSchemaSetParserStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetParserStructuredErrors xmlSchemaSetParserStructuredErrors__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemas #undef xmlSchemaSetValidErrors @@ -11423,7 +11471,7 @@ extern __typeof (xmlTextReaderReadAttributeValue) xmlTextReaderReadAttributeValu #endif #endif -#if defined(LIBXML_READER_ENABLED) +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderReadInnerXml extern __typeof (xmlTextReaderReadInnerXml) xmlTextReaderReadInnerXml __attribute((alias("xmlTextReaderReadInnerXml__internal_alias"))); @@ -11435,7 +11483,7 @@ extern __typeof (xmlTextReaderReadInnerXml) xmlTextReaderReadInnerXml__internal_ #endif #endif -#if defined(LIBXML_READER_ENABLED) +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderReadOuterXml extern __typeof (xmlTextReaderReadOuterXml) xmlTextReaderReadOuterXml __attribute((alias("xmlTextReaderReadOuterXml__internal_alias"))); @@ -11507,6 +11555,18 @@ extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate__inter #endif #endif +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSchemaValidateCtxt +extern __typeof (xmlTextReaderSchemaValidateCtxt) xmlTextReaderSchemaValidateCtxt __attribute((alias("xmlTextReaderSchemaValidateCtxt__internal_alias"))); +#else +#ifndef xmlTextReaderSchemaValidateCtxt +extern __typeof (xmlTextReaderSchemaValidateCtxt) xmlTextReaderSchemaValidateCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSchemaValidateCtxt xmlTextReaderSchemaValidateCtxt__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_READER_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderSetErrorHandler diff --git a/error.c b/error.c index ce63071..722ffbb 100644 --- a/error.c +++ b/error.c @@ -21,7 +21,7 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, ...); #define XML_GET_VAR_STR(msg, str) { \ - int size; \ + int size, prev_size = -1; \ int chars; \ char *larger; \ va_list ap; \ @@ -35,8 +35,13 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, va_start(ap, msg); \ chars = vsnprintf(str, size, msg, ap); \ va_end(ap); \ - if ((chars > -1) && (chars < size)) \ - break; \ + if ((chars > -1) && (chars < size)) { \ + if (prev_size == chars) { \ + break; \ + } else { \ + prev_size = chars; \ + } \ + } \ if (chars > -1) \ size += chars + 1; \ else \ @@ -293,8 +298,6 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, if (name != NULL) { channel(data, "element %s: ", name); } - if (code == XML_ERR_OK) - return; switch (domain) { case XML_FROM_PARSER: channel(data, "parser "); @@ -360,8 +363,6 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, default: break; } - if (code == XML_ERR_OK) - return; switch (level) { case XML_ERR_NONE: channel(data, ": "); @@ -376,8 +377,6 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, channel(data, "error : "); break; } - if (code == XML_ERR_OK) - return; if (str != NULL) { int len; len = xmlStrlen((const xmlChar *)str); @@ -388,8 +387,6 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, } else { channel(data, "%s\n", "out of memory error"); } - if (code == XML_ERR_OK) - return; if (ctxt != NULL) { xmlParserPrintFileContextInternal(input, channel, data); diff --git a/gentest.py b/gentest.py index af76b04..8c143af 100755 --- a/gentest.py +++ b/gentest.py @@ -46,6 +46,7 @@ modules_defines = { "DOCBparser" : "LIBXML_DOCB_ENABLED", "xmlmodule" : "LIBXML_MODULES_ENABLED", "pattern" : "LIBXML_PATTERN_ENABLED", + "schematron" : "LIBXML_SCHEMATRON_ENABLED", } # diff --git a/include/libxml/HTMLtree.h b/include/libxml/HTMLtree.h index 50b8544..6ea8207 100644 --- a/include/libxml/HTMLtree.h +++ b/include/libxml/HTMLtree.h @@ -75,6 +75,11 @@ XMLPUBFUN void XMLCALL htmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); +XMLPUBFUN void XMLCALL + htmlDocDumpMemoryFormat (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); XMLPUBFUN int XMLCALL htmlDocDump (FILE *f, xmlDocPtr cur); diff --git a/include/libxml/pattern.h b/include/libxml/pattern.h index 1aa6704..97d2cd2 100644 --- a/include/libxml/pattern.h +++ b/include/libxml/pattern.h @@ -74,6 +74,11 @@ XMLPUBFUN xmlStreamCtxtPtr XMLCALL xmlPatternGetStreamCtxt (xmlPatternPtr comp); XMLPUBFUN void XMLCALL xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); +XMLPUBFUN int XMLCALL + xmlStreamPushNode (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns, + int nodeType); XMLPUBFUN int XMLCALL xmlStreamPush (xmlStreamCtxtPtr stream, const xmlChar *name, @@ -84,6 +89,8 @@ XMLPUBFUN int XMLCALL const xmlChar *ns); XMLPUBFUN int XMLCALL xmlStreamPop (xmlStreamCtxtPtr stream); +XMLPUBFUN int XMLCALL + xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); #ifdef __cplusplus } #endif diff --git a/include/libxml/schemasInternals.h b/include/libxml/schemasInternals.h index 384758d..b68a6e1 100644 --- a/include/libxml/schemasInternals.h +++ b/include/libxml/schemasInternals.h @@ -2,6 +2,8 @@ * Summary: internal interfaces for XML Schemas * Description: internal interfaces for the XML Schemas handling * and schema validity checking + * The Schemas development is a Work In Progress. + * Some of those interfaces are not garanteed to be API or ABI stable ! * * Copy: See Copyright for the status of this software. * @@ -103,6 +105,7 @@ typedef enum { XML_SCHEMA_TYPE_IDC_KEY, XML_SCHEMA_TYPE_IDC_KEYREF, XML_SCHEMA_TYPE_PARTICLE = 25, + XML_SCHEMA_TYPE_ATTRIBUTE_USE, XML_SCHEMA_FACET_MININCLUSIVE = 1000, XML_SCHEMA_FACET_MINEXCLUSIVE, XML_SCHEMA_FACET_MAXINCLUSIVE, @@ -115,7 +118,8 @@ typedef enum { XML_SCHEMA_FACET_LENGTH, XML_SCHEMA_FACET_MAXLENGTH, XML_SCHEMA_FACET_MINLENGTH, - XML_SCHEMA_EXTRA_QNAMEREF = 2000 + XML_SCHEMA_EXTRA_QNAMEREF = 2000, + XML_SCHEMA_EXTRA_ATTR_USE_PROHIB } xmlSchemaTypeType; typedef enum { @@ -124,7 +128,7 @@ typedef enum { XML_SCHEMA_CONTENT_ELEMENTS, XML_SCHEMA_CONTENT_MIXED, XML_SCHEMA_CONTENT_SIMPLE, - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* obsolete, not used */ + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ XML_SCHEMA_CONTENT_BASIC, XML_SCHEMA_CONTENT_ANY } xmlSchemaContentType; @@ -242,31 +246,32 @@ struct _xmlSchemaAnnot { 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 ... */ - const xmlChar *name; /* name of the declaration or empty if particle */ - const xmlChar *id; - const xmlChar *ref; /* the local name of the attribute decl. if a particle */ - const xmlChar *refNs; /* the ns URI of the attribute decl. if a particle */ + xmlSchemaTypeType type; + struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ + const xmlChar *name; /* the name of the declaration */ + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ const xmlChar *typeName; /* the local name of the type definition */ const xmlChar *typeNs; /* the ns URI of the type definition */ xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr base; /* obsolete, not used */ - int occurs; - const xmlChar *defValue; + xmlSchemaTypePtr base; /* Deprecated; not used */ + int occurs; /* Deprecated; not used */ + const xmlChar *defValue; /* The initial value of the value constraint */ xmlSchemaTypePtr subtypes; /* the type definition */ xmlNodePtr node; const xmlChar *targetNamespace; int flags; - const xmlChar *refPrefix; - xmlSchemaValPtr defVal; - xmlSchemaAttributePtr refDecl; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value constraint */ + xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ }; /** * xmlSchemaAttributeLink: * Used to build a list of attribute uses on complexType definitions. + * WARNING: Deprecated; not used. */ typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; @@ -301,11 +306,11 @@ typedef struct _xmlSchemaWildcard xmlSchemaWildcard; typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; struct _xmlSchemaWildcard { xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *id; + const xmlChar *id; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlNodePtr node; - int minOccurs; - int maxOccurs; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ int processContents; int any; /* Indicates if the ns constraint is of ##any */ xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ @@ -332,6 +337,19 @@ struct _xmlSchemaWildcard { */ #define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 +/** + * XML_SCHEMAS_ATTRGROUP_REDEFINED: + * + * The attr group was redefined. + */ +#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 +/** + * XML_SCHEMAS_ATTRGROUP_HAS_REFS: + * + * Whether this attr. group contains attr. group references. + */ +#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 + /** * An attribute group definition. * @@ -345,18 +363,18 @@ struct _xmlSchemaAttributeGroup { struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ const xmlChar *name; const xmlChar *id; - const xmlChar *ref; - const xmlChar *refNs; + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; - xmlSchemaAttributePtr attributes; + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ xmlNodePtr node; int flags; xmlSchemaWildcardPtr attributeWildcard; - const xmlChar *refPrefix; - xmlSchemaAttributeGroupPtr refItem; /* The referenced attribute group */ + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ const xmlChar *targetNamespace; - /* xmlSchemaAttributeGroupPtr redef;*/ /* Redefinitions */ + void *attrUses; }; /** @@ -368,7 +386,7 @@ typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; struct _xmlSchemaTypeLink { struct _xmlSchemaTypeLink *next;/* the next type link ... */ - xmlSchemaTypePtr type;/* the linked type*/ + xmlSchemaTypePtr type;/* the linked type */ }; /** @@ -417,6 +435,9 @@ struct _xmlSchemaFacetLink { * XML_SCHEMAS_TYPE_VARIETY_ABSENT: * * the simpleType has a variety of "absent". + * TODO: Actually not necessary :-/, since if + * none of the variety flags occur then it's + * automatically absent. */ #define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 /** @@ -560,42 +581,57 @@ struct _xmlSchemaFacetLink { */ #define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 +/** + * XML_SCHEMAS_TYPE_REDEFINED: + * + * The type was redefined. + */ +#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 +/** + * XML_SCHEMAS_TYPE_REDEFINING: + * + * The type redefines an other type. + */ +/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ + /** * _xmlSchemaType: * * Schemas type definition. */ struct _xmlSchemaType { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next;/* the next type if in a sequence ... */ + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* the next type if in a sequence ... */ const xmlChar *name; - const xmlChar *id; - const xmlChar *ref; - const xmlChar *refNs; + const xmlChar *id ; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ xmlNodePtr node; - int minOccurs; - int maxOccurs; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ int flags; xmlSchemaContentType contentType; - const xmlChar *base; - const xmlChar *baseNs; - xmlSchemaTypePtr baseType; - xmlSchemaFacetPtr facets; - struct _xmlSchemaType *redef;/* possible redefinitions for the type */ - int recurse; - xmlSchemaAttributeLinkPtr attributeUses; + const xmlChar *base; /* Base type's local name */ + const xmlChar *baseNs; /* Base type's target namespace */ + xmlSchemaTypePtr baseType; /* The base type component */ + xmlSchemaFacetPtr facets; /* Local facets */ + struct _xmlSchemaType *redef; /* Deprecated; not used */ + int recurse; /* Obsolete */ + xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ xmlSchemaWildcardPtr attributeWildcard; - int builtInType; - xmlSchemaTypeLinkPtr memberTypes; - xmlSchemaFacetLinkPtr facetSet; - const xmlChar *refPrefix; - xmlSchemaTypePtr contentTypeDef; - xmlRegexpPtr contModel; + int builtInType; /* Type of built-in types. */ + xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ + xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. + Could we use @subtypes for this? */ + xmlRegexpPtr contModel; /* Holds the automaton of the content model */ const xmlChar *targetNamespace; + void *attrUses; }; /* @@ -727,18 +763,18 @@ struct _xmlSchemaType { 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 ... */ + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* Not used? */ const xmlChar *name; - const xmlChar *id; - const xmlChar *ref; /* the local name of the element declaration if a particle */ - const xmlChar *refNs; /* the ns URI of the element declaration if a particle */ + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlSchemaTypePtr subtypes; /* the type definition */ xmlSchemaAttributePtr attributes; xmlNodePtr node; - int minOccurs; - int maxOccurs; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ int flags; const xmlChar *targetNamespace; @@ -747,13 +783,14 @@ struct _xmlSchemaElement { const xmlChar *substGroup; const xmlChar *substGroupNs; const xmlChar *scope; - const xmlChar *value; - struct _xmlSchemaElement *refDecl; /* This will now be used for the substitution group affiliation */ - xmlRegexpPtr contModel; + const xmlChar *value; /* The original value of the value constraint. */ + struct _xmlSchemaElement *refDecl; /* This will now be used for the + substitution group affiliation */ + xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ xmlSchemaContentType contentType; - const xmlChar *refPrefix; - xmlSchemaValPtr defVal; - void *idcs; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value contraint. */ + void *idcs; /* The identity-constraint defs */ }; /* @@ -786,14 +823,14 @@ struct _xmlSchemaElement { struct _xmlSchemaFacet { xmlSchemaTypeType type; /* The kind of type */ struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ - const xmlChar *value; - const xmlChar *id; + const xmlChar *value; /* The original value */ + const xmlChar *id; /* Obsolete */ xmlSchemaAnnotPtr annot; xmlNodePtr node; - int fixed; + int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ int whitespace; - xmlSchemaValPtr val; - xmlRegexpPtr regexp; + xmlSchemaValPtr val; /* The compiled value */ + xmlRegexpPtr regexp; /* The regex for patterns */ }; /** @@ -802,7 +839,7 @@ struct _xmlSchemaFacet { typedef struct _xmlSchemaNotation xmlSchemaNotation; typedef xmlSchemaNotation *xmlSchemaNotationPtr; struct _xmlSchemaNotation { - xmlSchemaTypeType type; /* The kind of type */ + xmlSchemaTypeType type; /* The kind of type */ const xmlChar *name; xmlSchemaAnnotPtr annot; const xmlChar *identifier; @@ -810,7 +847,7 @@ struct _xmlSchemaNotation { }; /* -* Actually all those flags used for the schema should sit +* TODO: Actually all those flags used for the schema should sit * on the schema parser context, since they are used only * during parsing an XML schema document, and not available * on the component level as per spec. @@ -884,10 +921,10 @@ struct _xmlSchemaNotation { * A Schemas definition */ struct _xmlSchema { - const xmlChar *name; /* schema name */ - const xmlChar *targetNamespace; /* the target namespace */ + const xmlChar *name; /* schema name */ + const xmlChar *targetNamespace; /* the target namespace */ const xmlChar *version; - const xmlChar *id; + const xmlChar *id; /* Obsolete */ xmlDocPtr doc; xmlSchemaAnnotPtr annot; int flags; @@ -906,8 +943,8 @@ struct _xmlSchema { void *includes; /* the includes, this is opaque for now */ int preserve; /* whether to free the document */ int counter; /* used to give ononymous components unique names */ - xmlHashTablePtr idcDef; - void *volatiles; /* Deprecated; not used anymore. */ + xmlHashTablePtr idcDef; /* All identity-constraint defs. */ + void *volatiles; /* Obsolete */ }; XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); diff --git a/include/libxml/valid.h b/include/libxml/valid.h index d13e4eb..7492d28 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -410,7 +410,7 @@ XMLPUBFUN xmlElementPtr XMLCALL XMLPUBFUN int XMLCALL xmlValidGetPotentialChildren(xmlElementContent *ctree, - const xmlChar **list, + const xmlChar **names, int *len, int max); diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index e67b6e5..eea9ed6 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -231,6 +231,10 @@ XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateFile (FILE *file, xmlCharEncodingHandlerPtr encoder); +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, + xmlCharEncodingHandlerPtr encoder); + XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateFd (int fd, xmlCharEncodingHandlerPtr encoder); diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index bfe3c24..c83dc95 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -767,6 +767,11 @@ typedef enum { XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ + XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ + XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ + XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ + XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ XML_MODULE_OPEN = 4900, /* 4900 */ XML_MODULE_CLOSE, /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000, diff --git a/include/libxml/xmlreader.h b/include/libxml/xmlreader.h index f016546..1d12988 100644 --- a/include/libxml/xmlreader.h +++ b/include/libxml/xmlreader.h @@ -121,10 +121,15 @@ XMLPUBFUN void XMLCALL */ XMLPUBFUN int XMLCALL xmlTextReaderRead (xmlTextReaderPtr reader); + +#ifdef LIBXML_WRITER_ENABLED XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); + XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); +#endif + XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadString (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL @@ -279,6 +284,10 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, const char *xsd); +XMLPUBFUN int XMLCALL + xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, + xmlSchemaValidCtxtPtr ctxt, + int options); XMLPUBFUN int XMLCALL xmlTextReaderSetSchema (xmlTextReaderPtr reader, xmlSchemaPtr schema); diff --git a/include/libxml/xmlregexp.h b/include/libxml/xmlregexp.h index a257bb4..022cd6a 100644 --- a/include/libxml/xmlregexp.h +++ b/include/libxml/xmlregexp.h @@ -183,12 +183,12 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, - const xmlChar**list, + const xmlChar**langList, int len); XMLPUBFUN int XMLCALL xmlExpGetStart (xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, - const xmlChar**list, + const xmlChar**tokList, int len); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpStringDerive(xmlExpCtxtPtr ctxt, diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h index 766a2ac..c71c71a 100644 --- a/include/libxml/xmlsave.h +++ b/include/libxml/xmlsave.h @@ -45,14 +45,12 @@ XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToFilename (const char *filename, const char *encoding, int options); -/****** - Not yet implemented. XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToBuffer (xmlBufferPtr buffer, const char *encoding, int options); - ******/ + XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToIO (xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h index ab47091..15faef5 100644 --- a/include/libxml/xmlschemas.h +++ b/include/libxml/xmlschemas.h @@ -113,6 +113,10 @@ XMLPUBFUN void XMLCALL xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, void *ctx); +XMLPUBFUN void XMLCALL + xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); XMLPUBFUN int XMLCALL xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, xmlSchemaValidityErrorFunc * err, @@ -140,7 +144,8 @@ XMLPUBFUN void XMLCALL void *ctx); XMLPUBFUN void XMLCALL xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, void *ctx); + xmlStructuredErrorFunc serror, + void *ctx); XMLPUBFUN int XMLCALL xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc *err, diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 77d6659..867c94d 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.22" +#define LIBXML_DOTTED_VERSION "2.6.23" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 1002003 */ -#define LIBXML_VERSION 20622 +#define LIBXML_VERSION 20623 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "1002003" */ -#define LIBXML_VERSION_STRING "20622" +#define LIBXML_VERSION_STRING "20623" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-CVS2634" +#define LIBXML_VERSION_EXTRA "-CVS2717" /** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20622); +#define LIBXML_TEST_VERSION xmlCheckVersion(20623); #ifndef VMS #if 0 diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index a628741..cf547dd 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -299,7 +299,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the runtime debugging is configured in */ -#if @WITH_MEM_DEBUG@ +#if @WITH_RUN_DEBUG@ #define LIBXML_DEBUG_RUNTIME #endif diff --git a/include/win32config.h b/include/win32config.h index 9c75afd..c61dfa9 100644 --- a/include/win32config.h +++ b/include/win32config.h @@ -84,10 +84,12 @@ static int isnan (double d) { #endif #endif /* _MSC_VER */ -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) #define mkdir(p,m) _mkdir(p) #define snprintf _snprintf #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) +#elif defined(__MINGW32__) +#define mkdir(p,m) _mkdir(p) #endif /* Threading API to use should be specified here for compatibility reasons. diff --git a/include/wsockcompat.h b/include/wsockcompat.h index 690048c..a898b05 100644 --- a/include/wsockcompat.h +++ b/include/wsockcompat.h @@ -10,6 +10,18 @@ #else #undef HAVE_ERRNO_H #include +#include +/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */ +#if defined(GetAddrInfo) +#define HAVE_GETADDRINFO +#endif +#endif + +#ifdef __MINGW32__ +/* Include here to ensure that it doesn't get included later + * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */ +#include +#undef EWOULDBLOCK #endif #if !defined SOCKLEN_T diff --git a/legacy.c b/legacy.c index bbbd2c9..e75178a 100644 --- a/legacy.c +++ b/legacy.c @@ -673,7 +673,6 @@ xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, * * Creation of a Namespace, the old way using PI and without scoping * DEPRECATED !!! - * It now create a namespace on the root element of the document if found. * Returns NULL this functionality had been removed */ xmlNsPtr diff --git a/libxml.3 b/libxml.3 index d46756f..88d3eee 100644 --- a/libxml.3 +++ b/libxml.3 @@ -53,7 +53,7 @@ library exports Push and Pull type parser interfaces for both XML and static library .TP .B /depot/lib/libxml_2.0.0/libxml.so -shareable library +shared library .TP .B /depot/package/libxml_2.0.0/bin/xmllint binary application for parsing XML files diff --git a/libxml.spec.in b/libxml.spec.in index 16c9888..bf5dd5f 100644 --- a/libxml.spec.in +++ b/libxml.spec.in @@ -60,36 +60,6 @@ at parse time or later once the document has been modified. %setup -q %build -# -# try to use compiler profiling, based on Arjan van de Ven -# initial test spec. This really doesn't work okay for most tests done. -# -# Well except it's just broken most of the time. -#GCC_VERSION=`gcc --version | grep "^gcc" | awk '{ print $3 }' | sed 's+\([0-9]\)\.\([0-9]\)\..*+\1\2+'` -#if [ $GCC_VERSION -ge 34 ] -#then -# PROF_GEN='-fprofile-generate' -# PROF_USE='-fprofile-use' -#fi -# -#if [ "$PROF_GEN" != "" ] -#then -# # First generate a profiling version -# CFLAGS="${RPM_OPT_FLAGS} ${PROF_GEN}" %configure -# make -# # Run a few sampling -# make dba100000.xml -# ./xmllint --noout dba100000.xml -# ./xmllint --stream dba100000.xml -# ./xmllint --noout --valid test/valid/REC-xml-19980210.xml -# ./xmllint --stream --valid test/valid/REC-xml-19980210.xml -# # Then generate code based on profile -# CFLAGS="${RPM_OPT_FLAGS} ${PROF_USE}" %configure -# make -#else -# %configure -# make -#fi %configure make gzip -9 ChangeLog diff --git a/libxml2.spec b/libxml2.spec index f3256d6..1df9897 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.22 +Version: 2.6.23 Release: 1 License: MIT Group: Development/Libraries @@ -60,36 +60,6 @@ at parse time or later once the document has been modified. %setup -q %build -# -# try to use compiler profiling, based on Arjan van de Ven -# initial test spec. This really doesn't work okay for most tests done. -# -# Well except it's just broken most of the time. -#GCC_VERSION=`gcc --version | grep "^gcc" | awk '{ print $3 }' | sed 's+\([0-9]\)\.\([0-9]\)\..*+\1\2+'` -#if [ $GCC_VERSION -ge 34 ] -#then -# PROF_GEN='-fprofile-generate' -# PROF_USE='-fprofile-use' -#fi -# -#if [ "$PROF_GEN" != "" ] -#then -# # First generate a profiling version -# CFLAGS="${RPM_OPT_FLAGS} ${PROF_GEN}" %configure -# make -# # Run a few sampling -# make dba100000.xml -# ./xmllint --noout dba100000.xml -# ./xmllint --stream dba100000.xml -# ./xmllint --noout --valid test/valid/REC-xml-19980210.xml -# ./xmllint --stream --valid test/valid/REC-xml-19980210.xml -# # Then generate code based on profile -# CFLAGS="${RPM_OPT_FLAGS} ${PROF_USE}" %configure -# make -#else -# %configure -# make -#fi %configure make gzip -9 ChangeLog @@ -157,8 +127,8 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Mon Sep 12 2005 Daniel Veillard -- upstream release 2.6.22 see http://xmlsoft.org/news.html +* Thu Jan 5 2006 Daniel Veillard +- upstream release 2.6.23 see http://xmlsoft.org/news.html * Thu Jan 2 2003 Daniel Veillard - integrated drv_libxml2 xml.sax driver from Stéphane Bidoul diff --git a/macos/src/config-mac.h b/macos/src/config-mac.h index 7281426..e9a8f9d 100644 --- a/macos/src/config-mac.h +++ b/macos/src/config-mac.h @@ -177,15 +177,6 @@ /* Define if you have the header file. */ #undef HAVE_ZLIB_H -/* Define if you have the inet library (-linet). */ -#undef HAVE_LIBINET - -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define if you have the socket library (-lsocket). */ -#undef HAVE_LIBSOCKET - /* Name of package */ #define PACKAGE diff --git a/nanohttp.c b/nanohttp.c index 1244fe7..ae7923f 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -11,9 +11,6 @@ * daniel@veillard.com */ -/* TODO add compression support, Send the Accept- , and decompress on the - fly with ZLIB if found at compile-time */ - #define NEED_SOCKETS #define IN_LIBXML #include "libxml.h" @@ -66,6 +63,10 @@ #ifdef SUPPORT_IP6 #include #endif +#ifdef HAVE_ZLIB_H +#include +#endif + #ifdef VMS #include @@ -152,6 +153,10 @@ typedef struct xmlNanoHTTPCtxt { char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */ char *encoding; /* encoding extracted from the contentType */ char *mimeType; /* Mime-Type extracted from the contentType */ +#ifdef HAVE_ZLIB_H + z_stream *strm; /* Zlib stream object */ + int usesGzip; /* "Content-Encoding: gzip" was detected */ +#endif } xmlNanoHTTPCtxt, *xmlNanoHTTPCtxtPtr; static int initialized = 0; @@ -413,6 +418,13 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) { if (ctxt->mimeType != NULL) xmlFree(ctxt->mimeType); if (ctxt->location != NULL) xmlFree(ctxt->location); if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader); +#ifdef HAVE_ZLIB_H + if (ctxt->strm != NULL) { + inflateEnd(ctxt->strm); + xmlFree(ctxt->strm); + } +#endif + ctxt->state = XML_NANO_HTTP_NONE; if (ctxt->fd >= 0) closesocket(ctxt->fd); ctxt->fd = -1; @@ -752,6 +764,26 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader); ctxt->authHeader = xmlMemStrdup(cur); +#ifdef HAVE_ZLIB_H + } else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Encoding:", 17) ) { + cur += 17; + while ((*cur == ' ') || (*cur == '\t')) cur++; + if ( !xmlStrncasecmp( BAD_CAST cur, BAD_CAST"gzip", 4) ) { + ctxt->usesGzip = 1; + + ctxt->strm = xmlMalloc(sizeof(z_stream)); + + if (ctxt->strm != NULL) { + ctxt->strm->zalloc = Z_NULL; + ctxt->strm->zfree = Z_NULL; + ctxt->strm->opaque = Z_NULL; + ctxt->strm->avail_in = 0; + ctxt->strm->next_in = Z_NULL; + + inflateInit2( ctxt->strm, 31 ); + } + } +#endif } else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Length:", 15) ) { cur += 15; ctxt->ContentLength = strtol( cur, NULL, 10 ); @@ -946,14 +978,21 @@ xmlNanoHTTPConnectHost(const char *host, int port) memset (&sockin, 0, sizeof(sockin)); #ifdef SUPPORT_IP6 memset (&sockin6, 0, sizeof(sockin6)); +#endif + +#if !defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && defined(RES_USE_INET6) if (have_ipv6 ()) -#if !defined(HAVE_GETADDRINFO) && defined(RES_USE_INET6) { if (!(_res.options & RES_INIT)) res_init(); _res.options |= RES_USE_INET6; } -#elif defined(HAVE_GETADDRINFO) +#endif + +#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32) + if (have_ipv6 ()) +#endif +#if defined(HAVE_GETADDRINFO) && (defined(SUPPORT_IP6) || defined(_WIN32)) { int status; struct addrinfo hints, *res, *result; @@ -969,42 +1008,45 @@ xmlNanoHTTPConnectHost(const char *host, int port) } for (res = result; res; res = res->ai_next) { - if (res->ai_family == AF_INET || res->ai_family == AF_INET6) { - if (res->ai_family == AF_INET6) { - if (res->ai_addrlen > sizeof(sockin6)) { - __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); - freeaddrinfo (result); - return (-1); - } - memcpy (&sockin6, res->ai_addr, res->ai_addrlen); - sockin6.sin6_port = htons (port); - addr = (struct sockaddr *)&sockin6; - } - else { - if (res->ai_addrlen > sizeof(sockin)) { - __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); - freeaddrinfo (result); - return (-1); - } - memcpy (&sockin, res->ai_addr, res->ai_addrlen); - sockin.sin_port = htons (port); - addr = (struct sockaddr *)&sockin; + if (res->ai_family == AF_INET) { + if (res->ai_addrlen > sizeof(sockin)) { + __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); + freeaddrinfo (result); + return (-1); } - - s = xmlNanoHTTPConnectAttempt (addr); - if (s != -1) { + memcpy (&sockin, res->ai_addr, res->ai_addrlen); + sockin.sin_port = htons (port); + addr = (struct sockaddr *)&sockin; +#ifdef SUPPORT_IP6 + } else if (have_ipv6 () && (res->ai_family == AF_INET6)) { + if (res->ai_addrlen > sizeof(sockin6)) { + __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); - return (s); + return (-1); } + memcpy (&sockin6, res->ai_addr, res->ai_addrlen); + sockin6.sin6_port = htons (port); + addr = (struct sockaddr *)&sockin6; +#endif + } else + continue; /* for */ + + s = xmlNanoHTTPConnectAttempt (addr); + if (s != -1) { + freeaddrinfo (result); + return (s); } } + if (result) freeaddrinfo (result); - return (-1); - } else + } #endif +#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32) + else #endif - { +#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32) + { h = gethostbyname (host); if (h == NULL) { @@ -1080,6 +1122,8 @@ xmlNanoHTTPConnectHost(const char *host, int port) return (s); } } +#endif + #ifdef DEBUG_HTTP xmlGenericError(xmlGenericErrorContext, "xmlNanoHTTPConnectHost: unable to connect to '%s'.\n", @@ -1144,11 +1188,38 @@ xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) { int xmlNanoHTTPRead(void *ctx, void *dest, int len) { xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx; +#ifdef HAVE_ZLIB_H + int bytes_read = 0; + int orig_avail_in; + int z_ret; +#endif if (ctx == NULL) return(-1); if (dest == NULL) return(-1); if (len <= 0) return(0); +#ifdef HAVE_ZLIB_H + if (ctxt->usesGzip == 1) { + if (ctxt->strm == NULL) return(0); + + ctxt->strm->next_out = dest; + ctxt->strm->avail_out = len; + + do { + orig_avail_in = ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr - bytes_read; + ctxt->strm->next_in = BAD_CAST (ctxt->inrptr + bytes_read); + + z_ret = inflate(ctxt->strm, Z_NO_FLUSH); + bytes_read += orig_avail_in - ctxt->strm->avail_in; + + if (z_ret != Z_OK) break; + } while (ctxt->strm->avail_out > 0 && xmlNanoHTTPRecv(ctxt) > 0); + + ctxt->inrptr += bytes_read; + return(len - ctxt->strm->avail_out); + } +#endif + while (ctxt->inptr - ctxt->inrptr < len) { if (xmlNanoHTTPRecv(ctxt) <= 0) break; } @@ -1263,6 +1334,9 @@ retry: if (ctxt->query != NULL) blen += strlen(ctxt->query) + 1; blen += strlen(method) + strlen(ctxt->path) + 24; +#ifdef HAVE_ZLIB_H + blen += 23; +#endif bp = (char*)xmlMallocAtomic(blen); if ( bp == NULL ) { xmlNanoHTTPFreeCtxt( ctxt ); @@ -1291,6 +1365,10 @@ retry: p += snprintf( p, blen - (p - bp), " HTTP/1.0\r\nHost: %s\r\n", ctxt->hostname); +#ifdef HAVE_ZLIB_H + p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n"); +#endif + if (contentType != NULL && *contentType) p += snprintf(p, blen - (p - bp), "Content-Type: %s\r\n", *contentType); diff --git a/parser.c b/parser.c index ce6e003..ec7fb53 100644 --- a/parser.c +++ b/parser.c @@ -2177,6 +2177,9 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, if (val != 0) { COPY_BUF(0,buffer,nbchars,val); } + if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { + growBuffer(buffer); + } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, @@ -2187,6 +2190,9 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); + if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { + growBuffer(buffer); + } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "predefined entity has no content\n"); @@ -3449,12 +3455,10 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { get_more_space: while (*in == 0x20) in++; if (*in == 0xA) { - ctxt->input->line++; ctxt->input->col = 1; - in++; - while (*in == 0xA) { + do { ctxt->input->line++; ctxt->input->col = 1; in++; - } + } while (*in == 0xA); goto get_more_space; } if (*in == '<') { @@ -3490,12 +3494,10 @@ get_more: } ctxt->input->col = ccol; if (*in == 0xA) { - ctxt->input->line++; ctxt->input->col = 1; - in++; - while (*in == 0xA) { + do { ctxt->input->line++; ctxt->input->col = 1; in++; - } + } while (*in == 0xA); goto get_more; } if (*in == ']') { @@ -3537,12 +3539,16 @@ get_more: ctxt->input->cur = in; if (*in == 0xD) { in++; + if (!*in) /* if end of current chunk return */ + return; if (*in == 0xA) { ctxt->input->cur = in; in++; ctxt->input->line++; ctxt->input->col = 1; continue; /* while */ } + if (!*in) /* if end of current chunk return */ + return; in--; } if (*in == '<') { @@ -3856,12 +3862,10 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { in = ctxt->input->cur; do { if (*in == 0xA) { - ctxt->input->line++; ctxt->input->col = 1; - in++; - while (*in == 0xA) { + do { ctxt->input->line++; ctxt->input->col = 1; in++; - } + } while (*in == 0xA); } get_more: ccol = ctxt->input->col; @@ -3873,12 +3877,10 @@ get_more: } ctxt->input->col = ccol; if (*in == 0xA) { - ctxt->input->line++; ctxt->input->col = 1; - in++; - while (*in == 0xA) { + do { ctxt->input->line++; ctxt->input->col = 1; in++; - } + } while (*in == 0xA); goto get_more; } nbchar = in - ctxt->input->cur; @@ -3929,6 +3931,8 @@ get_more: ctxt->input->line++; ctxt->input->col = 1; continue; /* while */ } + if (!*in) /* if end of current chunk return */ + return; in--; } SHRINK; @@ -8888,6 +8892,13 @@ void xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { xmlChar *version; + /* + * This value for standalone indicates that the document has an + * XML declaration but it does not have a standalone attribute. + * It will be overwritten later if a standalone attribute is found. + */ + ctxt->input->standalone = -2; + /* * We know that 'length == 0) || (input->buf == NULL)) { - /* - * When parsing a static memory array one must know the - * size to be able to convert the buffer. - */ - xmlErrInternal(ctxt, "switching encoding : no input\n", NULL); - return (-1); - } else { - int processed; - - /* - * Shrink the current input buffer. - * Move it as the raw buffer and create a new input buffer - */ - processed = input->cur - input->base; - - input->buf->raw = xmlBufferCreate(); - xmlBufferAdd(input->buf->raw, input->cur, - input->length - processed); - input->buf->buffer = xmlBufferCreate(); - - /* - * convert as much as possible of the raw input - * to the parser reading buffer. - */ - nbchars = xmlCharEncInFunc(input->buf->encoder, - input->buf->buffer, - input->buf->raw); - if (nbchars < 0) { - xmlErrInternal(ctxt, - "switching encoding: encoder error\n", - NULL); - return (-1); - } - - /* - * Conversion succeeded, get rid of the old buffer - */ - if ((input->free != NULL) && (input->base != NULL)) - input->free((xmlChar *) input->base); - input->base = input->cur = input->buf->buffer->content; - input->end = &input->base[input->buf->buffer->use]; - } + } else if (input->length == 0) { + /* + * When parsing a static memory array one must know the + * size to be able to convert the buffer. + */ + xmlErrInternal(ctxt, "switching encoding : no input\n", NULL); + return (-1); } return (0); } @@ -1492,8 +1455,13 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { if (ctxt == NULL) return(NULL); buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); if (buf == NULL) { - __xmlLoaderErr(ctxt, "failed to load external entity \"%s\"\n", - (const char *) filename); + if (filename == NULL) + __xmlLoaderErr(ctxt, + "failed to load external entity: NULL filename \n", + NULL); + else + __xmlLoaderErr(ctxt, "failed to load external entity \"%s\"\n", + (const char *) filename); return(NULL); } @@ -1912,7 +1880,7 @@ xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, int found = 0; if ((seq == NULL) || (node == NULL)) - return (-1); + return ((unsigned long) -1); /* Do a binary search for the key */ lower = 1; diff --git a/pattern.c b/pattern.c index a76a58c..7b3e508 100644 --- a/pattern.c +++ b/pattern.c @@ -46,26 +46,43 @@ #define XML_STREAM_STEP_FINAL 2 #define XML_STREAM_STEP_ROOT 4 #define XML_STREAM_STEP_ATTR 8 +#define XML_STREAM_STEP_NODE 16 +#define XML_STREAM_STEP_IN_SET 32 /* -* TODO: This is used on _xmlStreamCtxt, so don't use any values -* from xmlPatternFlags. +* NOTE: Those private flags (XML_STREAM_xxx) are used +* in _xmlStreamCtxt->flag. They extend the public +* xmlPatternFlags, so be carefull not to interfere with the +* reserved values for xmlPatternFlags. */ +#define XML_STREAM_FINAL_IS_ANY_NODE 1<<14 +#define XML_STREAM_FROM_ROOT 1<<15 #define XML_STREAM_DESC 1<<16 +/* +* XML_STREAM_ANY_NODE is used for comparison against +* xmlElementType enums, to indicate a node of any type. +*/ +#define XML_STREAM_ANY_NODE 100 + #define XML_PATTERN_NOTPATTERN (XML_PATTERN_XPATH | \ XML_PATTERN_XSSEL | \ XML_PATTERN_XSFIELD) -#define XML_STREAM_XS_IDC(item) (item->flags & \ +#define XML_STREAM_XS_IDC(c) ((c)->flags & \ (XML_PATTERN_XSSEL | XML_PATTERN_XSFIELD)) +#define XML_STREAM_XS_IDC_SEL(c) ((c)->flags & XML_PATTERN_XSSEL) + +#define XML_STREAM_XS_IDC_FIELD(c) ((c)->flags & XML_PATTERN_XSFIELD) + typedef struct _xmlStreamStep xmlStreamStep; typedef xmlStreamStep *xmlStreamStepPtr; struct _xmlStreamStep { int flags; /* properties of that step */ const xmlChar *name; /* first string value if NULL accept all */ const xmlChar *ns; /* second string value */ + int nodeType; /* type of node */ }; typedef struct _xmlStreamComp xmlStreamComp; @@ -690,6 +707,7 @@ rollback: #define CUR (*ctxt->cur) #define SKIP(val) ctxt->cur += (val) #define NXT(val) ctxt->cur[(val)] +#define PEEKPREV(val) ctxt->cur[-(val)] #define CUR_PTR ctxt->cur #define SKIP_BLANKS \ @@ -884,6 +902,7 @@ xmlCompileAttributeTest(xmlPatParserContextPtr ctxt) { xmlChar *name = NULL; xmlChar *URL = NULL; + SKIP_BLANKS; name = xmlPatScanNCName(ctxt); if (name == NULL) { if (CUR == '*') { @@ -901,6 +920,13 @@ xmlCompileAttributeTest(xmlPatParserContextPtr ctxt) { xmlChar *prefix = name; NEXT; + + if (IS_BLANK_CH(CUR)) { + ERROR5(NULL, NULL, NULL, "Invalid QName.\n", NULL); + xmlFree(prefix); + ctxt->error = 1; + goto error; + } /* * This is a namespace match */ @@ -967,25 +993,39 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) { xmlChar *token = NULL; xmlChar *name = NULL; xmlChar *URL = NULL; + int hasBlanks = 0; SKIP_BLANKS; if (CUR == '.') { + /* + * Context node. + */ NEXT; PUSH(XML_OP_ELEM, NULL, NULL); return; } + if (CUR == '@') { + /* + * Attribute test. + */ + if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) { + ERROR5(NULL, NULL, NULL, + "Unexpected attribute axis in '%s'.\n", ctxt->base); + ctxt->error = 1; + return; + } + NEXT; + xmlCompileAttributeTest(ctxt); + if (ctxt->error != 0) + goto error; + return; + } name = xmlPatScanNCName(ctxt); if (name == NULL) { if (CUR == '*') { NEXT; PUSH(XML_OP_ALL, NULL, NULL); return; - } else if (CUR == '@') { - NEXT; - xmlCompileAttributeTest(ctxt); - if (ctxt->error != 0) - goto error; - return; } else { ERROR(NULL, NULL, NULL, "xmlCompileStepPattern : Name expected\n"); @@ -993,13 +1033,21 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) { return; } } - SKIP_BLANKS; + if (IS_BLANK_CH(CUR)) { + hasBlanks = 1; + SKIP_BLANKS; + } if (CUR == ':') { NEXT; if (CUR != ':') { xmlChar *prefix = name; - int i; + int i; + if (hasBlanks || IS_BLANK_CH(CUR)) { + ERROR5(NULL, NULL, NULL, "Invalid QName.\n", NULL); + ctxt->error = 1; + goto error; + } /* * This is a namespace match */ @@ -1060,6 +1108,11 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) { int i; NEXT; + if (IS_BLANK_CH(CUR)) { + ERROR5(NULL, NULL, NULL, "Invalid QName.\n", NULL); + ctxt->error = 1; + goto error; + } /* * This is a namespace match */ @@ -1104,13 +1157,19 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) { } else if (xmlStrEqual(name, (const xmlChar *) "attribute")) { xmlFree(name); name = NULL; + if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) { + ERROR5(NULL, NULL, NULL, + "Unexpected attribute axis in '%s'.\n", ctxt->base); + ctxt->error = 1; + goto error; + } xmlCompileAttributeTest(ctxt); if (ctxt->error != 0) goto error; return; } else { - ERROR(NULL, NULL, NULL, - "xmlCompileStepPattern : 'child' or 'attribute' expected\n"); + ERROR5(NULL, NULL, NULL, + "The 'element' or 'attribute' axis is expected.\n", NULL); ctxt->error = 1; goto error; } @@ -1167,20 +1226,41 @@ xmlCompilePathPattern(xmlPatParserContextPtr ctxt) { NEXT; NEXT; NEXT; + /* Check for incompleteness. */ + SKIP_BLANKS; + if (CUR == 0) { + ERROR5(NULL, NULL, NULL, + "Incomplete expression '%s'.\n", ctxt->base); + ctxt->error = 1; + goto error; + } } if (CUR == '@') { NEXT; xmlCompileAttributeTest(ctxt); SKIP_BLANKS; + /* TODO: check for incompleteness */ if (CUR != 0) { xmlCompileStepPattern(ctxt); + if (ctxt->error != 0) + goto error; } } else { if (CUR == '/') { PUSH(XML_OP_ROOT, NULL, NULL); NEXT; + /* Check for incompleteness. */ + SKIP_BLANKS; + if (CUR == 0) { + ERROR5(NULL, NULL, NULL, + "Incomplete expression '%s'.\n", ctxt->base); + ctxt->error = 1; + goto error; + } } xmlCompileStepPattern(ctxt); + if (ctxt->error != 0) + goto error; SKIP_BLANKS; while (CUR == '/') { if (NXT(1) == '/') { @@ -1189,13 +1269,21 @@ xmlCompilePathPattern(xmlPatParserContextPtr ctxt) { NEXT; SKIP_BLANKS; xmlCompileStepPattern(ctxt); + if (ctxt->error != 0) + goto error; } else { PUSH(XML_OP_PARENT, NULL, NULL); NEXT; SKIP_BLANKS; - if (CUR != 0) { - xmlCompileStepPattern(ctxt); + if (CUR == 0) { + ERROR5(NULL, NULL, NULL, + "Incomplete expression '%s'.\n", ctxt->base); + ctxt->error = 1; + goto error; } + xmlCompileStepPattern(ctxt); + if (ctxt->error != 0) + goto error; } } } @@ -1208,6 +1296,107 @@ error: return; } +/** + * xmlCompileIDCXPathPath: + * @ctxt: the compilation context + * + * Compile the Path Pattern and generates a precompiled + * form suitable for fast matching. + * + * [5] Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest ) + */ +static void +xmlCompileIDCXPathPath(xmlPatParserContextPtr ctxt) { + SKIP_BLANKS; + if (CUR == '/') { + ERROR5(NULL, NULL, NULL, + "Unexpected selection of the document root in '%s'.\n", + ctxt->base); + goto error; + } + ctxt->comp->flags |= PAT_FROM_CUR; + + if (CUR == '.') { + /* "." - "self::node()" */ + NEXT; + SKIP_BLANKS; + if (CUR == 0) { + /* + * Selection of the context node. + */ + PUSH(XML_OP_ELEM, NULL, NULL); + return; + } + if (CUR != '/') { + /* TODO: A more meaningful error message. */ + ERROR5(NULL, NULL, NULL, + "Unexpected token after '.' in '%s'.\n", ctxt->base); + goto error; + } + /* "./" - "self::node()/" */ + NEXT; + SKIP_BLANKS; + if (CUR == '/') { + if (IS_BLANK_CH(PEEKPREV(1))) { + /* + * Disallow "./ /" + */ + ERROR5(NULL, NULL, NULL, + "Unexpected '/' token in '%s'.\n", ctxt->base); + goto error; + } + /* ".//" - "self:node()/descendant-or-self::node()/" */ + PUSH(XML_OP_ANCESTOR, NULL, NULL); + NEXT; + SKIP_BLANKS; + } + if (CUR == 0) + goto error_unfinished; + } + /* + * Process steps. + */ + do { + xmlCompileStepPattern(ctxt); + if (ctxt->error != 0) + goto error; + SKIP_BLANKS; + if (CUR != '/') + break; + PUSH(XML_OP_PARENT, NULL, NULL); + NEXT; + SKIP_BLANKS; + if (CUR == '/') { + /* + * Disallow subsequent '//'. + */ + ERROR5(NULL, NULL, NULL, + "Unexpected subsequent '//' in '%s'.\n", + ctxt->base); + goto error; + } + if (CUR == 0) + goto error_unfinished; + + } while (CUR != 0); + + if (CUR != 0) { + ERROR5(NULL, NULL, NULL, + "Failed to compile expression '%s'.\n", ctxt->base); + ctxt->error = 1; + } + return; +error: + ctxt->error = 1; + return; + +error_unfinished: + ctxt->error = 1; + ERROR5(NULL, NULL, NULL, + "Unfinished expression '%s'.\n", ctxt->base); + return; +} + /************************************************************************ * * * The streaming code * @@ -1334,7 +1523,7 @@ xmlFreeStreamComp(xmlStreamCompPtr comp) { */ static int xmlStreamCompAddStep(xmlStreamCompPtr comp, const xmlChar *name, - const xmlChar *ns, int flags) { + const xmlChar *ns, int nodeType, int flags) { xmlStreamStepPtr cur; if (comp->nbStep >= comp->maxStep) { @@ -1352,6 +1541,7 @@ xmlStreamCompAddStep(xmlStreamCompPtr comp, const xmlChar *name, cur->flags = flags; cur->name = name; cur->ns = ns; + cur->nodeType = nodeType; return(comp->nbStep - 1); } @@ -1366,7 +1556,8 @@ xmlStreamCompAddStep(xmlStreamCompPtr comp, const xmlChar *name, static int xmlStreamCompile(xmlPatternPtr comp) { xmlStreamCompPtr stream; - int i, s = 0, root = 0, flags = 0; + int i, s = 0, root = 0, flags = 0, prevs = -1; + xmlStepOp step; if ((comp == NULL) || (comp->steps == NULL)) return(-1); @@ -1380,6 +1571,8 @@ xmlStreamCompile(xmlPatternPtr comp) { stream = xmlNewStreamComp(0); if (stream == NULL) return(-1); + /* Note that the stream will have no steps in this case. */ + stream->flags |= XML_STREAM_FINAL_IS_ANY_NODE; comp->stream = stream; return(0); } @@ -1392,19 +1585,13 @@ xmlStreamCompile(xmlPatternPtr comp) { xmlDictReference(stream->dict); } - /* - * Skip leading ./ on relative paths - */ - i = 0; - while ((comp->flags & PAT_FROM_CUR) && (comp->nbStep > i + 2) && - (comp->steps[i].op == XML_OP_ELEM) && - (comp->steps[i].value == NULL) && - (comp->steps[i].value2 == NULL) && - (comp->steps[i + 1].op == XML_OP_PARENT)) { - i += 2; - } + i = 0; + if (comp->flags & PAT_FROM_ROOT) + stream->flags |= XML_STREAM_FROM_ROOT; + for (;i < comp->nbStep;i++) { - switch (comp->steps[i].op) { + step = comp->steps[i]; + switch (step.op) { case XML_OP_END: break; case XML_OP_ROOT: @@ -1413,51 +1600,95 @@ xmlStreamCompile(xmlPatternPtr comp) { root = 1; break; case XML_OP_NS: - s = xmlStreamCompAddStep(stream, NULL, - comp->steps[i].value, flags); - flags = 0; + s = xmlStreamCompAddStep(stream, NULL, step.value, + XML_ELEMENT_NODE, flags); if (s < 0) goto error; + prevs = s; + flags = 0; break; case XML_OP_ATTR: flags |= XML_STREAM_STEP_ATTR; - s = xmlStreamCompAddStep(stream, comp->steps[i].value, - comp->steps[i].value2, flags); + prevs = -1; + s = xmlStreamCompAddStep(stream, + step.value, step.value2, XML_ATTRIBUTE_NODE, flags); flags = 0; if (s < 0) goto error; break; - case XML_OP_ELEM: - if ((comp->steps[i].value == NULL) && - (comp->steps[i].value2 == NULL) && - (comp->nbStep > i + 2) && - (comp->steps[i + 1].op == XML_OP_PARENT)) { - i++; - continue; - } + case XML_OP_ELEM: + if ((step.value == NULL) && (step.value2 == NULL)) { + /* + * We have a "." or "self::node()" here. + * Eliminate redundant self::node() tests like in "/./." + * or "//./" + * The only case we won't eliminate is "//.", i.e. if + * self::node() is the last node test and we had + * continuation somewhere beforehand. + */ + if ((comp->nbStep == i + 1) && + (flags & XML_STREAM_STEP_DESC)) { + /* + * Mark the special case where the expression resolves + * to any type of node. + */ + if (comp->nbStep == i + 1) { + stream->flags |= XML_STREAM_FINAL_IS_ANY_NODE; + } + flags |= XML_STREAM_STEP_NODE; + s = xmlStreamCompAddStep(stream, NULL, NULL, + XML_STREAM_ANY_NODE, flags); + if (s < 0) + goto error; + flags = 0; + /* + * If there was a previous step, mark it to be added to + * the result node-set; this is needed since only + * the last step will be marked as "final" and only + * "final" nodes are added to the resulting set. + */ + if (prevs != -1) { + stream->steps[prevs].flags |= XML_STREAM_STEP_IN_SET; + prevs = -1; + } + break; + + } else { + /* Just skip this one. */ + continue; + } + } + /* An element node. */ + s = xmlStreamCompAddStep(stream, step.value, step.value2, + XML_ELEMENT_NODE, flags); + if (s < 0) + goto error; + prevs = s; + flags = 0; + break; case XML_OP_CHILD: - s = xmlStreamCompAddStep(stream, comp->steps[i].value, - comp->steps[i].value2, flags); - flags = 0; + /* An element node child. */ + s = xmlStreamCompAddStep(stream, step.value, step.value2, + XML_ELEMENT_NODE, flags); if (s < 0) goto error; + prevs = s; + flags = 0; break; case XML_OP_ALL: - s = xmlStreamCompAddStep(stream, NULL, NULL, flags); - flags = 0; + s = xmlStreamCompAddStep(stream, NULL, NULL, + XML_ELEMENT_NODE, flags); if (s < 0) goto error; + prevs = s; + flags = 0; break; - case XML_OP_PARENT: - if ((comp->nbStep > i + 1) && - (comp->steps[i + 1].op == XML_OP_ELEM) && - (comp->steps[i + 1].value == NULL) && - (comp->steps[i + 1].value2 == NULL)) { - i++; - continue; - } + case XML_OP_PARENT: break; case XML_OP_ANCESTOR: + /* Skip redundant continuations. */ + if (flags & XML_STREAM_STEP_DESC) + break; flags |= XML_STREAM_STEP_DESC; /* * Mark the expression as having "//". @@ -1481,6 +1712,8 @@ xmlStreamCompile(xmlPatternPtr comp) { stream->steps[0].flags |= XML_STREAM_STEP_DESC; } } + if (stream->nbStep <= s) + goto error; stream->steps[s].flags |= XML_STREAM_STEP_FINAL; if (root) stream->steps[0].flags |= XML_STREAM_STEP_ROOT; @@ -1603,7 +1836,7 @@ xmlStreamCtxtAddState(xmlStreamCtxtPtr comp, int idx, int level) { static int xmlStreamPushInternal(xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns, - xmlElementType nodeType) { + int nodeType) { int ret = 0, err = 0, final = 0, tmp, i, m, match, step, desc; xmlStreamCompPtr comp; #ifdef DEBUG_STREAMING @@ -1615,16 +1848,34 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream, while (stream != NULL) { comp = stream->comp; - if ((name == NULL) && (ns == NULL)) { + + if ((nodeType == XML_ELEMENT_NODE) && + (name == NULL) && (ns == NULL)) { + /* We have a document node here (or a reset). */ stream->nbState = 0; stream->level = 0; stream->blockLevel = -1; - if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) { - tmp = xmlStreamCtxtAddState(stream, 0, 0); - if (tmp < 0) - err++; - if (comp->nbStep == 0) + if (comp->flags & XML_STREAM_FROM_ROOT) { + if (comp->nbStep == 0) { + /* TODO: We have a "/." here? */ ret = 1; + } else { + if ((comp->nbStep == 1) && + (comp->steps[0].nodeType == XML_STREAM_ANY_NODE) && + (comp->steps[0].flags & XML_STREAM_STEP_DESC)) + { + /* + * In the case of "//." the document node will match + * as well. + */ + ret = 1; + } else if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) { + /* TODO: Do we need this ? */ + tmp = xmlStreamCtxtAddState(stream, 0, 0); + if (tmp < 0) + err++; + } + } } stream = stream->next; continue; /* while */ @@ -1647,7 +1898,7 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream, * or traditional XPath expressions, this will match if * we are at the first level only, otherwise on every level. */ - if ((nodeType == XML_ELEMENT_NODE) && + if ((nodeType != XML_ATTRIBUTE_NODE) && (((stream->flags & XML_PATTERN_NOTPATTERN) == 0) || (stream->level == 0))) { ret = 1; @@ -1662,6 +1913,19 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream, stream->level++; goto stream_next; } + + if ((nodeType != XML_ELEMENT_NODE) && + (nodeType != XML_ATTRIBUTE_NODE) && + ((comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) == 0)) { + /* + * No need to process nodes of other types if we don't + * resolve to those types. + * TODO: Do we need to block the context here? + */ + stream->level++; + goto stream_next; + } + /* * Check evolution of existing states */ @@ -1710,14 +1974,24 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream, /* * Check for correct node-type. */ - if ((nodeType == XML_ATTRIBUTE_NODE) && - ((comp->steps[step].flags & XML_STREAM_STEP_ATTR) == 0)) - goto next_state; + if (comp->steps[step].nodeType != nodeType) { + if (comp->steps[step].nodeType == XML_ATTRIBUTE_NODE) { + /* + * Block this expression for deeper evaluation. + */ + if ((comp->flags & XML_STREAM_DESC) == 0) + stream->blockLevel = stream->level +1; + goto next_state; + } else if (comp->steps[step].nodeType != XML_STREAM_ANY_NODE) + goto next_state; + } /* * Compare local/namespace-name. */ match = 0; - if (comp->dict) { + if (comp->steps[step].nodeType == XML_STREAM_ANY_NODE) { + match = 1; + } else if (comp->dict) { if (comp->steps[step].name == NULL) { if (comp->steps[step].ns == NULL) match = 1; @@ -1756,7 +2030,15 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream, stream->level + 1); } } - } + if ((ret != 1) && + (comp->steps[step].flags & XML_STREAM_STEP_IN_SET)) { + /* + * Check if we have a special case like "foo/bar//.", where + * "foo" is selected as well. + */ + ret = 1; + } + } if (((comp->flags & XML_STREAM_DESC) == 0) && ((! match) || final)) { /* @@ -1774,6 +2056,8 @@ next_state: /* * Re/enter the expression. + * Don't reenter if it's an absolute expression like "/foo", + * except "//foo". */ if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) goto stream_next; @@ -1816,14 +2100,19 @@ compare: /* * Check expected node-type. */ - if ((nodeType == XML_ATTRIBUTE_NODE) && - ((comp->steps[0].flags & XML_STREAM_STEP_ATTR) == 0)) - goto stream_next; + if (comp->steps[0].nodeType != nodeType) { + if (nodeType == XML_ATTRIBUTE_NODE) + goto stream_next; + else if (comp->steps[0].nodeType != XML_STREAM_ANY_NODE) + goto stream_next; + } /* * Compare local/namespace-name. */ match = 0; - if (comp->steps[0].name == NULL) { + if (comp->steps[0].nodeType == XML_STREAM_ANY_NODE) { + match = 1; + } else if (comp->steps[0].name == NULL) { if (comp->steps[0].ns == NULL) match = 1; else { @@ -1840,12 +2129,20 @@ compare: match = ((xmlStrEqual(comp->steps[0].name, name)) && (xmlStrEqual(comp->steps[0].ns, ns))); } - if (match) { - final = comp->steps[0].flags & XML_STREAM_STEP_FINAL; + final = comp->steps[0].flags & XML_STREAM_STEP_FINAL; + if (match) { if (final) ret = 1; else xmlStreamCtxtAddState(stream, 1, stream->level); + if ((ret != 1) && + (comp->steps[0].flags & XML_STREAM_STEP_IN_SET)) { + /* + * Check if we have a special case like "foo//.", where + * "foo" is selected as well. + */ + ret = 1; + } } if (((comp->flags & XML_STREAM_DESC) == 0) && ((! match) || final)) { @@ -1855,7 +2152,7 @@ compare: */ stream->blockLevel = stream->level; } - + stream_next: stream = stream->next; } /* while stream != NULL */ @@ -1879,6 +2176,7 @@ stream_next: * to come from the dictionary. * Both @name and @ns being NULL means the / i.e. the root of the document. * This can also act as a reset. + * Otherwise the function will act as if it has been given an element-node. * * Returns: -1 in case of error, 1 if the current state in the stream is a * match and 0 otherwise. @@ -1886,7 +2184,35 @@ stream_next: int xmlStreamPush(xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns) { - return (xmlStreamPushInternal(stream, name, ns, XML_ELEMENT_NODE)); + return (xmlStreamPushInternal(stream, name, ns, (int) XML_ELEMENT_NODE)); +} + +/** + * xmlStreamPushNode: + * @stream: the stream context + * @name: the current name + * @ns: the namespace name + * @nodeType: the type of the node being pushed + * + * Push new data onto the stream. NOTE: if the call xmlPatterncompile() + * indicated a dictionary, then strings for name and ns will be expected + * to come from the dictionary. + * Both @name and @ns being NULL means the / i.e. the root of the document. + * This can also act as a reset. + * Different from xmlStreamPush() this function can be fed with nodes of type: + * element-, attribute-, text-, cdata-section-, comment- and + * processing-instruction-node. + * + * Returns: -1 in case of error, 1 if the current state in the stream is a + * match and 0 otherwise. + */ +int +xmlStreamPushNode(xmlStreamCtxtPtr stream, + const xmlChar *name, const xmlChar *ns, + int nodeType) +{ + return (xmlStreamPushInternal(stream, name, ns, + nodeType)); } /** @@ -1900,6 +2226,7 @@ xmlStreamPush(xmlStreamCtxtPtr stream, * to come from the dictionary. * Both @name and @ns being NULL means the / i.e. the root of the document. * This can also act as a reset. +* Otherwise the function will act as if it has been given an attribute-node. * * Returns: -1 in case of error, 1 if the current state in the stream is a * match and 0 otherwise. @@ -1907,7 +2234,7 @@ xmlStreamPush(xmlStreamCtxtPtr stream, int xmlStreamPushAttr(xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns) { - return (xmlStreamPushInternal(stream, name, ns, XML_ATTRIBUTE_NODE)); + return (xmlStreamPushInternal(stream, name, ns, (int) XML_ATTRIBUTE_NODE)); } /** @@ -1921,11 +2248,9 @@ xmlStreamPushAttr(xmlStreamCtxtPtr stream, int xmlStreamPop(xmlStreamCtxtPtr stream) { int i, lev; - int ret; - + if (stream == NULL) return(-1); - ret = 0; while (stream != NULL) { /* * Reset block-level. @@ -1935,7 +2260,7 @@ xmlStreamPop(xmlStreamCtxtPtr stream) { stream->level--; if (stream->level < 0) - ret = -1; + return(-1); /* * Check evolution of existing states */ @@ -1952,6 +2277,31 @@ xmlStreamPop(xmlStreamCtxtPtr stream) { return(0); } +/** + * xmlStreamWantsAnyNode: + * @streamCtxt: the stream context + * + * Query if the streaming pattern additionally needs to be fed with + * text-, cdata-section-, comment- and processing-instruction-nodes. + * If the result is 0 then only element-nodes and attribute-nodes + * need to be pushed. + * + * Returns: 1 in case of need of nodes of the above described types, + * 0 otherwise. -1 on API errors. + */ +int +xmlStreamWantsAnyNode(xmlStreamCtxtPtr streamCtxt) +{ + if (streamCtxt == NULL) + return(-1); + while (streamCtxt != NULL) { + if (streamCtxt->comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) + return(1); + streamCtxt = streamCtxt->next; + } + return(0); +} + /************************************************************************ * * * The public interfaces * @@ -2008,7 +2358,10 @@ xmlPatterncompile(const xmlChar *pattern, xmlDict *dict, int flags, cur->flags = flags; ctxt->comp = cur; - xmlCompilePathPattern(ctxt); + if (XML_STREAM_XS_IDC(cur)) + xmlCompileIDCXPathPath(ctxt); + else + xmlCompilePathPattern(ctxt); if (ctxt->error != 0) goto error; xmlFreePatParserContext(ctxt); diff --git a/python/libxml.py b/python/libxml.py index 86bdd92..0c2a19a 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -211,7 +211,8 @@ class SAXCallback: pass def warning(self, msg): - print msg + #print msg + pass def error(self, msg): raise parserError(msg) diff --git a/python/libxml2-py.c b/python/libxml2-py.c index b656d7f..b5bf52f 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -1497,15 +1497,15 @@ libxml_xmlSchemaValidateDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { int c_retval; xmlSchemaValidCtxtPtr ctxt; PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; + xmlDocPtr instance; + PyObject *pyobj_instance; - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaValidateDoc", &pyobj_ctxt, &pyobj_doc)) + if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaValidateDoc", &pyobj_ctxt, &pyobj_instance)) return(NULL); ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + instance = (xmlDocPtr) PyxmlNode_Get(pyobj_instance); - c_retval = xmlSchemaValidateDoc(ctxt, doc); + c_retval = xmlSchemaValidateDoc(ctxt, instance); py_retval = libxml_intWrap((int) c_retval); return(py_retval); } @@ -5874,6 +5874,21 @@ libxml_xmlUCSIsTibetan(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_UNICODE_ENABLED) */ +PyObject * +libxml_xmlUTF8Strndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlChar * c_retval; + xmlChar * utf; + int len; + + if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strndup", &utf, &len)) + return(NULL); + + c_retval = xmlUTF8Strndup(utf, len); + py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); + return(py_retval); +} + #if defined(LIBXML_LEGACY_ENABLED) PyObject * libxml_xmlNewGlobalNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -7689,6 +7704,28 @@ libxml_xmlReaderNewMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_READER_ENABLED) */ +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +PyObject * +libxml_xmlTextReaderSchemaValidateCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlTextReaderPtr reader; + PyObject *pyobj_reader; + xmlSchemaValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + int options; + + if (!PyArg_ParseTuple(args, (char *)"OOi:xmlTextReaderSchemaValidateCtxt", &pyobj_reader, &pyobj_ctxt, &options)) + return(NULL); + reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); + ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); + + c_retval = xmlTextReaderSchemaValidateCtxt(reader, ctxt, options); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) PyObject * libxml_xmlNewProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -7783,7 +7820,7 @@ libxml_htmlInitAutoClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBU } #endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) PyObject * libxml_xmlTextReaderReadOuterXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -7800,7 +7837,7 @@ libxml_xmlTextReaderReadOuterXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args return(py_retval); } -#endif /* defined(LIBXML_READER_ENABLED) */ +#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) */ #if defined(LIBXML_UNICODE_ENABLED) PyObject * libxml_xmlUCSIsTamil(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -10749,21 +10786,6 @@ libxml_xmlIsRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } -PyObject * -libxml_xmlUTF8Strndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * utf; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strndup", &utf, &len)) - return(NULL); - - c_retval = xmlUTF8Strndup(utf, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - #if defined(LIBXML_XPATH_ENABLED) PyObject * libxml_xmlXPathGetContextDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -12028,20 +12050,6 @@ libxml_xmlNodeSetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } -PyObject * -libxml_xmlUnlinkNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlUnlinkNode", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlUnlinkNode(cur); - Py_INCREF(Py_None); - return(Py_None); -} - #if defined(LIBXML_DEBUG_ENABLED) PyObject * libxml_xmlBoolToText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -13675,7 +13683,7 @@ libxml_xmlDictCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_ return(Py_None); } -#if defined(LIBXML_READER_ENABLED) +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) PyObject * libxml_xmlTextReaderReadInnerXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -13692,7 +13700,7 @@ libxml_xmlTextReaderReadInnerXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args return(py_retval); } -#endif /* defined(LIBXML_READER_ENABLED) */ +#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) */ PyObject * libxml_xmlThrDefKeepBlanksDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -14075,6 +14083,20 @@ libxml_xmlURISetUser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +PyObject * +libxml_xmlUnlinkNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + xmlNodePtr cur; + PyObject *pyobj_cur; + + if (!PyArg_ParseTuple(args, (char *)"O:xmlUnlinkNode", &pyobj_cur)) + return(NULL); + cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); + + xmlUnlinkNode(cur); + Py_INCREF(Py_None); + return(Py_None); +} + PyObject * libxml_xmlCreateEntityParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; diff --git a/python/setup.py b/python/setup.py index ff06a9c..a41ab3f 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.22", + version = "2.6.23", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/relaxng.c b/relaxng.c index be5ee99..7e92057 100644 --- a/relaxng.c +++ b/relaxng.c @@ -7331,7 +7331,6 @@ xmlRelaxNGCleanupDoc(xmlRelaxNGParserCtxtPtr ctxt, xmlDocPtr doc) * * parse a schema definition resource and build an internal * XML Shema struture which can be used to validate instances. - * *WARNING* this interface is highly subject to change * * Returns the internal XML RelaxNG structure built from the resource or * NULL in case of error diff --git a/result/HTML/53867.html b/result/HTML/53867.html new file mode 100644 index 0000000..acdad7c --- /dev/null +++ b/result/HTML/53867.html @@ -0,0 +1,66 @@ + + diff --git a/result/HTML/53867.html.err b/result/HTML/53867.html.err new file mode 100644 index 0000000..e69de29 diff --git a/result/HTML/53867.html.sax b/result/HTML/53867.html.sax new file mode 100644 index 0000000..81a9f15 --- /dev/null +++ b/result/HTML/53867.html.sax @@ -0,0 +1,26 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.startElement(html) +SAX.ignorableWhitespace( +, 1) +SAX.startElement(head) +SAX.ignorableWhitespace( +, 1) +SAX.startElement(style) +SAX.cdata( +....... +....................., 1000) +SAX.cdata(.............................., 1000) +SAX.cdata(.............................., 1000) +SAX.cdata(................ +............., 977) +SAX.endElement(style) +SAX.ignorableWhitespace( +, 1) +SAX.endElement(head) +SAX.ignorableWhitespace( +, 1) +SAX.endElement(html) +SAX.ignorableWhitespace( +, 1) +SAX.endDocument() diff --git a/result/XPath/tests/nodespat b/result/XPath/tests/nodespat new file mode 100644 index 0000000..1efd87f --- /dev/null +++ b/result/XPath/tests/nodespat @@ -0,0 +1,94 @@ + +======================== +Expression: /. +Object is a Node Set : +Set contains 1 nodes: +1 / + +======================== +Expression: //. +Object is a Node Set : +Set contains 12 nodes: +1 / +2 ELEMENT root +3 ELEMENT foo +4 TEXT + content=txt +5 COMMENT + content=hello +6 CDATA_SECTION + content=data +7 PI target + content=data +8 ELEMENT bar +9 TEXT + content=txt +10 COMMENT + content=hello +11 CDATA_SECTION + content=data +12 PI target + content=data + +======================== +Expression: /root//. +Object is a Node Set : +Set contains 11 nodes: +1 ELEMENT root +2 ELEMENT foo +3 TEXT + content=txt +4 COMMENT + content=hello +5 CDATA_SECTION + content=data +6 PI target + content=data +7 ELEMENT bar +8 TEXT + content=txt +9 COMMENT + content=hello +10 CDATA_SECTION + content=data +11 PI target + content=data + +======================== +Expression: //.//./././/. +Object is a Node Set : +Set contains 12 nodes: +1 / +2 ELEMENT root +3 ELEMENT foo +4 TEXT + content=txt +5 COMMENT + content=hello +6 CDATA_SECTION + content=data +7 PI target + content=data +8 ELEMENT bar +9 TEXT + content=txt +10 COMMENT + content=hello +11 CDATA_SECTION + content=data +12 PI target + content=data + +======================== +Expression: /root//././/bar//. +Object is a Node Set : +Set contains 5 nodes: +1 ELEMENT bar +2 TEXT + content=txt +3 COMMENT + content=hello +4 CDATA_SECTION + content=data +5 PI target + content=data diff --git a/result/c14n/exc-without-comments/test-2 b/result/c14n/exc-without-comments/test-2 new file mode 100644 index 0000000..0b8a0cb --- /dev/null +++ b/result/c14n/exc-without-comments/test-2 @@ -0,0 +1,11 @@ + + + + + + + + + sj1VXDB2VMCU5qmva2OtDw3kKOs= + + \ No newline at end of file diff --git a/result/noent/ns7 b/result/noent/ns7 new file mode 100644 index 0000000..b5089e1 --- /dev/null +++ b/result/noent/ns7 @@ -0,0 +1,2 @@ + + diff --git a/result/ns7 b/result/ns7 new file mode 100644 index 0000000..b5089e1 --- /dev/null +++ b/result/ns7 @@ -0,0 +1,2 @@ + + diff --git a/result/ns7.rde b/result/ns7.rde new file mode 100644 index 0000000..16f5351 --- /dev/null +++ b/result/ns7.rde @@ -0,0 +1 @@ +0 1 xml:test 1 0 diff --git a/result/ns7.rdr b/result/ns7.rdr new file mode 100644 index 0000000..16f5351 --- /dev/null +++ b/result/ns7.rdr @@ -0,0 +1 @@ +0 1 xml:test 1 0 diff --git a/result/ns7.sax b/result/ns7.sax new file mode 100644 index 0000000..6020be9 --- /dev/null +++ b/result/ns7.sax @@ -0,0 +1,5 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.startElement(xml:test) +SAX.endElement(xml:test) +SAX.endDocument() diff --git a/result/ns7.sax2 b/result/ns7.sax2 new file mode 100644 index 0000000..2a2c714 --- /dev/null +++ b/result/ns7.sax2 @@ -0,0 +1,5 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.startElementNs(test, xml, 'http://www.w3.org/XML/1998/namespace', 0, 0, 0) +SAX.endElementNs(test, xml, 'http://www.w3.org/XML/1998/namespace') +SAX.endDocument() diff --git a/result/regexp/* b/result/regexp/* deleted file mode 100644 index b730347..0000000 --- a/result/regexp/* +++ /dev/null @@ -1 +0,0 @@ -Ops: 0 nodes, 0 cons diff --git a/result/regexp/hard b/result/regexp/hard index f348c08..28d6164 100644 --- a/result/regexp/hard +++ b/result/regexp/hard @@ -5,3 +5,8 @@ aaabbbb: Ok a0b: Ok aa0aaa: Fail b0aaa: Ok +Regexp: (\d{1,3}\.){3}\d{1,3} +1.2.3.4: Ok +1.22.333.44: Ok +1.2.3: Fail +1..2.3: Fail diff --git a/result/schemas/bug303566_1_1.err b/result/schemas/bug303566_1_1.err index 43515ea..9156981 100644 --- a/result/schemas/bug303566_1_1.err +++ b/result/schemas/bug303566_1_1.err @@ -1 +1 @@ -./test/schemas/bug303566_1.xml:9: Schemas validity error : Element 'Part': No match found for key-sequence ['B'] of key reference 'PartRefCountryDummy'. +./test/schemas/bug303566_1.xml:9: Schemas validity error : Element 'Part': No match found for key-sequence ['B'] of keyref 'PartRefCountryDummy'. diff --git a/result/schemas/bug312957_1_0.err b/result/schemas/bug312957_1_0.err index 5ab33fb..5ea089b 100644 --- a/result/schemas/bug312957_1_0.err +++ b/result/schemas/bug312957_1_0.err @@ -1 +1 @@ -./test/schemas/bug312957_0.xml:11: Schemas validity error : Element 'sister': No match found for key-sequence ['annie'] of key reference 'sibling_key_ref'. +./test/schemas/bug312957_0.xml:11: Schemas validity error : Element 'sister': No match found for key-sequence ['annie'] of keyref 'sibling_key_ref'. diff --git a/result/schemas/bug321475_1_0 b/result/schemas/bug321475_1_0 new file mode 100644 index 0000000..f943041 --- /dev/null +++ b/result/schemas/bug321475_1_0 @@ -0,0 +1 @@ +./test/schemas/bug321475_0.xml validates diff --git a/result/schemas/bug321475_1_0.err b/result/schemas/bug321475_1_0.err new file mode 100644 index 0000000..e69de29 diff --git a/result/schemas/bug322411_1_0 b/result/schemas/bug322411_1_0 new file mode 100644 index 0000000..79560fb --- /dev/null +++ b/result/schemas/bug322411_1_0 @@ -0,0 +1 @@ +./test/schemas/bug322411_0.xml validates diff --git a/result/schemas/bug322411_1_0.err b/result/schemas/bug322411_1_0.err new file mode 100644 index 0000000..e69de29 diff --git a/result/schemas/bug323510_1_0 b/result/schemas/bug323510_1_0 new file mode 100644 index 0000000..c33d685 --- /dev/null +++ b/result/schemas/bug323510_1_0 @@ -0,0 +1 @@ +./test/schemas/bug323510_0.xml fails to validate diff --git a/result/schemas/bug323510_1_0.err b/result/schemas/bug323510_1_0.err new file mode 100644 index 0000000..1655070 --- /dev/null +++ b/result/schemas/bug323510_1_0.err @@ -0,0 +1 @@ +./test/schemas/bug323510_0.xml:2: element foo: Schemas validity error : Element 'foo': Missing child element(s). Expected is ( bar ). diff --git a/result/schemas/decimal-1_1_0 b/result/schemas/decimal-1_1_0 new file mode 100644 index 0000000..041b31d --- /dev/null +++ b/result/schemas/decimal-1_1_0 @@ -0,0 +1 @@ +./test/schemas/decimal-1_0.xml fails to validate diff --git a/result/schemas/decimal-1_1_0.err b/result/schemas/decimal-1_1_0.err new file mode 100644 index 0000000..7f4fa9c --- /dev/null +++ b/result/schemas/decimal-1_1_0.err @@ -0,0 +1,8 @@ +./test/schemas/decimal-1_0.xml:16: element val: Schemas validity error : Element 'val': '.' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:17: element val: Schemas validity error : Element 'val': '-' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:18: element val: Schemas validity error : Element 'val': '+' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:19: element val: Schemas validity error : Element 'val': '*' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:20: element val: Schemas validity error : Element 'val': '- 1' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:21: element val: Schemas validity error : Element 'val': '+ 1' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:22: element val: Schemas validity error : Element 'val': '+ 0' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-1_0.xml:23: element val: Schemas validity error : Element 'val': '- 0' is not a valid value of the atomic type 'myDecimal'. diff --git a/result/schemas/decimal-2_1_0 b/result/schemas/decimal-2_1_0 new file mode 100644 index 0000000..f68ca92 --- /dev/null +++ b/result/schemas/decimal-2_1_0 @@ -0,0 +1 @@ +./test/schemas/decimal-2_0.xml fails to validate diff --git a/result/schemas/decimal-2_1_0.err b/result/schemas/decimal-2_1_0.err new file mode 100644 index 0000000..fe663c2 --- /dev/null +++ b/result/schemas/decimal-2_1_0.err @@ -0,0 +1,4 @@ +./test/schemas/decimal-2_0.xml:12: element val: Schemas validity error : Element 'val': [facet 'minInclusive'] The value '-0.1' is less than the minimum value allowed ('0'). +./test/schemas/decimal-2_0.xml:12: element val: Schemas validity error : Element 'val': '-0.1' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-2_0.xml:13: element val: Schemas validity error : Element 'val': [facet 'minInclusive'] The value '-1' is less than the minimum value allowed ('0'). +./test/schemas/decimal-2_0.xml:13: element val: Schemas validity error : Element 'val': '-1' is not a valid value of the atomic type 'myDecimal'. diff --git a/result/schemas/decimal-3_1_0 b/result/schemas/decimal-3_1_0 new file mode 100644 index 0000000..5601535 --- /dev/null +++ b/result/schemas/decimal-3_1_0 @@ -0,0 +1 @@ +./test/schemas/decimal-3_0.xml fails to validate diff --git a/result/schemas/decimal-3_1_0.err b/result/schemas/decimal-3_1_0.err new file mode 100644 index 0000000..bba8cf9 --- /dev/null +++ b/result/schemas/decimal-3_1_0.err @@ -0,0 +1,8 @@ +./test/schemas/decimal-3_0.xml:12: element val: Schemas validity error : Element 'val': [facet 'totalDigits'] The value '0.123' has more digits than are allowed ('2'). +./test/schemas/decimal-3_0.xml:12: element val: Schemas validity error : Element 'val': '0.123' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-3_0.xml:13: element val: Schemas validity error : Element 'val': [facet 'totalDigits'] The value '0.023' has more digits than are allowed ('2'). +./test/schemas/decimal-3_0.xml:13: element val: Schemas validity error : Element 'val': '0.023' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-3_0.xml:14: element val: Schemas validity error : Element 'val': [facet 'totalDigits'] The value '123' has more digits than are allowed ('2'). +./test/schemas/decimal-3_0.xml:14: element val: Schemas validity error : Element 'val': '123' is not a valid value of the atomic type 'myDecimal'. +./test/schemas/decimal-3_0.xml:15: element val: Schemas validity error : Element 'val': [facet 'totalDigits'] The value '12.3' has more digits than are allowed ('2'). +./test/schemas/decimal-3_0.xml:15: element val: Schemas validity error : Element 'val': '12.3' is not a valid value of the atomic type 'myDecimal'. diff --git a/result/schemas/derivation-ok-extension-err_0_0.err b/result/schemas/derivation-ok-extension-err_0_0.err index 164c1f3..a0fba52 100644 --- a/result/schemas/derivation-ok-extension-err_0_0.err +++ b/result/schemas/derivation-ok-extension-err_0_0.err @@ -1 +1 @@ -./test/schemas/derivation-ok-extension-err_0.xsd:9: element attribute: Schemas parser error : local complex type, attribute decl. 'barA_1': Duplicate attribute use specified. +./test/schemas/derivation-ok-extension-err_0.xsd:6: element complexType: Schemas parser error : local complex type: Duplicate attribute use 'barA_1'. diff --git a/result/schemas/derivation-ok-extension_0_0.err b/result/schemas/derivation-ok-extension_0_0.err index e07739e..1314232 100644 --- a/result/schemas/derivation-ok-extension_0_0.err +++ b/result/schemas/derivation-ok-extension_0_0.err @@ -1 +1 @@ -./test/schemas/derivation-ok-extension_0.xsd:10: element attribute: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}attribute': Attribute use prohibitions are pointless when extending a type. +./test/schemas/derivation-ok-extension_0.xsd:10: element attribute: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}attribute': Skipping attribute use prohibition, since it is pointless when extending a type. diff --git a/result/schemas/derivation-ok-restriction-2-1-1_0_0.err b/result/schemas/derivation-ok-restriction-2-1-1_0_0.err index 49977e4..bd38dd2 100644 --- a/result/schemas/derivation-ok-restriction-2-1-1_0_0.err +++ b/result/schemas/derivation-ok-restriction-2-1-1_0_0.err @@ -1,6 +1,6 @@ -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type: A matching attribute use for the 'required' attribute use 'barB_3' of the base type is missing. -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:16: element attribute: Schemas parser error : local complex type, attribute decl. 'barB_1': The 'optional' use is inconsistent with a matching 'required' use of the base type. -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:23: element attribute: Schemas parser error : local complex type, attribute decl. 'barC_1': Neither a matching attribute use, nor a matching wildcard in the base type does exist. -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:25: element attribute: Schemas parser error : local complex type, attribute decl. 'barC_2': Neither a matching attribute use, nor a matching wildcard in the base type does exist. -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:30: element attribute: Schemas parser error : local complex type, attribute decl. 'barD_1': Neither a matching attribute use, nor a matching wildcard in the base type does exist. -./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:32: element attribute: Schemas parser error : local complex type, attribute decl. 'barD_2': Neither a matching attribute use, nor a matching wildcard in the base type does exist. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type, attribute use 'barB_1': The 'optional' attribute use is inconsistent with the corresponding 'required' attribute use of the base complex type definition '{http://FOO}typeA'. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type, attribute use 'barC_1': Neither a matching attribute use, nor a matching wildcard exists in the base complex type definition '{http://FOO}typeA'. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type, attribute use 'barC_2': Neither a matching attribute use, nor a matching wildcard exists in the base complex type definition '{http://FOO}typeA'. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type, attribute use 'barD_1': Neither a matching attribute use, nor a matching wildcard exists in the base complex type definition '{http://FOO}typeA'. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type, attribute use 'barD_2': Neither a matching attribute use, nor a matching wildcard exists in the base complex type definition '{http://FOO}typeA'. +./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type: A matching attribute use for the 'required' attribute use 'barB_3' of the base complex type definition '{http://FOO}typeA' is missing. diff --git a/result/schemas/derivation-ok-restriction-4-1-err_0_0.err b/result/schemas/derivation-ok-restriction-4-1-err_0_0.err index 8cacb07..72283fb 100644 --- a/result/schemas/derivation-ok-restriction-4-1-err_0_0.err +++ b/result/schemas/derivation-ok-restriction-4-1-err_0_0.err @@ -1,3 +1,3 @@ -./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:33: element complexType: Schemas parser error : complex type 'type.A': The type has an attribute wildcard, but the base type complex type 'base.type.A' does not have one. -./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:45: element complexType: Schemas parser error : complex type 'type.B': The attribute wildcard is not a valid subset of the wildcard in the base type complex type 'base.type.B'. -./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:57: element complexType: Schemas parser error : complex type 'type.C': The 'process contents' of the attribute wildcard is weaker than the one in the base type complex type 'base.type.C'. +./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:33: element complexType: Schemas parser error : complex type 'type.A': The complex type definition has an attribute wildcard, but the base complex type definition '{http://FOO}base.type.A' does not have one. +./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:45: element complexType: Schemas parser error : complex type 'type.B': The attribute wildcard is not a valid subset of the wildcard in the base complex type definition '{http://FOO}base.type.B'. +./test/schemas/derivation-ok-restriction-4-1-err_0.xsd:65: element complexType: Schemas parser error : complex type 'base.type.C': The {process contents} of the attribute wildcard is weaker than the one in the base complex type definition '{http://FOO}base.type.C'. diff --git a/result/schemas/element-err_0_0.err b/result/schemas/element-err_0_0.err index 575102c..70524f6 100644 --- a/result/schemas/element-err_0_0.err +++ b/result/schemas/element-err_0_0.err @@ -1,20 +1,20 @@ ./test/schemas/element-err_0.xsd:8: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'name' is required but missing. -./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : element decl. '{http://FOO}foo': The attribute 'ref' is not allowed. -./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : element decl. '{http://FOO}foo': The attribute 'minOccurs' is not allowed. -./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : element decl. '{http://FOO}foo': The attribute 'maxOccurs' is not allowed. -./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : element decl. '{http://FOO}foo': The attribute 'form' is not allowed. +./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'ref' is not allowed. +./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'minOccurs' is not allowed. +./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'maxOccurs' is not allowed. +./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'form' is not allowed. ./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'final': The value 'fantasy' is not valid. Expected is '(#all | List of (extension | restriction))'. ./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'block': The value 'flute' is not valid. Expected is '(#all | List of (extension | restriction | substitution))'. -./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : element decl. '{http://FOO}foo': The attributes 'default' and 'fixed' are mutually exclusive. +./test/schemas/element-err_0.xsd:14: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attributes 'default' and 'fixed' are mutually exclusive. ./test/schemas/element-err_0.xsd:22: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'minOccurs': The value must not be greater than the value of 'maxOccurs'. ./test/schemas/element-err_0.xsd:22: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attributes 'ref' and 'name' are mutually exclusive. ./test/schemas/element-err_0.xsd:22: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'abstract': Only the attributes 'minOccurs', 'maxOccurs' and 'id' are allowed in addition to 'ref'. ./test/schemas/element-err_0.xsd:23: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The content is not valid. Expected is (annotation?). ./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'maxOccurs': The value must be greater than or equal to 1. -./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : element decl. '{http://FOO}myomy': The attribute 'abstract' is not allowed. -./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : element decl. '{http://FOO}myomy': The attribute 'substitutionGroup' is not allowed. -./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : element decl. '{http://FOO}myomy': The attribute 'final' is not allowed. +./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'abstract' is not allowed. +./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'substitutionGroup' is not allowed. +./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'final' is not allowed. ./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'block': The value 'flute' is not valid. Expected is '(#all | List of (extension | restriction | substitution))'. -./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : element decl. '{http://FOO}myomy': The attributes 'default' and 'fixed' are mutually exclusive. -./test/schemas/element-err_0.xsd:31: element complexType: Schemas parser error : element decl. '{http://FOO}myomy': The attribute 'type' and the child are mutually exclusive. -./test/schemas/element-err_0.xsd:32: element simpleType: Schemas parser error : element decl. '{http://FOO}myomy': The content is not valid. Expected is (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)). +./test/schemas/element-err_0.xsd:30: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attributes 'default' and 'fixed' are mutually exclusive. +./test/schemas/element-err_0.xsd:31: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'type' and the child are mutually exclusive. +./test/schemas/element-err_0.xsd:32: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The content is not valid. Expected is (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)). diff --git a/result/schemas/idc-keyref-err1_1_0 b/result/schemas/idc-keyref-err1_1_0 new file mode 100644 index 0000000..d4333a9 --- /dev/null +++ b/result/schemas/idc-keyref-err1_1_0 @@ -0,0 +1 @@ +./test/schemas/idc-keyref-err1_0.xml fails to validate diff --git a/result/schemas/idc-keyref-err1_1_0.err b/result/schemas/idc-keyref-err1_1_0.err new file mode 100644 index 0000000..8e9cb20 --- /dev/null +++ b/result/schemas/idc-keyref-err1_1_0.err @@ -0,0 +1 @@ +./test/schemas/idc-keyref-err1_0.xml:12: Schemas validity error : Element '{urn:test:foo}Ref': No match found for key-sequence ['L4'] of keyref '{urn:test:foo}LinkKeyRef'. diff --git a/result/schemas/include3_0_0.err b/result/schemas/include3_0_0.err index 59d7d1d..27bb5d0 100644 --- a/result/schemas/include3_0_0.err +++ b/result/schemas/include3_0_0.err @@ -1 +1 @@ -./test/schemas/include3_0.xsd:7: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': A global element declaration with the name 'bar' does already exist. +test/schemas/include3_0.inc:4: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': A global element declaration '{http://FOO}bar' does already exist. diff --git a/result/schemas/restriction-attr1_0_0.err b/result/schemas/restriction-attr1_0_0.err index c08d41d..cdf003d 100644 --- a/result/schemas/restriction-attr1_0_0.err +++ b/result/schemas/restriction-attr1_0_0.err @@ -1 +1 @@ -./test/schemas/restriction-attr1_0.xsd:8: element attribute: Schemas parser error : local complex type, attribute decl. 'barA': The 'optional' use is inconsistent with a matching 'required' use of the base type. +./test/schemas/restriction-attr1_0.xsd:5: element complexType: Schemas parser error : local complex type, attribute use 'barA': The 'optional' attribute use is inconsistent with the corresponding 'required' attribute use of the base complex type definition '{http://FOO}typeA'. diff --git a/result/schemas/scc-no-xmlns_0_0.err b/result/schemas/scc-no-xmlns_0_0.err index fe882be..aad2b68 100644 --- a/result/schemas/scc-no-xmlns_0_0.err +++ b/result/schemas/scc-no-xmlns_0_0.err @@ -1 +1 @@ -./test/schemas/scc-no-xmlns_0.xsd:7: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute', attribute 'name': The value of type 'xs:NCName' must not match 'xmlns'. +./test/schemas/scc-no-xmlns_0.xsd:7: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute', attribute 'name': The value of the attribute must not match 'xmlns'. diff --git a/result/schemas/scc-no-xsi_0_0.err b/result/schemas/scc-no-xsi_0_0.err index a57132c..e04e3e4 100644 --- a/result/schemas/scc-no-xsi_0_0.err +++ b/result/schemas/scc-no-xsi_0_0.err @@ -1 +1 @@ -./test/schemas/scc-no-xsi_0.xsd:7: element attribute: Schemas parser error : attribute decl. '{http://www.w3.org/2001/XMLSchema-instance}bar': The target namespace must not match 'http://www.w3.org/2001/XMLSchema-instance'. +./test/schemas/scc-no-xsi_0.xsd:7: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The target namespace must not match 'http://www.w3.org/2001/XMLSchema-instance'. diff --git a/result/schemas/src-attribute1_0_0.err b/result/schemas/src-attribute1_0_0.err index ceafdbe..368d97c 100644 --- a/result/schemas/src-attribute1_0_0.err +++ b/result/schemas/src-attribute1_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute1_0.xsd:9: element attribute: Schemas parser error : attribute decl. 'bar': The attributes 'default' and 'fixed' are mutually exclusive. +./test/schemas/src-attribute1_0.xsd:9: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The attributes 'default' and 'fixed' are mutually exclusive. diff --git a/result/schemas/src-attribute2_0_0.err b/result/schemas/src-attribute2_0_0.err index 7206544..ac6df6f 100644 --- a/result/schemas/src-attribute2_0_0.err +++ b/result/schemas/src-attribute2_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute2_0.xsd:9: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute', attribute 'use': The value must be 'optional' if the attribute 'default' is present as well. +./test/schemas/src-attribute2_0.xsd:9: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The value of the attribute 'use' must be 'optional' if the attribute 'default' is present. diff --git a/result/schemas/src-attribute3-1_0_0.err b/result/schemas/src-attribute3-1_0_0.err index 6cf4404..3345b3c 100644 --- a/result/schemas/src-attribute3-1_0_0.err +++ b/result/schemas/src-attribute3-1_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute3-1_0.xsd:9: element attribute: Schemas parser error : attribute use '{http://foo}bar': The attributes 'ref' and 'name' are mutually exclusive. +./test/schemas/src-attribute3-1_0.xsd:9: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'name' is not allowed. diff --git a/result/schemas/src-attribute3-2-form_0_0.err b/result/schemas/src-attribute3-2-form_0_0.err index 5b3c7db..ad3667b 100644 --- a/result/schemas/src-attribute3-2-form_0_0.err +++ b/result/schemas/src-attribute3-2-form_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute3-2-form_0.xsd:10: element attribute: Schemas parser error : attribute use '{http://foo}bar': The attribute 'form' is not allowed. +./test/schemas/src-attribute3-2-form_0.xsd:10: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'form' is not allowed. diff --git a/result/schemas/src-attribute3-2-st_0_0.err b/result/schemas/src-attribute3-2-st_0_0.err index 797b8c1..ae85e0a 100644 --- a/result/schemas/src-attribute3-2-st_0_0.err +++ b/result/schemas/src-attribute3-2-st_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute3-2-st_0.xsd:11: element simpleType: Schemas parser error : attribute use '{http://foo}bar': The content is not valid. Expected is (annotation?). +./test/schemas/src-attribute3-2-st_0.xsd:11: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The content is not valid. Expected is (annotation?). diff --git a/result/schemas/src-attribute3-2-type_0_0.err b/result/schemas/src-attribute3-2-type_0_0.err index 3a43d47..50016d8 100644 --- a/result/schemas/src-attribute3-2-type_0_0.err +++ b/result/schemas/src-attribute3-2-type_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute3-2-type_0.xsd:10: element attribute: Schemas parser error : attribute use '{http://foo}bar': The attribute 'type' is not allowed. +./test/schemas/src-attribute3-2-type_0.xsd:10: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'type' is not allowed. diff --git a/result/schemas/src-attribute4_0_0.err b/result/schemas/src-attribute4_0_0.err index a401799..cac6718 100644 --- a/result/schemas/src-attribute4_0_0.err +++ b/result/schemas/src-attribute4_0_0.err @@ -1 +1 @@ -./test/schemas/src-attribute4_0.xsd:8: element simpleType: Schemas parser error : attribute decl. '{http://foo}bar': The attribute 'type' and the child are mutually exclusive. +./test/schemas/src-attribute4_0.xsd:8: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The attribute 'type' and the child are mutually exclusive. diff --git a/result/schemas/src-element1_0_0.err b/result/schemas/src-element1_0_0.err index ab39e7a..9d8b198 100644 --- a/result/schemas/src-element1_0_0.err +++ b/result/schemas/src-element1_0_0.err @@ -1 +1 @@ -./test/schemas/src-element1_0.xsd:7: element element: Schemas parser error : element decl. '{http://foo}foo': The attributes 'default' and 'fixed' are mutually exclusive. +./test/schemas/src-element1_0.xsd:7: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attributes 'default' and 'fixed' are mutually exclusive. diff --git a/result/schemas/src-element3_0_0.err b/result/schemas/src-element3_0_0.err index fc60d9d..b8bd817 100644 --- a/result/schemas/src-element3_0_0.err +++ b/result/schemas/src-element3_0_0.err @@ -1,2 +1,2 @@ -./test/schemas/src-element3_0.xsd:8: element complexType: Schemas parser error : element decl. '{http://foo}foo': The attribute 'type' and the child are mutually exclusive. -./test/schemas/src-element3_0.xsd:16: element simpleType: Schemas parser error : element decl. '{http://foo}bar': The attribute 'type' and the child are mutually exclusive. +./test/schemas/src-element3_0.xsd:8: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'type' and the child are mutually exclusive. +./test/schemas/src-element3_0.xsd:16: element simpleType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'type' and the child are mutually exclusive. diff --git a/runsuite.c b/runsuite.c index aecd6ae..4e9858a 100644 --- a/runsuite.c +++ b/runsuite.c @@ -6,11 +6,16 @@ * daniel@veillard.com */ +#ifdef HAVE_CONFIG_H +#include "libxml.h" +#else +#include +#endif + #if !defined(_WIN32) || defined(__CYGWIN__) #include #endif #include -#include #include #include #include @@ -31,11 +36,16 @@ #define LOGFILE "runsuite.log" static FILE *logfile = NULL; -static int verbose = 0; - -#if defined(_WIN32) && !defined(__CYGWIN__) -#define vsnprintf _vsnprintf -#define snprintf _snprintf +static int verbose = 0; + + + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#define vsnprintf _vsnprintf + +#define snprintf _snprintf + #endif /************************************************************************ @@ -83,7 +93,6 @@ static int nb_internals = 0; static int nb_schematas = 0; static int nb_unimplemented = 0; static int nb_leaks = 0; -static long libxmlMemoryAllocatedBase = 0; static int extraMemoryFromResolver = 0; static int @@ -225,7 +234,6 @@ initializeLibxml2(void) { xmlSchemaInitTypes(); xmlRelaxNGInitTypes(); #endif - libxmlMemoryAllocatedBase = xmlMemUsed(); } static xmlNodePtr @@ -931,9 +939,17 @@ xstcTestGroup(xmlNodePtr cur, const char *base) { } instance = getNext(cur, "./ts:instanceTest[1]"); while (instance != NULL) { - xstcTestInstance(instance, schemas, path, base); + if (schemas != NULL) { + xstcTestInstance(instance, schemas, path, base); + } else { + /* + * We'll automatically mark the instances as failed + * if the schema was broken. + */ + nb_errors++; + } instance = getNext(instance, - "following-sibling::ts:instanceTest[1]"); + "following-sibling::ts:instanceTest[1]"); } } else if (xmlStrEqual(validity, BAD_CAST "invalid")) { nb_schematas++; @@ -1033,7 +1049,7 @@ done: int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int res, ret = 0; + int ret = 0; int old_errors, old_tests, old_leaks; logfile = fopen(LOGFILE, "w"); @@ -1051,7 +1067,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_errors = nb_errors; old_tests = nb_tests; old_leaks = nb_leaks; - res = xsdTest(); + xsdTest(); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests, no errors\n", nb_tests - old_tests); else @@ -1062,7 +1078,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_errors = nb_errors; old_tests = nb_tests; old_leaks = nb_leaks; - res = rngTest1(); + rngTest1(); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests, no errors\n", nb_tests - old_tests); else @@ -1073,7 +1089,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_errors = nb_errors; old_tests = nb_tests; old_leaks = nb_leaks; - res = rngTest2(); + rngTest2(); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests, no errors\n", nb_tests - old_tests); else @@ -1086,8 +1102,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_leaks = nb_leaks; nb_internals = 0; nb_schematas = 0; - res = xstcMetadata( - "xstc/Tests/Metadata/NISTXMLSchemaDatatypes.testSet", + xstcMetadata("xstc/Tests/Metadata/NISTXMLSchemaDatatypes.testSet", "xstc/Tests/Metadata/"); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests (%d schemata), no errors\n", @@ -1104,8 +1119,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_leaks = nb_leaks; nb_internals = 0; nb_schematas = 0; - res = xstcMetadata( - "xstc/Tests/Metadata/SunXMLSchema1-0-20020116.testSet", + xstcMetadata("xstc/Tests/Metadata/SunXMLSchema1-0-20020116.testSet", "xstc/Tests/"); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests (%d schemata), no errors\n", @@ -1122,8 +1136,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { old_leaks = nb_leaks; nb_internals = 0; nb_schematas = 0; - res = xstcMetadata( - "xstc/Tests/Metadata/MSXMLSchema1-0-20020116.testSet", + xstcMetadata("xstc/Tests/Metadata/MSXMLSchema1-0-20020116.testSet", "xstc/Tests/"); if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf("Ran %d tests (%d schemata), no errors\n", diff --git a/runtest.c b/runtest.c index 897cb9b..02fc159 100644 --- a/runtest.c +++ b/runtest.c @@ -11,11 +11,16 @@ * daniel@veillard.com */ +#ifdef HAVE_CONFIG_H +#include "libxml.h" +#else +#include +#endif + #if !defined(_WIN32) || defined(__CYGWIN__) #include #endif #include -#include #include #include #include @@ -204,7 +209,6 @@ static void globfree(glob_t *pglob) { static int nb_tests = 0; static int nb_errors = 0; static int nb_leaks = 0; -static long libxmlMemoryAllocatedBase = 0; static int extraMemoryFromResolver = 0; static int @@ -536,7 +540,6 @@ initializeLibxml2(void) { xmlSchemaInitTypes(); xmlRelaxNGInitTypes(); #endif - libxmlMemoryAllocatedBase = xmlMemUsed(); } @@ -2926,14 +2929,15 @@ schemasOneTest(const char *sch, unlink(temp); free(temp); - if (err != NULL) { + if ((ret != 0) && (err != NULL)) { if (compareFileMem(err, testErrors, testErrorsSize)) { fprintf(stderr, "Error for %s on %s failed\n", filename, sch); ret = 1; + } else { + ret = 0; } } - xmlSchemaFreeValidCtxt(ctxt); xmlFreeDoc(doc); return(ret); @@ -3029,8 +3033,8 @@ schemasTest(const char *filename, nb_tests++; ret = schemasOneTest(filename, instance, result, err, options, schemas); - if (res != 0) - ret = res; + if (ret != 0) + res = ret; } } globfree(&globbuf); diff --git a/schematron.c b/schematron.c index 9cb5027..98184ac 100644 --- a/schematron.c +++ b/schematron.c @@ -562,7 +562,7 @@ xmlSchematronFree(xmlSchematronPtr schema) xmlFreeDoc(schema->doc); if (schema->namespaces != NULL) - xmlFree(schema->namespaces); + xmlFree((char **) schema->namespaces); xmlSchematronFreeRules(schema->rules); xmlSchematronFreePatterns(schema->patterns); @@ -709,7 +709,7 @@ xmlSchematronFreeParserCtxt(xmlSchematronParserCtxtPtr ctxt) xmlXPathFreeContext(ctxt->xctxt); } if (ctxt->namespaces != NULL) - xmlFree(ctxt->namespaces); + xmlFree((char **) ctxt->namespaces); xmlDictFree(ctxt->dict); xmlFree(ctxt); } @@ -809,7 +809,7 @@ xmlSchematronAddNamespace(xmlSchematronParserCtxtPtr ctxt, const xmlChar **tmp; tmp = (const xmlChar **) - xmlRealloc(ctxt->namespaces, ctxt->maxNamespaces * 4 * + xmlRealloc((xmlChar **) ctxt->namespaces, ctxt->maxNamespaces * 4 * sizeof(const xmlChar *)); if (tmp == NULL) { xmlSchematronPErrMemory(NULL, "allocating parser namespaces", diff --git a/test/HTML/53867.html b/test/HTML/53867.html new file mode 100644 index 0000000..ac27999 --- /dev/null +++ b/test/HTML/53867.html @@ -0,0 +1,69 @@ + + + + + diff --git a/test/XPath/docs/nodes b/test/XPath/docs/nodes new file mode 100644 index 0000000..a863df0 --- /dev/null +++ b/test/XPath/docs/nodes @@ -0,0 +1,2 @@ + +txttxt \ No newline at end of file diff --git a/test/XPath/tests/nodespat b/test/XPath/tests/nodespat new file mode 100644 index 0000000..c157a3e --- /dev/null +++ b/test/XPath/tests/nodespat @@ -0,0 +1,5 @@ +/. +//. +/root//. +//.//./././/. +/root//././/bar//. \ No newline at end of file diff --git a/test/c14n/exc-without-comments/test-2.xml b/test/c14n/exc-without-comments/test-2.xml new file mode 100644 index 0000000..83d15a7 --- /dev/null +++ b/test/c14n/exc-without-comments/test-2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + sj1VXDB2VMCU5qmva2OtDw3kKOs= + + + ... + + + ... + + + diff --git a/test/c14n/exc-without-comments/test-2.xpath b/test/c14n/exc-without-comments/test-2.xpath new file mode 100644 index 0000000..e57652f --- /dev/null +++ b/test/c14n/exc-without-comments/test-2.xpath @@ -0,0 +1,6 @@ + +(//. | //@* | //namespace::*) +[ + ancestor-or-self::ds:SignedInfo +] + \ No newline at end of file diff --git a/test/ns7 b/test/ns7 new file mode 100644 index 0000000..d32b3b4 --- /dev/null +++ b/test/ns7 @@ -0,0 +1 @@ + diff --git a/test/regexp/hard b/test/regexp/hard index 40c6d2d..ddb4cfd 100644 --- a/test/regexp/hard +++ b/test/regexp/hard @@ -5,3 +5,8 @@ aaabbbb a0b aa0aaa b0aaa +=>(\d{1,3}\.){3}\d{1,3} +1.2.3.4 +1.22.333.44 +1.2.3 +1..2.3 diff --git a/test/schemas/bug321475_0.xml b/test/schemas/bug321475_0.xml new file mode 100644 index 0000000..6190231 --- /dev/null +++ b/test/schemas/bug321475_0.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/schemas/bug321475_1.xsd b/test/schemas/bug321475_1.xsd new file mode 100644 index 0000000..b714a0d --- /dev/null +++ b/test/schemas/bug321475_1.xsd @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/schemas/bug322411_0.xml b/test/schemas/bug322411_0.xml new file mode 100644 index 0000000..f883648 --- /dev/null +++ b/test/schemas/bug322411_0.xml @@ -0,0 +1,93 @@ + + + + + 1 + 2 + 3 + 4 + 5 + + dupl1 + dupl2 + dupl3 + dupl4 + dupl5 + dupl6 + dupl7 + dupl8 + dupl9 + dupl10 + dupl11 + + 6 + 7 + 8 + 9 + 10 + 11 + + 12 + 13 + 14 + 15 + + dupl1 + dupl2 + dupl3 + dupl4 + dupl5 + dupl6 + dupl7 + dupl8 + dupl9 + dupl10 + dupl11 + + 16 + 17 + 18 + 19 + 20 + 21 + + + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + + dupl1 + dupl2 + dupl3 + dupl4 + dupl5 + dupl6 + dupl7 + dupl8 + dupl9 + dupl10 + dupl11 + + + + 41 + + + diff --git a/test/schemas/bug322411_1.xsd b/test/schemas/bug322411_1.xsd new file mode 100644 index 0000000..383dee6 --- /dev/null +++ b/test/schemas/bug322411_1.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/schemas/bug323510_0.xml b/test/schemas/bug323510_0.xml new file mode 100644 index 0000000..ce7647d --- /dev/null +++ b/test/schemas/bug323510_0.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schemas/bug323510_1.xsd b/test/schemas/bug323510_1.xsd new file mode 100644 index 0000000..8b047ce --- /dev/null +++ b/test/schemas/bug323510_1.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/schemas/decimal-1.xml b/test/schemas/decimal-1.xml new file mode 100644 index 0000000..4568ff1 --- /dev/null +++ b/test/schemas/decimal-1.xml @@ -0,0 +1,37 @@ + + + + + 0. + .0 + .10 + 01. + 000 + 123456789012345678 + -123456789012345678 + 0.123456789012345678 + -0.123456789012345678 + + . + - + + + * + - 1 + + 1 + + 0 + - 0 + + diff --git a/test/schemas/decimal-1.xsd b/test/schemas/decimal-1.xsd new file mode 100644 index 0000000..830ca3e --- /dev/null +++ b/test/schemas/decimal-1.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/test/schemas/decimal-1_0.xml b/test/schemas/decimal-1_0.xml new file mode 100644 index 0000000..7bf3719 --- /dev/null +++ b/test/schemas/decimal-1_0.xml @@ -0,0 +1,24 @@ + + + + 0. + .0 + .10 + 01. + 000 + 123456789012345678 + -123456789012345678 + 0.123456789012345678 + -0.123456789012345678 + + . + - + + + * + - 1 + + 1 + + 0 + - 0 + diff --git a/test/schemas/decimal-1_1.xsd b/test/schemas/decimal-1_1.xsd new file mode 100644 index 0000000..f598c86 --- /dev/null +++ b/test/schemas/decimal-1_1.xsd @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/schemas/decimal-2_0.xml b/test/schemas/decimal-2_0.xml new file mode 100644 index 0000000..166f781 --- /dev/null +++ b/test/schemas/decimal-2_0.xml @@ -0,0 +1,14 @@ + + + + 0.1 + 0.001 + 0.0 + -0.0 + 1 + + -0.1 + -1 + diff --git a/test/schemas/decimal-2_1.xsd b/test/schemas/decimal-2_1.xsd new file mode 100644 index 0000000..cc71670 --- /dev/null +++ b/test/schemas/decimal-2_1.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/test/schemas/decimal-3_0.xml b/test/schemas/decimal-3_0.xml new file mode 100644 index 0000000..fec1ed3 --- /dev/null +++ b/test/schemas/decimal-3_0.xml @@ -0,0 +1,17 @@ + + + + 0.12 + 0.0 + 0.02 + 12 + 1.2 + + 0.123 + 0.023 + 123 + 12.3 + + diff --git a/test/schemas/decimal-3_1.xsd b/test/schemas/decimal-3_1.xsd new file mode 100644 index 0000000..23ae8f7 --- /dev/null +++ b/test/schemas/decimal-3_1.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/test/schemas/idc-keyref-err1_0.xml b/test/schemas/idc-keyref-err1_0.xml new file mode 100644 index 0000000..64a1d0b --- /dev/null +++ b/test/schemas/idc-keyref-err1_0.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/test/schemas/idc-keyref-err1_1.xsd b/test/schemas/idc-keyref-err1_1.xsd new file mode 100644 index 0000000..43c769f --- /dev/null +++ b/test/schemas/idc-keyref-err1_1.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testapi.c b/testapi.c index fe2d4c8..298a3f1 100644 --- a/testapi.c +++ b/testapi.c @@ -8,7 +8,12 @@ * daniel@veillard.com */ +#ifdef HAVE_CONFIG_H +#include "libxml.h" +#else #include +#endif + #include #include #include @@ -278,7 +283,7 @@ static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return('a'); if (no == 1) return(' '); - if (no == 2) return('ø'); + if (no == 2) return((xmlChar) 'ø'); return(0); } @@ -291,7 +296,7 @@ static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); - return(-1); + return((unsigned int) -1); } static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -303,7 +308,7 @@ static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); - return(-1); + return((unsigned long) -1); } static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -689,6 +694,24 @@ static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) + +#define gen_nb_xmlExpCtxtPtr 1 +static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlExpNodePtr 1 +static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#endif + #define gen_nb_xmlHashDeallocator 2 static void test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { @@ -2928,6 +2951,59 @@ test_htmlDocDumpMemory(void) { } +static int +test_htmlDocDumpMemoryFormat(void) { + int test_ret = 0; + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) + int mem_base; + xmlDocPtr cur; /* the document */ + int n_cur; + xmlChar ** mem; /* OUT: the memory pointer */ + int n_mem; + int * size; /* OUT: the memory length */ + int n_size; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlDocPtr(n_cur, 0); + mem = gen_xmlChar_ptr_ptr(n_mem, 1); + size = gen_int_ptr(n_size, 2); + format = gen_int(n_format, 3); + + htmlDocDumpMemoryFormat(cur, mem, size, format); + call_tests++; + des_xmlDocPtr(n_cur, cur, 0); + des_xmlChar_ptr_ptr(n_mem, mem, 1); + des_int_ptr(n_size, size, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDocDumpMemoryFormat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_mem); + printf(" %d", n_size); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_htmlGetMetaEncoding(void) { int test_ret = 0; @@ -3535,11 +3611,12 @@ static int test_HTMLtree(void) { int test_ret = 0; - if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n"); + if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n"); test_ret += test_htmlDocContentDumpFormatOutput(); test_ret += test_htmlDocContentDumpOutput(); test_ret += test_htmlDocDump(); test_ret += test_htmlDocDumpMemory(); + test_ret += test_htmlDocDumpMemoryFormat(); test_ret += test_htmlGetMetaEncoding(); test_ret += test_htmlIsBooleanAttr(); test_ret += test_htmlNewDoc(); @@ -16960,11 +17037,100 @@ test_xmlStreamPushAttr(void) { return(test_ret); } + +static int +test_xmlStreamPushNode(void) { + int test_ret = 0; + +#if defined(LIBXML_PATTERN_ENABLED) + int mem_base; + int ret_val; + xmlStreamCtxtPtr stream; /* the stream context */ + int n_stream; + xmlChar * name; /* the current name */ + int n_name; + xmlChar * ns; /* the namespace name */ + int n_ns; + int nodeType; /* the type of the node being pushed */ + int n_nodeType; + + for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { + for (n_nodeType = 0;n_nodeType < gen_nb_int;n_nodeType++) { + mem_base = xmlMemBlocks(); + stream = gen_xmlStreamCtxtPtr(n_stream, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ns = gen_const_xmlChar_ptr(n_ns, 2); + nodeType = gen_int(n_nodeType, 3); + + ret_val = xmlStreamPushNode(stream, (const xmlChar *)name, (const xmlChar *)ns, nodeType); + desret_int(ret_val); + call_tests++; + des_xmlStreamCtxtPtr(n_stream, stream, 0); + des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); + des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2); + des_int(n_nodeType, nodeType, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStreamPushNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_stream); + printf(" %d", n_name); + printf(" %d", n_ns); + printf(" %d", n_nodeType); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlStreamWantsAnyNode(void) { + int test_ret = 0; + +#if defined(LIBXML_PATTERN_ENABLED) + int mem_base; + int ret_val; + xmlStreamCtxtPtr streamCtxt; /* the stream context */ + int n_streamCtxt; + + for (n_streamCtxt = 0;n_streamCtxt < gen_nb_xmlStreamCtxtPtr;n_streamCtxt++) { + mem_base = xmlMemBlocks(); + streamCtxt = gen_xmlStreamCtxtPtr(n_streamCtxt, 0); + + ret_val = xmlStreamWantsAnyNode(streamCtxt); + desret_int(ret_val); + call_tests++; + des_xmlStreamCtxtPtr(n_streamCtxt, streamCtxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStreamWantsAnyNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_streamCtxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + static int test_pattern(void) { int test_ret = 0; - if (quiet == 0) printf("Testing pattern : 8 of 13 functions ...\n"); + if (quiet == 0) printf("Testing pattern : 10 of 15 functions ...\n"); test_ret += test_xmlPatternFromRoot(); test_ret += test_xmlPatternGetStreamCtxt(); test_ret += test_xmlPatternMatch(); @@ -16975,6 +17141,8 @@ test_pattern(void) { test_ret += test_xmlStreamPop(); test_ret += test_xmlStreamPush(); test_ret += test_xmlStreamPushAttr(); + test_ret += test_xmlStreamPushNode(); + test_ret += test_xmlStreamWantsAnyNode(); if (test_ret != 0) printf("Module pattern: %d errors\n", test_ret); @@ -17757,6 +17925,7 @@ test_xmlSchematronNewParserCtxt(void) { return(test_ret); } +#ifdef LIBXML_SCHEMATRON_ENABLED #define gen_nb_xmlSchematronPtr 1 static xmlSchematronPtr gen_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -17764,6 +17933,8 @@ static xmlSchematronPtr gen_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, int nr ATT } static void des_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, xmlSchematronPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#endif + static int test_xmlSchematronNewValidCtxt(void) { @@ -17774,6 +17945,7 @@ test_xmlSchematronNewValidCtxt(void) { return(test_ret); } +#ifdef LIBXML_SCHEMATRON_ENABLED #define gen_nb_xmlSchematronParserCtxtPtr 1 static xmlSchematronParserCtxtPtr gen_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -17781,6 +17953,8 @@ static xmlSchematronParserCtxtPtr gen_xmlSchematronParserCtxtPtr(int no ATTRIBUT } static void des_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#endif + static int test_xmlSchematronParse(void) { @@ -17791,6 +17965,7 @@ test_xmlSchematronParse(void) { return(test_ret); } +#ifdef LIBXML_SCHEMATRON_ENABLED #define gen_nb_xmlSchematronValidCtxtPtr 1 static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -17798,6 +17973,8 @@ static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_ } static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#endif + static int test_xmlSchematronValidateDoc(void) { @@ -25337,28 +25514,28 @@ test_xmlValidGetPotentialChildren(void) { int ret_val; xmlElementContent * ctree; /* an element content tree */ int n_ctree; - xmlChar ** list; /* an array to store the list of child names */ - int n_list; + xmlChar ** names; /* an array to store the list of child names */ + int n_names; int * len; /* a pointer to the number of element in the list */ int n_len; int max; /* the size of the array */ int n_max; for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) { - for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) { + for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) { for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { for (n_max = 0;n_max < gen_nb_int;n_max++) { mem_base = xmlMemBlocks(); ctree = gen_xmlElementContent_ptr(n_ctree, 0); - list = gen_const_xmlChar_ptr_ptr(n_list, 1); + names = gen_const_xmlChar_ptr_ptr(n_names, 1); len = gen_int_ptr(n_len, 2); max = gen_int(n_max, 3); - ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max); + ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)names, len, max); desret_int(ret_val); call_tests++; des_xmlElementContent_ptr(n_ctree, ctree, 0); - des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1); + des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 1); des_int_ptr(n_len, len, 2); des_int(n_max, max, 3); xmlResetLastError(); @@ -25367,7 +25544,7 @@ test_xmlValidGetPotentialChildren(void) { xmlMemBlocks() - mem_base); test_ret++; printf(" %d", n_ctree); - printf(" %d", n_list); + printf(" %d", n_names); printf(" %d", n_len); printf(" %d", n_max); printf("\n"); @@ -27507,6 +27684,47 @@ test_xmlNormalizeWindowsPath(void) { } +static int +test_xmlOutputBufferCreateBuffer(void) { + int test_ret = 0; + +#if defined(LIBXML_OUTPUT_ENABLED) + int mem_base; + xmlOutputBufferPtr ret_val; + xmlBufferPtr buffer; /* a xmlBufferPtr */ + int n_buffer; + xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ + int n_encoder; + + for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) { + for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { + mem_base = xmlMemBlocks(); + buffer = gen_xmlBufferPtr(n_buffer, 0); + encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); + + ret_val = xmlOutputBufferCreateBuffer(buffer, encoder); + desret_xmlOutputBufferPtr(ret_val); + call_tests++; + des_xmlBufferPtr(n_buffer, buffer, 0); + des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferCreateBuffer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_encoder); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlOutputBufferCreateFd(void) { int test_ret = 0; @@ -28215,7 +28433,7 @@ static int test_xmlIO(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n"); + if (quiet == 0) printf("Testing xmlIO : 39 of 48 functions ...\n"); test_ret += test_xmlAllocOutputBuffer(); test_ret += test_xmlAllocParserInputBuffer(); test_ret += test_xmlCheckFilename(); @@ -28236,6 +28454,7 @@ test_xmlIO(void) { test_ret += test_xmlIOHTTPRead(); test_ret += test_xmlNoNetExternalEntityLoader(); test_ret += test_xmlNormalizeWindowsPath(); + test_ret += test_xmlOutputBufferCreateBuffer(); test_ret += test_xmlOutputBufferCreateFd(); test_ret += test_xmlOutputBufferCreateFile(); test_ret += test_xmlOutputBufferCreateFilename(); @@ -31629,6 +31848,64 @@ test_xmlTextReaderSchemaValidate(void) { return(test_ret); } +#ifdef LIBXML_READER_ENABLED + +#define gen_nb_xmlSchemaValidCtxtPtr 1 +static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlTextReaderSchemaValidateCtxt(void) { + int test_ret = 0; + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlSchemaValidCtxtPtr ctxt; /* the XML Schema validation context or NULL */ + int n_ctxt; + int options; /* options (not used yet) */ + int n_options; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 1); + options = gen_parseroptions(n_options, 2); + + ret_val = xmlTextReaderSchemaValidateCtxt(reader, ctxt, options); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 1); + des_parseroptions(n_options, options, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderSchemaValidateCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + static int test_xmlTextReaderSetErrorHandler(void) { @@ -31854,7 +32131,7 @@ static int test_xmlreader(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlreader : 73 of 83 functions ...\n"); + if (quiet == 0) printf("Testing xmlreader : 74 of 84 functions ...\n"); test_ret += test_xmlNewTextReader(); test_ret += test_xmlNewTextReaderFilename(); test_ret += test_xmlReaderForDoc(); @@ -31923,6 +32200,7 @@ test_xmlreader(void) { test_ret += test_xmlTextReaderRelaxNGSetSchema(); test_ret += test_xmlTextReaderRelaxNGValidate(); test_ret += test_xmlTextReaderSchemaValidate(); + test_ret += test_xmlTextReaderSchemaValidateCtxt(); test_ret += test_xmlTextReaderSetErrorHandler(); test_ret += test_xmlTextReaderSetParserProp(); test_ret += test_xmlTextReaderSetSchema(); @@ -31935,16 +32213,6 @@ test_xmlreader(void) { printf("Module xmlreader: %d errors\n", test_ret); return(test_ret); } -#ifdef LIBXML_REGEXP_ENABLED - -#define gen_nb_xmlExpCtxtPtr 1 -static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - static int test_xmlExpCtxtNbCons(void) { @@ -32013,16 +32281,6 @@ test_xmlExpCtxtNbNodes(void) { return(test_ret); } -#ifdef LIBXML_REGEXP_ENABLED - -#define gen_nb_xmlExpNodePtr 1 -static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - static int test_xmlExpDump(void) { @@ -32084,27 +32342,27 @@ test_xmlExpGetLanguage(void) { int n_ctxt; xmlExpNodePtr exp; /* the expression */ int n_exp; - xmlChar ** list; /* where to store the tokens */ - int n_list; + xmlChar ** langList; /* where to store the tokens */ + int n_langList; int len; /* the allocated lenght of @list */ int n_len; for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) { + for (n_langList = 0;n_langList < gen_nb_const_xmlChar_ptr_ptr;n_langList++) { for (n_len = 0;n_len < gen_nb_int;n_len++) { mem_base = xmlMemBlocks(); ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); exp = gen_xmlExpNodePtr(n_exp, 1); - list = gen_const_xmlChar_ptr_ptr(n_list, 2); + langList = gen_const_xmlChar_ptr_ptr(n_langList, 2); len = gen_int(n_len, 3); - ret_val = xmlExpGetLanguage(ctxt, exp, (const xmlChar **)list, len); + ret_val = xmlExpGetLanguage(ctxt, exp, (const xmlChar **)langList, len); desret_int(ret_val); call_tests++; des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); des_xmlExpNodePtr(n_exp, exp, 1); - des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 2); + des_const_xmlChar_ptr_ptr(n_langList, (const xmlChar **)langList, 2); des_int(n_len, len, 3); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { @@ -32113,7 +32371,7 @@ test_xmlExpGetLanguage(void) { test_ret++; printf(" %d", n_ctxt); printf(" %d", n_exp); - printf(" %d", n_list); + printf(" %d", n_langList); printf(" %d", n_len); printf("\n"); } @@ -32139,27 +32397,27 @@ test_xmlExpGetStart(void) { int n_ctxt; xmlExpNodePtr exp; /* the expression */ int n_exp; - xmlChar ** list; /* where to store the tokens */ - int n_list; + xmlChar ** tokList; /* where to store the tokens */ + int n_tokList; int len; /* the allocated lenght of @list */ int n_len; for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) { + for (n_tokList = 0;n_tokList < gen_nb_const_xmlChar_ptr_ptr;n_tokList++) { for (n_len = 0;n_len < gen_nb_int;n_len++) { mem_base = xmlMemBlocks(); ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); exp = gen_xmlExpNodePtr(n_exp, 1); - list = gen_const_xmlChar_ptr_ptr(n_list, 2); + tokList = gen_const_xmlChar_ptr_ptr(n_tokList, 2); len = gen_int(n_len, 3); - ret_val = xmlExpGetStart(ctxt, exp, (const xmlChar **)list, len); + ret_val = xmlExpGetStart(ctxt, exp, (const xmlChar **)tokList, len); desret_int(ret_val); call_tests++; des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); des_xmlExpNodePtr(n_exp, exp, 1); - des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 2); + des_const_xmlChar_ptr_ptr(n_tokList, (const xmlChar **)tokList, 2); des_int(n_len, len, 3); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { @@ -32168,7 +32426,7 @@ test_xmlExpGetStart(void) { test_ret++; printf(" %d", n_ctxt); printf(" %d", n_exp); - printf(" %d", n_list); + printf(" %d", n_tokList); printf(" %d", n_len); printf("\n"); } @@ -32964,6 +33222,16 @@ test_xmlSaveSetEscape(void) { } +static int +test_xmlSaveToBuffer(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlSaveToFd(void) { int test_ret = 0; @@ -33028,12 +33296,13 @@ static int test_xmlsave(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n"); + if (quiet == 0) printf("Testing xmlsave : 4 of 10 functions ...\n"); test_ret += test_xmlSaveClose(); test_ret += test_xmlSaveDoc(); test_ret += test_xmlSaveFlush(); test_ret += test_xmlSaveSetAttrEscape(); test_ret += test_xmlSaveSetEscape(); + test_ret += test_xmlSaveToBuffer(); test_ret += test_xmlSaveToFd(); test_ret += test_xmlSaveToFilename(); test_ret += test_xmlSaveTree(); @@ -33166,16 +33435,6 @@ test_xmlSchemaGetParserErrors(void) { return(test_ret); } -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaValidCtxtPtr 1 -static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - static int test_xmlSchemaGetValidErrors(void) { @@ -33184,13 +33443,13 @@ test_xmlSchemaGetValidErrors(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - xmlSchemaValidityErrorFunc * err; /* the error function result */ + xmlSchemaValidityErrorFunc * err; /* */ int n_err; - xmlSchemaValidityWarningFunc * warn; /* the warning function result */ + xmlSchemaValidityWarningFunc * warn; /* */ int n_warn; - void ** ctx; /* the functions context result */ + void ** ctx; /* */ int n_ctx; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33239,7 +33498,7 @@ test_xmlSchemaIsValid(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* the schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33432,7 +33691,7 @@ test_xmlSchemaSAXUnplug(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaSAXPlugPtr plug; /* a data structure returned by xmlSchemaSAXPlug */ + xmlSchemaSAXPlugPtr plug; /* */ int n_plug; for (n_plug = 0;n_plug < gen_nb_xmlSchemaSAXPlugPtr;n_plug++) { @@ -33469,6 +33728,16 @@ test_xmlSchemaSetParserErrors(void) { } +static int +test_xmlSchemaSetParserStructuredErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlSchemaSetValidErrors(void) { int test_ret = 0; @@ -33486,9 +33755,9 @@ test_xmlSchemaSetValidOptions(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - int options; /* a combination of xmlSchemaValidOption */ + int options; /* */ int n_options; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33537,7 +33806,7 @@ test_xmlSchemaValidCtxtGetOptions(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33571,29 +33840,29 @@ test_xmlSchemaValidateDoc(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - xmlDocPtr doc; /* a parsed document tree */ - int n_doc; + xmlDocPtr instance; /* */ + int n_instance; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_instance = 0;n_instance < gen_nb_xmlDocPtr;n_instance++) { mem_base = xmlMemBlocks(); ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); + instance = gen_xmlDocPtr(n_instance, 1); - ret_val = xmlSchemaValidateDoc(ctxt, doc); + ret_val = xmlSchemaValidateDoc(ctxt, instance); desret_int(ret_val); call_tests++; des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); + des_xmlDocPtr(n_instance, instance, 1); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { printf("Leak of %d blocks found in xmlSchemaValidateDoc", xmlMemBlocks() - mem_base); test_ret++; printf(" %d", n_ctxt); - printf(" %d", n_doc); + printf(" %d", n_instance); printf("\n"); } } @@ -33612,11 +33881,11 @@ test_xmlSchemaValidateFile(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - const char * filename; /* the URI of the instance */ + const char * filename; /* */ int n_filename; - int options; /* a future set of options, currently unused */ + int options; /* */ int n_options; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33660,9 +33929,9 @@ test_xmlSchemaValidateOneElement(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - xmlNodePtr elem; /* an element node */ + xmlNodePtr elem; /* */ int n_elem; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33701,15 +33970,15 @@ test_xmlSchemaValidateStream(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + xmlSchemaValidCtxtPtr ctxt; /* */ int n_ctxt; - xmlParserInputBufferPtr input; /* the input to use for reading the data */ + xmlParserInputBufferPtr input; /* */ int n_input; - xmlCharEncoding enc; /* an optional encoding information */ + xmlCharEncoding enc; /* */ int n_enc; - xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */ + xmlSAXHandlerPtr sax; /* */ int n_sax; - void * user_data; /* the context to provide to the SAX handler. */ + void * user_data; /* */ int n_user_data; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33759,7 +34028,7 @@ static int test_xmlschemas(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlschemas : 14 of 23 functions ...\n"); + if (quiet == 0) printf("Testing xmlschemas : 14 of 24 functions ...\n"); test_ret += test_xmlSchemaDump(); test_ret += test_xmlSchemaGetParserErrors(); test_ret += test_xmlSchemaGetValidErrors(); @@ -33772,6 +34041,7 @@ test_xmlschemas(void) { test_ret += test_xmlSchemaSAXPlug(); test_ret += test_xmlSchemaSAXUnplug(); test_ret += test_xmlSchemaSetParserErrors(); + test_ret += test_xmlSchemaSetParserStructuredErrors(); test_ret += test_xmlSchemaSetValidErrors(); test_ret += test_xmlSchemaSetValidOptions(); test_ret += test_xmlSchemaSetValidStructuredErrors(); @@ -35579,7 +35849,7 @@ test_xmlStrncatNew(void) { int n_str1; xmlChar * str2; /* second xmlChar string */ int n_str2; - int len; /* the len of @str2 */ + int len; /* the len of @str2 or < 0 */ int n_len; for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { diff --git a/tree.c b/tree.c index 3031d50..f607688 100644 --- a/tree.c +++ b/tree.c @@ -2012,6 +2012,8 @@ xmlRemoveProp(xmlAttrPtr cur) { tmp = cur->parent->properties; if (tmp == cur) { cur->parent->properties = cur->next; + if (cur->next != NULL) + cur->next->prev = NULL; xmlFreeProp(cur); return(0); } @@ -2831,6 +2833,14 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) { return(NULL); } + if (cur == elem) { +#ifdef DEBUG_TREE + xmlGenericError(xmlGenericErrorContext, + "xmlAddNextSibling : cur == elem\n"); +#endif + return(NULL); + } + xmlUnlinkNode(elem); if (elem->type == XML_TEXT_NODE) { @@ -2854,12 +2864,16 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) { /* check if an attribute with the same name exists */ xmlAttrPtr attr; + if (cur->type != XML_ATTRIBUTE_NODE) + return(NULL); if (elem->ns == NULL) - attr = xmlHasProp(cur->parent, elem->name); + attr = xmlHasNsProp(cur->parent, elem->name, NULL); else attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href); - if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) { + /* elem has already been unlinked so can never be attr */ + if ((attr != NULL) && (attr->type != XML_ATTRIBUTE_DECL)) { /* different instance, destroy it (attributes must be unique) */ + xmlUnlinkNode((xmlNodePtr) attr); xmlFreeProp(attr); } } @@ -2911,6 +2925,14 @@ xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) { return(NULL); } + if (cur == elem) { +#ifdef DEBUG_TREE + xmlGenericError(xmlGenericErrorContext, + "xmlAddPrevSibling : cur == elem\n"); +#endif + return(NULL); + } + xmlUnlinkNode(elem); if (elem->type == XML_TEXT_NODE) { @@ -2934,12 +2956,16 @@ xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) { /* check if an attribute with the same name exists */ xmlAttrPtr attr; + if (cur->type != XML_ATTRIBUTE_NODE) + return(NULL); if (elem->ns == NULL) - attr = xmlHasProp(cur->parent, elem->name); + attr = xmlHasNsProp(cur->parent, elem->name, NULL); else attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href); - if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) { + /* elem has already been unlinked so can never be attr */ + if ((attr != NULL) && (attr->type != XML_ATTRIBUTE_DECL)) { /* different instance, destroy it (attributes must be unique) */ + xmlUnlinkNode((xmlNodePtr) attr); xmlFreeProp(attr); } } @@ -3149,6 +3175,13 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) { return(NULL); } + if (parent == cur) { +#ifdef DEBUG_TREE + xmlGenericError(xmlGenericErrorContext, + "xmlAddChild : parent == cur\n"); +#endif + return(NULL); + } /* * If cur is a TEXT node, merge its content with adjacent TEXT nodes * cur is then freed. @@ -3156,8 +3189,7 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) { if (cur->type == XML_TEXT_NODE) { if ((parent->type == XML_TEXT_NODE) && (parent->content != NULL) && - (parent->name == cur->name) && - (parent != cur)) { + (parent->name == cur->name)) { xmlNodeAddContent(parent, cur->content); xmlFreeNode(cur); return(parent); @@ -3196,6 +3228,8 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) { return(parent); } if (cur->type == XML_ATTRIBUTE_NODE) { + if (parent->type != XML_ELEMENT_NODE) + return(NULL); if (parent->properties == NULL) { parent->properties = (xmlAttrPtr) cur; } else { @@ -3203,13 +3237,16 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) { xmlAttrPtr lastattr; if (cur->ns == NULL) - lastattr = xmlHasProp(parent, cur->name); + lastattr = xmlHasNsProp(parent, cur->name, NULL); else lastattr = xmlHasNsProp(parent, cur->name, cur->ns->href); - if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur)) { + if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur) && (lastattr->type != XML_ATTRIBUTE_DECL)) { /* different instance, destroy it (attributes must be unique) */ + xmlUnlinkNode((xmlNodePtr) lastattr); xmlFreeProp(lastattr); } + if (lastattr == (xmlAttrPtr) cur) + return(cur); /* find the end */ lastattr = parent->properties; while (lastattr->next != NULL) { @@ -3575,22 +3612,16 @@ xmlCopyNamespaceList(xmlNsPtr cur) { static xmlNodePtr xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent); -/** - * xmlCopyProp: - * @target: the element where the attribute will be grafted - * @cur: the attribute - * - * Do a copy of the attribute. - * - * Returns: a new #xmlAttrPtr, or NULL in case of error. - */ -xmlAttrPtr -xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur) { + +static xmlAttrPtr +xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) { xmlAttrPtr ret; if (cur == NULL) return(NULL); if (target != NULL) ret = xmlNewDocProp(target->doc, cur->name, NULL); + else if (doc != NULL) + ret = xmlNewDocProp(doc, cur->name, NULL); else if (cur->parent != NULL) ret = xmlNewDocProp(cur->parent->doc, cur->name, NULL); else if (cur->children != NULL) @@ -3678,6 +3709,20 @@ xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur) { return(ret); } +/** + * xmlCopyProp: + * @target: the element where the attribute will be grafted + * @cur: the attribute + * + * Do a copy of the attribute. + * + * Returns: a new #xmlAttrPtr, or NULL in case of error. + */ +xmlAttrPtr +xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur) { + return xmlCopyPropInternal(NULL, target, cur); +} + /** * xmlCopyPropList: * @target: the element where the attributes will be grafted @@ -3746,7 +3791,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, case XML_XINCLUDE_END: break; case XML_ATTRIBUTE_NODE: - return((xmlNodePtr) xmlCopyProp(parent, (xmlAttrPtr) node)); + return((xmlNodePtr) xmlCopyPropInternal(doc, parent, (xmlAttrPtr) node)); case XML_NAMESPACE_DECL: return((xmlNodePtr) xmlCopyNamespaceList((xmlNsPtr) node)); @@ -4861,8 +4906,8 @@ xmlNodeBufGetContent(xmlBufferPtr buffer, xmlNodePtr cur) xmlBufferCat(buffer, tmp->content); break; case XML_ENTITY_REF_NODE: - xmlNodeBufGetContent(buffer, tmp->children); - break; + xmlNodeBufGetContent(buffer, tmp); + break; default: break; } @@ -6258,7 +6303,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { */ int xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { - xmlAttrPtr prop, prev = NULL;; + xmlAttrPtr prop; if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL)) return(-1); @@ -6270,7 +6315,6 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { xmlFreeProp(prop); return(0); } - prev = prop; prop = prop->next; } return(-1); @@ -6287,7 +6331,7 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { */ int xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { - xmlAttrPtr prop, prev = NULL;; + xmlAttrPtr prop; if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL)) return(-1); @@ -6303,7 +6347,6 @@ xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { xmlFreeProp(prop); return(0); } - prev = prop; prop = prop->next; } return(-1); diff --git a/uri.c b/uri.c index a00415c..3722311 100644 --- a/uri.c +++ b/uri.c @@ -2130,9 +2130,11 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) int ix; int pos = 0; int nbslash = 0; + int len; xmlURIPtr ref = NULL; xmlURIPtr bas = NULL; xmlChar *bptr, *uptr, *vptr; + int remove_path = 0; if ((URI == NULL) || (*URI == 0)) return NULL; @@ -2173,63 +2175,101 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) * just return the URI */ if ((ref->scheme != NULL) && - ((bas->scheme == NULL) || - xmlStrcmp ((xmlChar *)bas->scheme, (xmlChar *)ref->scheme) || - xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server))) { + ((bas->scheme == NULL) || + (xmlStrcmp ((xmlChar *)bas->scheme, (xmlChar *)ref->scheme)) || + (xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server)))) { val = xmlStrdup (URI); goto done; } + if (xmlStrEqual((xmlChar *)bas->path, (xmlChar *)ref->path)) { + val = xmlStrdup(BAD_CAST ""); + goto done; + } + if (bas->path == NULL) { + val = xmlStrdup((xmlChar *)ref->path); + goto done; + } + if (ref->path == NULL) { + ref->path = (char *) "/"; + remove_path = 1; + } /* * At this point (at last!) we can compare the two paths * - * First we compare the two strings and find where they first differ + * First we take care of the special case where either of the + * two path components may be missing (bug 316224) */ - bptr = (xmlChar *)bas->path; - if ((ref->path[pos] == '.') && (ref->path[pos+1] == '/')) - pos += 2; - if ((*bptr == '.') && (bptr[1] == '/')) - bptr += 2; - else if ((*bptr == '/') && (ref->path[pos] != '/')) - bptr++; - while ((bptr[pos] == ref->path[pos]) && (bptr[pos] != 0)) - pos++; - - if (bptr[pos] == ref->path[pos]) { - val = NULL; /* if no differences, return NULL */ - goto done; /* (I can't imagine why anyone would do this) */ - } - - /* - * In URI, "back up" to the last '/' encountered. This will be the - * beginning of the "unique" suffix of URI - */ - ix = pos; - if ((ref->path[ix] == '/') && (ix > 0)) - ix--; - for (; ix > 0; ix--) { - if (ref->path[ix] == '/') - break; + if (bas->path == NULL) { + if (ref->path != NULL) { + uptr = (xmlChar *) ref->path; + if (*uptr == '/') + uptr++; + val = xmlStrdup(uptr); + } + goto done; } - if (ix == 0) { - uptr = (xmlChar *)ref->path; + bptr = (xmlChar *)bas->path; + if (ref->path == NULL) { + for (ix = 0; bptr[ix] != 0; ix++) { + if (bptr[ix] == '/') + nbslash++; + } + uptr = NULL; + len = 1; /* this is for a string terminator only */ } else { - ix++; - uptr = (xmlChar *)&ref->path[ix]; - } - /* - * In base, count the number of '/' from the differing point + * Next we compare the two strings and find where they first differ */ - if (bptr[pos] != ref->path[pos]) { /* check for trivial URI == base */ - for (; bptr[ix] != 0; ix++) { - if (bptr[ix] == '/') - nbslash++; + if ((ref->path[pos] == '.') && (ref->path[pos+1] == '/')) + pos += 2; + if ((*bptr == '.') && (bptr[1] == '/')) + bptr += 2; + else if ((*bptr == '/') && (ref->path[pos] != '/')) + bptr++; + while ((bptr[pos] == ref->path[pos]) && (bptr[pos] != 0)) + pos++; + + if (bptr[pos] == ref->path[pos]) { + val = xmlStrdup(BAD_CAST ""); + goto done; /* (I can't imagine why anyone would do this) */ } - } + /* + * In URI, "back up" to the last '/' encountered. This will be the + * beginning of the "unique" suffix of URI + */ + ix = pos; + if ((ref->path[ix] == '/') && (ix > 0)) + ix--; + else if ((ref->path[ix] == 0) && (ix > 1) && (ref->path[ix - 1] == '/')) + ix -= 2; + for (; ix > 0; ix--) { + if (ref->path[ix] == '/') + break; + } + if (ix == 0) { + uptr = (xmlChar *)ref->path; + } else { + ix++; + uptr = (xmlChar *)&ref->path[ix]; + } + + /* + * In base, count the number of '/' from the differing point + */ + if (bptr[pos] != ref->path[pos]) {/* check for trivial URI == base */ + for (; bptr[ix] != 0; ix++) { + if (bptr[ix] == '/') + nbslash++; + } + } + len = xmlStrlen (uptr) + 1; + } + if (nbslash == 0) { - val = xmlStrdup (uptr); + if (uptr != NULL) + val = xmlStrdup (uptr); goto done; } @@ -2238,8 +2278,7 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) * length of the remainder of the URI, plus enough space * for the "../" groups, plus one for the terminator */ - ix = xmlStrlen (uptr) + 1; - val = (xmlChar *) xmlMalloc (ix + 3 * nbslash); + val = (xmlChar *) xmlMalloc (len + 3 * nbslash); if (val == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlBuildRelativeURI: out of memory\n"); @@ -2257,12 +2296,25 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) /* * Finish up with the end of the URI */ - memcpy (vptr, uptr, ix); + if (uptr != NULL) { + if ((vptr > val) && (len > 0) && + (uptr[0] == '/') && (vptr[-1] == '/')) { + memcpy (vptr, uptr + 1, len - 1); + vptr[len - 2] = 0; + } else { + memcpy (vptr, uptr, len); + vptr[len - 1] = 0; + } + } else { + vptr[len - 1] = 0; + } - done: +done: /* * Free the working variables */ + if (remove_path != 0) + ref->path = NULL; if (ref != NULL) xmlFreeURI (ref); if (bas != NULL) diff --git a/valid.c b/valid.c index 3ee5630..4fcf447 100644 --- a/valid.c +++ b/valid.c @@ -6760,7 +6760,7 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { /** * xmlValidGetPotentialChildren: * @ctree: an element content tree - * @list: an array to store the list of child names + * @names: an array to store the list of child names * @len: a pointer to the number of element in the list * @max: the size of the array * @@ -6770,32 +6770,33 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { */ int -xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list, +xmlValidGetPotentialChildren(xmlElementContent *ctree, + const xmlChar **names, int *len, int max) { int i; - if ((ctree == NULL) || (list == NULL) || (len == NULL)) + if ((ctree == NULL) || (names == NULL) || (len == NULL)) return(-1); if (*len >= max) return(*len); switch (ctree->type) { case XML_ELEMENT_CONTENT_PCDATA: for (i = 0; i < *len;i++) - if (xmlStrEqual(BAD_CAST "#PCDATA", list[i])) return(*len); - list[(*len)++] = BAD_CAST "#PCDATA"; + if (xmlStrEqual(BAD_CAST "#PCDATA", names[i])) return(*len); + names[(*len)++] = BAD_CAST "#PCDATA"; break; case XML_ELEMENT_CONTENT_ELEMENT: for (i = 0; i < *len;i++) - if (xmlStrEqual(ctree->name, list[i])) return(*len); - list[(*len)++] = ctree->name; + if (xmlStrEqual(ctree->name, names[i])) return(*len); + names[(*len)++] = ctree->name; break; case XML_ELEMENT_CONTENT_SEQ: - xmlValidGetPotentialChildren(ctree->c1, list, len, max); - xmlValidGetPotentialChildren(ctree->c2, list, len, max); + xmlValidGetPotentialChildren(ctree->c1, names, len, max); + xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; case XML_ELEMENT_CONTENT_OR: - xmlValidGetPotentialChildren(ctree->c1, list, len, max); - xmlValidGetPotentialChildren(ctree->c2, list, len, max); + xmlValidGetPotentialChildren(ctree->c1, names, len, max); + xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; } diff --git a/vms/config.vms b/vms/config.vms index b898bf1..6ecfa47 100755 --- a/vms/config.vms +++ b/vms/config.vms @@ -151,15 +151,6 @@ /* Define if you have the header file. */ #undef HAVE_ZLIB_H -/* Define if you have the inet library (-linet). */ -#undef HAVE_LIBINET - -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define if you have the socket library (-lsocket). */ -#undef HAVE_LIBSOCKET - /* Name of package */ #undef PACKAGE diff --git a/win32/Makefile.mingw b/win32/Makefile.mingw index 61d15ab..4c3d018 100644 --- a/win32/Makefile.mingw +++ b/win32/Makefile.mingw @@ -126,6 +126,7 @@ XML_OBJS = $(XML_INTDIR)/c14n.o\ $(XML_INTDIR)/relaxng.o\ $(XML_INTDIR)/SAX.o\ $(XML_INTDIR)/SAX2.o\ + $(XML_INTDIR)/schematron.o\ $(XML_INTDIR)/threads.o\ $(XML_INTDIR)/tree.o\ $(XML_INTDIR)/uri.o\ @@ -172,6 +173,7 @@ XML_OBJS_A = $(XML_INTDIR_A)/c14n.o\ $(XML_INTDIR_A)/relaxng.o\ $(XML_INTDIR_A)/SAX.o\ $(XML_INTDIR_A)/SAX2.o\ + $(XML_INTDIR_A)/schematron.o\ $(XML_INTDIR_A)/threads.o\ $(XML_INTDIR_A)/tree.o\ $(XML_INTDIR_A)/uri.o\ @@ -209,7 +211,7 @@ UTILS = $(BINDIR)/xmllint.exe\ $(BINDIR)/testSchemas.exe\ $(BINDIR)/testURI.exe\ $(BINDIR)/testXPath.exe\ - $(BINDIR)/runtest.exe\ + $(BINDIR)/runtest.exe\ $(BINDIR)/runsuite.exe ifeq ($(WITH_THREADS),yes) UTILS += $(BINDIR)/testThreadsWin32.exe diff --git a/win32/Makefile.mingw.orig b/win32/Makefile.mingw.orig new file mode 100644 index 0000000..61d15ab --- /dev/null +++ b/win32/Makefile.mingw.orig @@ -0,0 +1,336 @@ +# Makefile for libxml2, specific for Windows, GCC (mingw) and GNU make. +# +# Take a look at the beginning and modify the variables to suit your +# environment. Having done that, you can do a +# +# nmake [all] to build the libxml and the accompanying utilities. +# nmake clean to remove all compiler output files and return to a +# clean state. +# nmake rebuild to rebuild everything from scratch. This basically does +# a 'nmake clean' and then a 'nmake all'. +# nmake install to install the library and its header files. +# +# November 2002, Igor Zlatkovic + +# There should never be a need to modify anything below this line. +# ---------------------------------------------------------------- + +AUTOCONF = .\config.mingw +include $(AUTOCONF) + +# Names of various input and output components. +XML_NAME = xml2 +XML_BASENAME = lib$(XML_NAME) +XML_SO = $(XML_BASENAME).dll +XML_IMP = $(XML_BASENAME).lib +XML_A = $(XML_BASENAME).a + +# Place where we let the compiler put its output. +BINDIR = bin.mingw +XML_INTDIR = int.mingw +XML_INTDIR_A = int.a.mingw +UTILS_INTDIR = int.utils.mingw + +# The preprocessor and its options. +CPP = gcc.exe -E +CPPFLAGS += -I$(XML_SRCDIR)/include +ifeq ($(WITH_THREADS),1) +CPPFLAGS += -D_REENTRANT +endif + +# The compiler and its options. +CC = gcc.exe +CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS +CFLAGS += -I$(XML_SRCDIR) -I$(XML_SRCDIR)/include -I$(INCPREFIX) +ifneq ($(WITH_THREADS),no) +CFLAGS += -D_REENTRANT +endif +ifeq ($(WITH_THREADS),yes) +CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS +endif +ifeq ($(WITH_THREADS),ctls) +CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS +endif +ifeq ($(WITH_THREADS),native) +CFLAGS += -DHAVE_WIN32_THREADS +endif +ifeq ($(WITH_THREADS),posix) +CFLAGS += -DHAVE_PTHREAD_H +endif +ifeq ($(WITH_ZLIB),1) +CFLAGS += -DHAVE_ZLIB_H +endif + +# The linker and its options. +LD = gcc.exe +LDFLAGS += -Wl,--major-image-version,$(LIBXML_MAJOR_VERSION) +LDFLAGS += -Wl,--minor-image-version,$(LIBXML_MINOR_VERSION) +LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX) +LIBS = +ifeq ($(WITH_FTP),1) +CFLAGS += -D_WINSOCKAPI_ +LIBS += -lwsock32 +endif +ifeq ($(WITH_HTTP),1) +CFLAGS += -D_WINSOCKAPI_ +LIBS += -lwsock32 +endif +ifeq ($(WITH_ICONV),1) +LIBS += -liconv +endif +ifeq ($(WITH_ZLIB),1) +LIBS += -lzdll +endif +ifeq ($(WITH_THREADS),posix) +LIBS += -lpthreadGC +endif +ifeq ($(WITH_MODULES),1) +LIBS += -lkernel32 +endif + +# The archiver and its options. +AR = ar.exe +ARFLAGS = -r + +# Optimisation and debug symbols. +ifeq ($(DEBUG),1) +CFLAGS += -D_DEBUG -g +LDFLAGS += +else +CFLAGS += -DNDEBUG -O2 +LDFLAGS += +endif + + +# Libxml object files. +XML_OBJS = $(XML_INTDIR)/c14n.o\ + $(XML_INTDIR)/catalog.o\ + $(XML_INTDIR)/chvalid.o\ + $(XML_INTDIR)/debugXML.o\ + $(XML_INTDIR)/dict.o\ + $(XML_INTDIR)/DOCBparser.o\ + $(XML_INTDIR)/encoding.o\ + $(XML_INTDIR)/entities.o\ + $(XML_INTDIR)/error.o\ + $(XML_INTDIR)/globals.o\ + $(XML_INTDIR)/hash.o\ + $(XML_INTDIR)/HTMLparser.o\ + $(XML_INTDIR)/HTMLtree.o\ + $(XML_INTDIR)/legacy.o\ + $(XML_INTDIR)/list.o\ + $(XML_INTDIR)/nanoftp.o\ + $(XML_INTDIR)/nanohttp.o\ + $(XML_INTDIR)/parser.o\ + $(XML_INTDIR)/parserInternals.o\ + $(XML_INTDIR)/pattern.o\ + $(XML_INTDIR)/relaxng.o\ + $(XML_INTDIR)/SAX.o\ + $(XML_INTDIR)/SAX2.o\ + $(XML_INTDIR)/threads.o\ + $(XML_INTDIR)/tree.o\ + $(XML_INTDIR)/uri.o\ + $(XML_INTDIR)/valid.o\ + $(XML_INTDIR)/xinclude.o\ + $(XML_INTDIR)/xlink.o\ + $(XML_INTDIR)/xmlIO.o\ + $(XML_INTDIR)/xmlmemory.o\ + $(XML_INTDIR)/xmlreader.o\ + $(XML_INTDIR)/xmlregexp.o\ + $(XML_INTDIR)/xmlmodule.o\ + $(XML_INTDIR)/xmlsave.o\ + $(XML_INTDIR)/xmlschemas.o\ + $(XML_INTDIR)/xmlschemastypes.o\ + $(XML_INTDIR)/xmlunicode.o\ + $(XML_INTDIR)/xmlwriter.o\ + $(XML_INTDIR)/xpath.o\ + $(XML_INTDIR)/xpointer.o\ + $(XML_INTDIR)/xmlstring.o + +XML_SRCS = $(subst .o,.c,$(subst $(XML_INTDIR)/,$(XML_SRCDIR)/,$(XML_OBJS))) + +# Static libxml object files. +XML_OBJS_A = $(XML_INTDIR_A)/c14n.o\ + $(XML_INTDIR_A)/catalog.o\ + $(XML_INTDIR_A)/chvalid.o\ + $(XML_INTDIR_A)/debugXML.o\ + $(XML_INTDIR_A)/dict.o\ + $(XML_INTDIR_A)/DOCBparser.o\ + $(XML_INTDIR_A)/encoding.o\ + $(XML_INTDIR_A)/entities.o\ + $(XML_INTDIR_A)/error.o\ + $(XML_INTDIR_A)/globals.o\ + $(XML_INTDIR_A)/hash.o\ + $(XML_INTDIR_A)/HTMLparser.o\ + $(XML_INTDIR_A)/HTMLtree.o\ + $(XML_INTDIR_A)/legacy.o\ + $(XML_INTDIR_A)/list.o\ + $(XML_INTDIR_A)/nanoftp.o\ + $(XML_INTDIR_A)/nanohttp.o\ + $(XML_INTDIR_A)/parser.o\ + $(XML_INTDIR_A)/parserInternals.o\ + $(XML_INTDIR_A)/pattern.o\ + $(XML_INTDIR_A)/relaxng.o\ + $(XML_INTDIR_A)/SAX.o\ + $(XML_INTDIR_A)/SAX2.o\ + $(XML_INTDIR_A)/threads.o\ + $(XML_INTDIR_A)/tree.o\ + $(XML_INTDIR_A)/uri.o\ + $(XML_INTDIR_A)/valid.o\ + $(XML_INTDIR_A)/xinclude.o\ + $(XML_INTDIR_A)/xlink.o\ + $(XML_INTDIR_A)/xmlIO.o\ + $(XML_INTDIR_A)/xmlmemory.o\ + $(XML_INTDIR_A)/xmlreader.o\ + $(XML_INTDIR_A)/xmlregexp.o\ + $(XML_INTDIR_A)/xmlmodule.o\ + $(XML_INTDIR_A)/xmlsave.o\ + $(XML_INTDIR_A)/xmlschemas.o\ + $(XML_INTDIR_A)/xmlschemastypes.o\ + $(XML_INTDIR_A)/xmlunicode.o\ + $(XML_INTDIR_A)/xmlwriter.o\ + $(XML_INTDIR_A)/xpath.o\ + $(XML_INTDIR_A)/xpointer.o\ + $(XML_INTDIR_A)/xmlstring.o + +XML_SRCS_A = $(subst .o,.c,$(subst $(XML_INTDIR_A)/,$(XML_SRCDIR)/,$(XML_OBJS_A))) + +# Xmllint and friends executables. +UTILS = $(BINDIR)/xmllint.exe\ + $(BINDIR)/xmlcatalog.exe\ + $(BINDIR)/testAutomata.exe\ + $(BINDIR)/testC14N.exe\ + $(BINDIR)/testDocbook.exe\ + $(BINDIR)/testHTML.exe\ + $(BINDIR)/testReader.exe\ + $(BINDIR)/testRegexp.exe\ + $(BINDIR)/testModule.exe\ + $(BINDIR)/testRelax.exe\ + $(BINDIR)/testSAX.exe\ + $(BINDIR)/testSchemas.exe\ + $(BINDIR)/testURI.exe\ + $(BINDIR)/testXPath.exe\ + $(BINDIR)/runtest.exe\ + $(BINDIR)/runsuite.exe +ifeq ($(WITH_THREADS),yes) +UTILS += $(BINDIR)/testThreadsWin32.exe +endif +ifeq ($(WITH_THREADS),ctls) +UTILS += $(BINDIR)/testThreadsWin32.exe +endif +ifeq ($(WITH_THREADS),native) +UTILS += $(BINDIR)/testThreadsWin32.exe +endif +ifeq ($(WITH_THREADS),posix) +UTILS += $(BINDIR)/testThreads.exe +endif + +all : dep libxml libxmla utils + +libxml : $(BINDIR)/$(XML_SO) + +libxmla : $(BINDIR)/$(XML_A) + +utils : $(UTILS) + +clean : + cmd.exe /C if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) + cmd.exe /C if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A) + cmd.exe /C if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) + cmd.exe /C if exist $(BINDIR) rmdir /S /Q $(BINDIR) + cmd.exe /C if exist depends.mingw del depends.mingw + +distclean : clean + cmd.exe /C if exist config.* del config.* + cmd.exe /C if exist Makefile del Makefile + +rebuild : clean all + +install-libs : all + cmd.exe /C if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml + cmd.exe /C if not exist $(BINPREFIX) mkdir $(BINPREFIX) + cmd.exe /C if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) + cmd.exe /C copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml + cmd.exe /C copy $(BINDIR)\$(XML_SO) $(SOPREFIX) + cmd.exe /C copy $(BINDIR)\$(XML_A) $(LIBPREFIX) + cmd.exe /C copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) + cmd.exe /C copy $(BINDIR)\xml*.exe $(BINPREFIX) + +install : install-libs + cmd.exe /C copy $(BINDIR)\*.exe $(BINPREFIX) + +install-dist : install-libs + cmd.exe /C copy $(BINDIR)\xml*.exe $(BINPREFIX) + +# This is a target for me, to make a binary distribution. Not for the public use, +# keep your hands off :-) +BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION) +BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32 +bindist : all + $(MAKE) PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)/bin install-dist + cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt + + +# Creates the dependency file +dep : + $(CC) $(CFLAGS) -M $(XML_SRCS) > depends.mingw + + +# Makes the output directory. +$(BINDIR) : + cmd.exe /C if not exist $(BINDIR) mkdir $(BINDIR) + + +# Makes the libxml intermediate directory. +$(XML_INTDIR) : + cmd.exe /C if not exist $(XML_INTDIR) mkdir $(XML_INTDIR) + +# Makes the static libxml intermediate directory. +$(XML_INTDIR_A) : + cmd.exe /C if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A) + +# An implicit rule for libxml compilation. +$(XML_INTDIR)/%.o : $(XML_SRCDIR)/%.c + $(CC) $(CFLAGS) -o $@ -c $< + +# An implicit rule for static libxml compilation. +$(XML_INTDIR_A)/%.o : $(XML_SRCDIR)/%.c + $(CC) $(CFLAGS) -DLIBXML_STATIC -o $@ -c $< + + +# Compiles libxml source. Uses the implicit rule for commands. +$(XML_OBJS) : $(XML_INTDIR) + +# Compiles static libxml source. Uses the implicit rule for commands. +$(XML_OBJS_A) : $(XML_INTDIR_A) + +# Creates the libxml shared object. +XMLSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(XML_IMP) +$(BINDIR)/$(XML_SO) : $(BINDIR) $(XML_OBJS) + $(LD) $(XMLSO_LDFLAGS) -o $(BINDIR)/$(XML_SO) $(XML_OBJS) $(LIBS) + +# Creates the libxml archive. +$(BINDIR)/$(XML_A) : $(BINDIR) $(XML_OBJS_A) + $(AR) $(ARFLAGS) $(BINDIR)\$(XML_A) $(XML_OBJS_A) + + +# Makes the utils intermediate directory. +$(UTILS_INTDIR) : + cmd.exe /C if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) + +# An implicit rule for xmllint and friends. +ifeq ($(STATIC),1) +$(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c + $(CC) -DLIBXML_STATIC $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$( 0) { + ret = write((int) (long) context, &buffer[0], len); + if (ret < 0) xmlIOErr(0, "write()"); + } return(ret); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -860,6 +862,28 @@ xmlFileFlush (void * context) { return(ret); } +#ifdef LIBXML_OUTPUT_ENABLED +/** + * xmlBufferWrite: + * @context: the xmlBuffer + * @buffer: the data to write + * @len: number of bytes to write + * + * Write @len bytes from @buffer to the xml buffer + * + * Returns the number of bytes written + */ +static int +xmlBufferWrite (void * context, const char * buffer, int len) { + int ret; + + ret = xmlBufferAdd((xmlBufferPtr) context, (const xmlChar *) buffer, len); + if (ret != 0) + return(-1); + return(len); +} +#endif + #ifdef HAVE_ZLIB_H /************************************************************************ * * @@ -2436,6 +2460,31 @@ xmlOutputBufferCreateFile(FILE *file, xmlCharEncodingHandlerPtr encoder) { return(ret); } + +/** + * xmlOutputBufferCreateBuffer: + * @buffer: a xmlBufferPtr + * @encoder: the encoding converter or NULL + * + * Create a buffered output for the progressive saving to a xmlBuffer + * + * Returns the new parser output or NULL + */ +xmlOutputBufferPtr +xmlOutputBufferCreateBuffer(xmlBufferPtr buffer, + xmlCharEncodingHandlerPtr encoder) { + xmlOutputBufferPtr ret; + + if (buffer == NULL) return(NULL); + + ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback) + xmlBufferWrite, + (xmlOutputCloseCallback) + NULL, (void *) buffer, encoder); + + return(ret); +} + #endif /* LIBXML_OUTPUT_ENABLED */ /** diff --git a/xmlmodule.c b/xmlmodule.c index 6cc86ee..15bcf07 100644 --- a/xmlmodule.c +++ b/xmlmodule.c @@ -195,6 +195,10 @@ xmlModuleFree(xmlModulePtr module) #include #endif +#ifndef RTLD_GLOBAL /* For Tru64 UNIX 4.0 */ +#define RTLD_GLOBAL 0 +#endif + /** * xmlModulePlatformOpen: * @name: path to the module @@ -277,10 +281,7 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) int rc; errno = 0; - rc = shl_findsym(handle, name, TYPE_PROCEDURE, symbol); - if ((-1 == rc) && (0 == errno)) { - rc = shl_findsym(handle, name, TYPE_DATA, symbol); - } + rc = shl_findsym(&handle, name, TYPE_UNDEFINED, symbol); return rc; } diff --git a/xmlreader.c b/xmlreader.c index 7efa273..0bdf071 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -131,12 +131,13 @@ struct _xmlTextReader { /* Handling of RelaxNG validation */ xmlRelaxNGPtr rngSchemas; /* The Relax NG schemas */ xmlRelaxNGValidCtxtPtr rngValidCtxt;/* The Relax NG validation context */ - int rngValidErrors;/* The number of errors detected */ + int rngValidErrors;/* The number of errors detected */ xmlNodePtr rngFullNode; /* the node if RNG not progressive */ /* Handling of Schemas validation */ xmlSchemaPtr xsdSchemas; /* The Schemas schemas */ xmlSchemaValidCtxtPtr xsdValidCtxt;/* The Schemas validation context */ - int xsdValidErrors;/* The number of errors detected */ + int xsdPreserveCtxt; /* 1 if the context was provided by the user */ + int xsdValidErrors;/* The number of errors detected */ xmlSchemaSAXPlugPtr xsdPlug; /* the schemas plug in SAX pipeline */ #endif #ifdef LIBXML_XINCLUDE_ENABLED @@ -1200,8 +1201,14 @@ xmlTextReaderCollectSiblings(xmlNodePtr node) case XML_CDATA_SECTION_NODE: xmlBufferCat(buffer, node->content); break; - case XML_ELEMENT_NODE: - xmlBufferCat(buffer, xmlTextReaderCollectSiblings(node->children)); + case XML_ELEMENT_NODE: { + xmlChar *tmp; + + tmp = xmlTextReaderCollectSiblings(node->children); + xmlBufferCat(buffer, tmp); + xmlFree(tmp); + break; + } default: break; } @@ -1619,6 +1626,7 @@ xmlTextReaderNext(xmlTextReaderPtr reader) { return(xmlTextReaderRead(reader)); } +#ifdef LIBXML_WRITER_ENABLED /** * xmlTextReaderReadInnerXml: * @reader: the xmlTextReaderPtr used @@ -1657,9 +1665,14 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) xmlBufferFree(buff2); } resbuf = buff->content; + buff->content = NULL; + + xmlBufferFree(buff); return resbuf; } +#endif +#ifdef LIBXML_WRITER_ENABLED /** * xmlTextReaderReadOuterXml: * @reader: the xmlTextReaderPtr used @@ -1698,6 +1711,7 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) xmlBufferFree(buff); return resbuf; } +#endif /** * xmlTextReaderReadString: @@ -2141,7 +2155,8 @@ xmlFreeTextReader(xmlTextReaderPtr reader) { reader->xsdPlug = NULL; } if (reader->xsdValidCtxt != NULL) { - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + if (! reader->xsdPreserveCtxt) + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); reader->xsdValidCtxt = NULL; } if (reader->xsdSchemas != NULL) { @@ -4086,15 +4101,17 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { reader->xsdPlug = NULL; } if (reader->xsdValidCtxt != NULL) { - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); - reader->xsdValidCtxt = NULL; + if (! reader->xsdPreserveCtxt) + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + reader->xsdValidCtxt = NULL; } + reader->xsdPreserveCtxt = 0; if (reader->xsdSchemas != NULL) { xmlSchemaFree(reader->xsdSchemas); reader->xsdSchemas = NULL; - } + } return(0); - } + } if (reader->mode != XML_TEXTREADER_MODE_INITIAL) return(-1); if (reader->xsdPlug != NULL) { @@ -4102,9 +4119,11 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { reader->xsdPlug = NULL; } if (reader->xsdValidCtxt != NULL) { - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + if (! reader->xsdPreserveCtxt) + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); reader->xsdValidCtxt = NULL; } + reader->xsdPreserveCtxt = 0; if (reader->xsdSchemas != NULL) { xmlSchemaFree(reader->xsdSchemas); reader->xsdSchemas = NULL; @@ -4221,81 +4240,106 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) { } /** - * xmlTextReaderSchemaValidate: + * xmlTextReaderSchemaValidateInternal: * @reader: the xmlTextReaderPtr used * @xsd: the path to a W3C XSD schema or NULL + * @ctxt: the XML Schema validation context or NULL + * @options: options (not used yet) * - * Use W3C XSD schema to validate the document as it is processed. + * Validate the document as it is processed using XML Schema. * Activation is only possible before the first Read(). - * if @xsd is NULL, then RelaxNG validation is desactivated. + * If both @xsd and @ctxt are NULL then XML Schema validation is deactivated. * - * Returns 0 in case the schemas validation could be (des)activated and + * Returns 0 in case the schemas validation could be (de)activated and * -1 in case of error. */ -int -xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) { - xmlSchemaParserCtxtPtr ctxt; - +static int +xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, + const char *xsd, + xmlSchemaValidCtxtPtr ctxt, + int options ATTRIBUTE_UNUSED) +{ if (reader == NULL) return(-1); - - if (xsd == NULL) { - if (reader->xsdPlug != NULL) { - xmlSchemaSAXUnplug(reader->xsdPlug); - reader->xsdPlug = NULL; - } - if (reader->xsdSchemas != NULL) { - xmlSchemaFree(reader->xsdSchemas); - reader->xsdSchemas = NULL; - } - if (reader->xsdValidCtxt != NULL) { - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); - reader->xsdValidCtxt = NULL; - } - return(0); - } - if ((reader->mode != XML_TEXTREADER_MODE_INITIAL) || - (reader->ctxt == NULL)) + + if ((xsd != NULL) && (ctxt != NULL)) + return(-1); + + if (((xsd != NULL) || (ctxt != NULL)) && + ((reader->mode != XML_TEXTREADER_MODE_INITIAL) || + (reader->ctxt == NULL))) return(-1); + + /* Cleanup previous validation stuff. */ if (reader->xsdPlug != NULL) { xmlSchemaSAXUnplug(reader->xsdPlug); reader->xsdPlug = NULL; } if (reader->xsdValidCtxt != NULL) { - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + if (! reader->xsdPreserveCtxt) + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); reader->xsdValidCtxt = NULL; } + reader->xsdPreserveCtxt = 0; if (reader->xsdSchemas != NULL) { xmlSchemaFree(reader->xsdSchemas); reader->xsdSchemas = NULL; + } + + if ((xsd == NULL) && (ctxt == NULL)) { + /* We just want to deactivate the validation, so get out. */ + return(0); + } + + if (xsd != NULL) { + xmlSchemaParserCtxtPtr pctxt; + /* Parse the schema and create validation environment. */ + pctxt = xmlSchemaNewParserCtxt(xsd); + if (reader->errorFunc != NULL) { + xmlSchemaSetParserErrors(pctxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + reader->xsdSchemas = xmlSchemaParse(pctxt); + xmlSchemaFreeParserCtxt(pctxt); + if (reader->xsdSchemas == NULL) + return(-1); + reader->xsdValidCtxt = xmlSchemaNewValidCtxt(reader->xsdSchemas); + if (reader->xsdValidCtxt == NULL) { + xmlSchemaFree(reader->xsdSchemas); + reader->xsdSchemas = NULL; + return(-1); + } + reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt, + &(reader->ctxt->sax), + &(reader->ctxt->userData)); + if (reader->xsdPlug == NULL) { + xmlSchemaFree(reader->xsdSchemas); + reader->xsdSchemas = NULL; + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + reader->xsdValidCtxt = NULL; + return(-1); + } + } else { + /* Use the given validation context. */ + reader->xsdValidCtxt = ctxt; + reader->xsdPreserveCtxt = 1; + reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt, + &(reader->ctxt->sax), + &(reader->ctxt->userData)); + if (reader->xsdPlug == NULL) { + reader->xsdValidCtxt = NULL; + reader->xsdPreserveCtxt = 0; + return(-1); + } } - ctxt = xmlSchemaNewParserCtxt(xsd); - if (reader->errorFunc != NULL) { - xmlSchemaSetParserErrors(ctxt, - xmlTextReaderValidityErrorRelay, - xmlTextReaderValidityWarningRelay, - reader); - } - reader->xsdSchemas = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - if (reader->xsdSchemas == NULL) - return(-1); - reader->xsdValidCtxt = xmlSchemaNewValidCtxt(reader->xsdSchemas); - if (reader->xsdValidCtxt == NULL) { - xmlSchemaFree(reader->xsdSchemas); - reader->xsdSchemas = NULL; - return(-1); - } - reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt, - &(reader->ctxt->sax), - &(reader->ctxt->userData)); - if (reader->xsdPlug == NULL) { - xmlSchemaFree(reader->xsdSchemas); - reader->xsdSchemas = NULL; - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); - reader->xsdValidCtxt = NULL; - return(-1); - } + /* + * Redirect the validation context's error channels to use + * the reader channels. + * TODO: In case the user provides the validation context we + * could make this redirection optional. + */ if (reader->errorFunc != NULL) { xmlSchemaSetValidErrors(reader->xsdValidCtxt, xmlTextReaderValidityErrorRelay, @@ -4311,6 +4355,45 @@ xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) { reader->validate = XML_TEXTREADER_VALIDATE_XSD; return(0); } + +/** + * xmlTextReaderSchemaValidateCtxt: + * @reader: the xmlTextReaderPtr used + * @ctxt: the XML Schema validation context or NULL + * @options: options (not used yet) + * + * Use W3C XSD schema context to validate the document as it is processed. + * Activation is only possible before the first Read(). + * If @ctxt is NULL, then XML Schema validation is deactivated. + * + * Returns 0 in case the schemas validation could be (de)activated and + * -1 in case of error. + */ +int +xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, + xmlSchemaValidCtxtPtr ctxt, + int options) +{ + return(xmlTextReaderSchemaValidateInternal(reader, NULL, ctxt, options)); +} + +/** + * xmlTextReaderSchemaValidate: + * @reader: the xmlTextReaderPtr used + * @xsd: the path to a W3C XSD schema or NULL + * + * Use W3C XSD schema to validate the document as it is processed. + * Activation is only possible before the first Read(). + * If @xsd is NULL, then XML Schema validation is deactivated. + * + * Returns 0 in case the schemas validation could be (de)activated and + * -1 in case of error. + */ +int +xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) +{ + return(xmlTextReaderSchemaValidateInternal(reader, xsd, NULL, 0)); +} #endif /** diff --git a/xmlregexp.c b/xmlregexp.c index 45b917b..de581f0 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -42,6 +42,8 @@ /* #define DEBUG_PUSH */ /* #define DEBUG_COMPACTION */ +#define MAX_PUSH 10000000 + #define ERROR(str) \ ctxt->error = XML_REGEXP_COMPILE_ERROR; \ xmlRegexpErrCompile(ctxt, str); @@ -73,20 +75,20 @@ typedef enum { XML_REGEXP_EPSILON = 1, XML_REGEXP_CHARVAL, XML_REGEXP_RANGES, - XML_REGEXP_SUBREG, + XML_REGEXP_SUBREG, /* used for () sub regexps */ XML_REGEXP_STRING, XML_REGEXP_ANYCHAR, /* . */ XML_REGEXP_ANYSPACE, /* \s */ XML_REGEXP_NOTSPACE, /* \S */ XML_REGEXP_INITNAME, /* \l */ - XML_REGEXP_NOTINITNAME, /* \l */ + XML_REGEXP_NOTINITNAME, /* \L */ XML_REGEXP_NAMECHAR, /* \c */ XML_REGEXP_NOTNAMECHAR, /* \C */ XML_REGEXP_DECIMAL, /* \d */ - XML_REGEXP_NOTDECIMAL, /* \d */ + XML_REGEXP_NOTDECIMAL, /* \D */ XML_REGEXP_REALCHAR, /* \w */ - XML_REGEXP_NOTREALCHAR, /* \w */ - XML_REGEXP_LETTER, + XML_REGEXP_NOTREALCHAR, /* \W */ + XML_REGEXP_LETTER = 100, XML_REGEXP_LETTER_UPPERCASE, XML_REGEXP_LETTER_LOWERCASE, XML_REGEXP_LETTER_TITLECASE, @@ -201,6 +203,7 @@ struct _xmlRegTrans { int to; int counter; int count; + int nd; }; struct _xmlAutomataState { @@ -326,6 +329,7 @@ struct _xmlRegExecCtxt { xmlRegStatePtr errState; /* the error state */ xmlChar *errString; /* the string raising the error */ int *errCounts; /* counters at the error state */ + int nbPush; }; #define REGEXP_ALL_COUNTER 0x123456 @@ -335,6 +339,9 @@ static void xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top); static void xmlRegFreeState(xmlRegStatePtr state); static void xmlRegFreeAtom(xmlRegAtomPtr atom); static int xmlRegStrEqualWildcard(const xmlChar *expStr, const xmlChar *valStr); +static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint); +static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, + int neg, int start, int end, const xmlChar *blockName); /************************************************************************ * * @@ -417,6 +424,9 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) { ret->nbCounters = ctxt->nbCounters; ret->counters = ctxt->counters; ret->determinist = ctxt->determinist; + if (ret->determinist == -1) { + xmlRegexpIsDeterminist(ret); + } if ((ret->determinist != 0) && (ret->nbCounters == 0) && @@ -569,7 +579,6 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) { i, j, trans->atom->no, trans->to, atomno, targetno); printf(" previous to is %d\n", prev); #endif - ret->determinist = 0; if (transdata != NULL) xmlFree(transdata); xmlFree(transitions); @@ -1016,6 +1025,12 @@ xmlRegPrintTrans(FILE *output, xmlRegTransPtr trans) { fprintf(output, "removed\n"); return; } + if (trans->nd != 0) { + if (trans->nd == 2) + fprintf(output, "last not determinist, "); + else + fprintf(output, "not determinist, "); + } if (trans->counter >= 0) { fprintf(output, "counted %d, ", trans->counter); } @@ -1235,7 +1250,7 @@ xmlRegStateAddTransTo(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr target, static void xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, xmlRegAtomPtr atom, xmlRegStatePtr target, - int counter, int count, int nchk) { + int counter, int count) { int nrtrans; @@ -1253,19 +1268,17 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, * so, silently ignore this request. */ - if (nchk == 0) { - for (nrtrans = state->nbTrans - 1; nrtrans >= 0; nrtrans--) { - xmlRegTransPtr trans = &(state->trans[nrtrans]); - if ((trans->atom == atom) && - (trans->to == target->no) && - (trans->counter == counter) && - (trans->count == count)) { + for (nrtrans = state->nbTrans - 1; nrtrans >= 0; nrtrans--) { + xmlRegTransPtr trans = &(state->trans[nrtrans]); + if ((trans->atom == atom) && + (trans->to == target->no) && + (trans->counter == counter) && + (trans->count == count)) { #ifdef DEBUG_REGEXP_GRAPH - printf("Ignoring duplicate transition from %d to %d\n", - state->no, target->no); + printf("Ignoring duplicate transition from %d to %d\n", + state->no, target->no); #endif - return; - } + return; } } @@ -1308,6 +1321,7 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, state->trans[state->nbTrans].to = target->no; state->trans[state->nbTrans].counter = counter; state->trans[state->nbTrans].count = count; + state->trans[state->nbTrans].nd = 0; state->nbTrans++; xmlRegStateAddTransTo(ctxt, target, state->no); } @@ -1359,9 +1373,9 @@ xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt, ctxt->state = to; } if (lax) - xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER, 0); + xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER); else - xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER, 0); + xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER); } /** @@ -1379,7 +1393,7 @@ xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt, xmlRegStatePush(ctxt, to); ctxt->state = to; } - xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1, 0); + xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1); } /** @@ -1398,7 +1412,7 @@ xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt, xmlRegStatePush(ctxt, to); ctxt->state = to; } - xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1, 0); + xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1); } /** @@ -1417,7 +1431,7 @@ xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt, xmlRegStatePush(ctxt, to); ctxt->state = to; } - xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter, 0); + xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter); } /** @@ -1450,6 +1464,14 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, * Generate an epsilon transition to link to the target */ xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); +#ifdef DV + } else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) && + (atom->quant != XML_REGEXP_QUANT_ONCE)) { + to = xmlRegNewState(ctxt); + xmlRegStatePush(ctxt, to); + ctxt->state = to; + xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); +#endif } switch (atom->quant) { case XML_REGEXP_QUANT_OPT: @@ -1504,8 +1526,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, } else { newstate = xmlRegNewState(ctxt); xmlRegStatePush(ctxt, newstate); - ctxt->state = newstate; } + ctxt->state = newstate; xmlFAGenerateCountedTransition(ctxt, atom->stop, newstate, counter); } @@ -1513,7 +1535,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, break; } return(0); - } else if ((atom->min == 0) && (atom->max == 0) && + } + if ((atom->min == 0) && (atom->max == 0) && (atom->quant == XML_REGEXP_QUANT_RANGE)) { /* * we can discard the atom and generate an epsilon transition instead @@ -1530,21 +1553,20 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, ctxt->state = to; xmlRegFreeAtom(atom); return(0); - } else { - if (to == NULL) { - to = xmlRegNewState(ctxt); - if (to != NULL) - xmlRegStatePush(ctxt, to); - else { - return(-1); - } - } - if (xmlRegAtomPush(ctxt, atom) < 0) { + } + if (to == NULL) { + to = xmlRegNewState(ctxt); + if (to != NULL) + xmlRegStatePush(ctxt, to); + else { return(-1); } - xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1, 0); - ctxt->state = to; } + if (xmlRegAtomPush(ctxt, atom) < 0) { + return(-1); + } + xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); + ctxt->state = to; switch (atom->quant) { case XML_REGEXP_QUANT_OPT: atom->quant = XML_REGEXP_QUANT_ONCE; @@ -1553,11 +1575,11 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, case XML_REGEXP_QUANT_MULT: atom->quant = XML_REGEXP_QUANT_ONCE; xmlFAGenerateEpsilonTransition(ctxt, from, to); - xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1, 0); + xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); break; case XML_REGEXP_QUANT_PLUS: atom->quant = XML_REGEXP_QUANT_ONCE; - xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1, 0); + xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); break; default: break; @@ -1614,7 +1636,7 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, xmlRegStateAddTrans(ctxt, from, NULL, ctxt->states[newto], - -1, to->trans[transnr].count, 0); + -1, to->trans[transnr].count); } else { #ifdef DEBUG_REGEXP_GRAPH printf("Found epsilon trans %d from %d to %d\n", @@ -1637,10 +1659,10 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, if (to->trans[transnr].counter >= 0) { xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, ctxt->states[newto], - to->trans[transnr].counter, -1, 1); + to->trans[transnr].counter, -1); } else { xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, - ctxt->states[newto], counter, -1, 1); + ctxt->states[newto], counter, -1); } } } @@ -1869,12 +1891,175 @@ xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { } +static int +xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) { + int ret = 0; + + if ((range1->type == XML_REGEXP_RANGES) || + (range2->type == XML_REGEXP_RANGES) || + (range2->type == XML_REGEXP_SUBREG) || + (range1->type == XML_REGEXP_SUBREG) || + (range1->type == XML_REGEXP_STRING) || + (range2->type == XML_REGEXP_STRING)) + return(-1); + + /* put them in order */ + if (range1->type > range2->type) { + xmlRegRangePtr tmp; + + tmp = range1; + range1 = range2; + range2 = tmp; + } + if ((range1->type == XML_REGEXP_ANYCHAR) || + (range2->type == XML_REGEXP_ANYCHAR)) { + ret = 1; + } else if ((range1->type == XML_REGEXP_EPSILON) || + (range2->type == XML_REGEXP_EPSILON)) { + return(0); + } else if (range1->type == range2->type) { + if ((range1->type != XML_REGEXP_CHARVAL) || + (range1->end < range2->start) || + (range2->end < range1->start)) + ret = 1; + else + ret = 0; + } else if (range1->type == XML_REGEXP_CHARVAL) { + int codepoint; + int neg = 0; + + /* + * just check all codepoints in the range for acceptance, + * this is usually way cheaper since done only once at + * compilation than testing over and over at runtime or + * pushing too many states when evaluating. + */ + if (((range1->neg == 0) && (range2->neg != 0)) || + ((range1->neg != 0) && (range2->neg == 0))) + neg = 1; + + for (codepoint = range1->start;codepoint <= range1->end ;codepoint++) { + ret = xmlRegCheckCharacterRange(range2->type, codepoint, + 0, range2->start, range2->end, + range2->blockName); + if (ret < 0) + return(-1); + if (((neg == 1) && (ret == 0)) || + ((neg == 0) && (ret == 1))) + return(1); + } + return(0); + } else if ((range1->type == XML_REGEXP_BLOCK_NAME) || + (range2->type == XML_REGEXP_BLOCK_NAME)) { + if (range1->type == range2->type) { + ret = xmlStrEqual(range1->blockName, range2->blockName); + } else { + /* + * comparing a block range with anything else is way + * too costly, and maintining the table is like too much + * memory too, so let's force the automata to save state + * here. + */ + return(1); + } + } else if ((range1->type < XML_REGEXP_LETTER) || + (range2->type < XML_REGEXP_LETTER)) { + if ((range1->type == XML_REGEXP_ANYSPACE) && + (range2->type == XML_REGEXP_NOTSPACE)) + ret = 0; + else if ((range1->type == XML_REGEXP_INITNAME) && + (range2->type == XML_REGEXP_NOTINITNAME)) + ret = 0; + else if ((range1->type == XML_REGEXP_NAMECHAR) && + (range2->type == XML_REGEXP_NOTNAMECHAR)) + ret = 0; + else if ((range1->type == XML_REGEXP_DECIMAL) && + (range2->type == XML_REGEXP_NOTDECIMAL)) + ret = 0; + else if ((range1->type == XML_REGEXP_REALCHAR) && + (range2->type == XML_REGEXP_NOTREALCHAR)) + ret = 0; + else { + /* same thing to limit complexity */ + return(1); + } + } else { + ret = 0; + /* range1->type < range2->type here */ + switch (range1->type) { + case XML_REGEXP_LETTER: + /* all disjoint except in the subgroups */ + if ((range2->type == XML_REGEXP_LETTER_UPPERCASE) || + (range2->type == XML_REGEXP_LETTER_LOWERCASE) || + (range2->type == XML_REGEXP_LETTER_TITLECASE) || + (range2->type == XML_REGEXP_LETTER_MODIFIER) || + (range2->type == XML_REGEXP_LETTER_OTHERS)) + ret = 1; + break; + case XML_REGEXP_MARK: + if ((range2->type == XML_REGEXP_MARK_NONSPACING) || + (range2->type == XML_REGEXP_MARK_SPACECOMBINING) || + (range2->type == XML_REGEXP_MARK_ENCLOSING)) + ret = 1; + break; + case XML_REGEXP_NUMBER: + if ((range2->type == XML_REGEXP_NUMBER_DECIMAL) || + (range2->type == XML_REGEXP_NUMBER_LETTER) || + (range2->type == XML_REGEXP_NUMBER_OTHERS)) + ret = 1; + break; + case XML_REGEXP_PUNCT: + if ((range2->type == XML_REGEXP_PUNCT_CONNECTOR) || + (range2->type == XML_REGEXP_PUNCT_DASH) || + (range2->type == XML_REGEXP_PUNCT_OPEN) || + (range2->type == XML_REGEXP_PUNCT_CLOSE) || + (range2->type == XML_REGEXP_PUNCT_INITQUOTE) || + (range2->type == XML_REGEXP_PUNCT_FINQUOTE) || + (range2->type == XML_REGEXP_PUNCT_OTHERS)) + ret = 1; + break; + case XML_REGEXP_SEPAR: + if ((range2->type == XML_REGEXP_SEPAR_SPACE) || + (range2->type == XML_REGEXP_SEPAR_LINE) || + (range2->type == XML_REGEXP_SEPAR_PARA)) + ret = 1; + break; + case XML_REGEXP_SYMBOL: + if ((range2->type == XML_REGEXP_SYMBOL_MATH) || + (range2->type == XML_REGEXP_SYMBOL_CURRENCY) || + (range2->type == XML_REGEXP_SYMBOL_MODIFIER) || + (range2->type == XML_REGEXP_SYMBOL_OTHERS)) + ret = 1; + break; + case XML_REGEXP_OTHER: + if ((range2->type == XML_REGEXP_OTHER_CONTROL) || + (range2->type == XML_REGEXP_OTHER_FORMAT) || + (range2->type == XML_REGEXP_OTHER_PRIVATE)) + ret = 1; + break; + default: + if ((range2->type >= XML_REGEXP_LETTER) && + (range2->type < XML_REGEXP_BLOCK_NAME)) + ret = 0; + else { + /* safety net ! */ + return(1); + } + } + } + if (((range1->neg == 0) && (range2->neg != 0)) || + ((range1->neg != 0) && (range2->neg == 0))) + ret = !ret; + return(1); +} + /** * xmlFACompareAtoms: * @atom1: an atom * @atom2: an atom * - * Compares two atoms to check whether they are equivalents + * Compares two atoms to check whether they intersect in some ways, + * this is used by xmlFAComputesDeterminism only * * Returns 1 if yes and 0 otherwise */ @@ -1887,28 +2072,65 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { if ((atom1 == NULL) || (atom2 == NULL)) return(0); - if (atom1->type != atom2->type) + if ((atom1->type == XML_REGEXP_RANGES) && + (atom2->type == XML_REGEXP_CHARVAL)) { + } else if ((atom1->type == XML_REGEXP_CHARVAL) && + (atom2->type == XML_REGEXP_RANGES)) { + xmlRegAtomPtr tmp; + tmp = atom1; + atom1 = atom2; + atom2 = tmp; + } else if (atom1->type != atom2->type) { return(0); + } switch (atom1->type) { case XML_REGEXP_STRING: ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep, (xmlChar *)atom2->valuep); break; case XML_REGEXP_EPSILON: - return(1); + goto not_determinist; case XML_REGEXP_CHARVAL: - ret = atom1->codepoint == atom2->codepoint; + ret = (atom1->codepoint == atom2->codepoint); break; case XML_REGEXP_RANGES: - TODO; - return(0); + if (atom2->type == XML_REGEXP_CHARVAL) { + ret = xmlRegCheckCharacter(atom1, atom2->codepoint); + if (ret < 0) + return(-1); + break; + } else { + int i, j, res; + xmlRegRangePtr r1, r2; + + /* + * need to check that none of the ranges eventually matches + */ + for (i = 0;i < atom1->nbRanges;i++) { + for (j = 0;j < atom2->nbRanges;j++) { + r1 = atom1->ranges[i]; + r2 = atom2->ranges[j]; + res = xmlFACompareRanges(r1, r2); + if (res == 1) { + ret = 1; + goto done; + } + } + } + ret = 0; + } + break; default: - return(1); + goto not_determinist; } +done: if (atom1->neg != atom2->neg) { ret = !ret; } - return(ret); + if (ret == 0) + return(0); +not_determinist: + return(1); } /** @@ -1923,12 +2145,18 @@ static int xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, int to, xmlRegAtomPtr atom) { int ret = 1; - int transnr; + int res; + int transnr, nbTrans; xmlRegTransPtr t1; if (state == NULL) return(ret); - for (transnr = 0;transnr < state->nbTrans;transnr++) { + /* + * don't recurse on transitions potentially added in the course of + * the elimination. + */ + nbTrans = state->nbTrans; + for (transnr = 0;transnr < nbTrans;transnr++) { t1 = &(state->trans[transnr]); /* * check transitions conflicting with the one looked at @@ -1936,16 +2164,21 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, if (t1->atom == NULL) { if (t1->to == -1) continue; - ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], + res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], to, atom); - if (ret == 0) - return(0); + if (res == 0) { + ret = 0; + /* t1->nd = 1; */ + } continue; } if (t1->to != to) continue; - if (xmlFACompareAtoms(t1->atom, atom)) - return(0); + if (xmlFACompareAtoms(t1->atom, atom)) { + ret = 0; + /* mark the transition as non-deterministic */ + t1->nd = 1; + } } return(ret); } @@ -1962,7 +2195,7 @@ static int xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { int statenr, transnr; xmlRegStatePtr state; - xmlRegTransPtr t1, t2; + xmlRegTransPtr t1, t2, last; int i; int ret = 1; @@ -1974,8 +2207,7 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { return(ctxt->determinist); /* - * Check for all states that there aren't 2 transitions - * with the same atom and a different target. + * First cleanup the automata removing cancelled transitions */ for (statenr = 0;statenr < ctxt->nbStates;statenr++) { state = ctxt->states[statenr]; @@ -1989,8 +2221,10 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { * Determinism checks in case of counted or all transitions * will have to be handled separately */ - if (t1->atom == NULL) + if (t1->atom == NULL) { + /* t1->nd = 1; */ continue; + } if (t1->to == -1) /* eliminated */ continue; for (i = 0;i < transnr;i++) { @@ -2001,10 +2235,46 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { if (t1->to == t2->to) { if (xmlFACompareAtoms(t1->atom, t2->atom)) t2->to = -1; /* eliminated */ - } else { - /* not determinist ! */ - if (xmlFACompareAtoms(t1->atom, t2->atom)) - ret = 0; + } + } + } + } + } + + /* + * Check for all states that there aren't 2 transitions + * with the same atom and a different target. + */ + for (statenr = 0;statenr < ctxt->nbStates;statenr++) { + state = ctxt->states[statenr]; + if (state == NULL) + continue; + if (state->nbTrans < 2) + continue; + last = NULL; + for (transnr = 0;transnr < state->nbTrans;transnr++) { + t1 = &(state->trans[transnr]); + /* + * Determinism checks in case of counted or all transitions + * will have to be handled separately + */ + if (t1->atom == NULL) { + continue; + } + if (t1->to == -1) /* eliminated */ + continue; + for (i = 0;i < transnr;i++) { + t2 = &(state->trans[i]); + if (t2->to == -1) /* eliminated */ + continue; + if (t2->atom != NULL) { + /* not determinist ! */ + if (xmlFACompareAtoms(t1->atom, t2->atom)) { + ret = 0; + /* mark the transitions as non-deterministic ones */ + t1->nd = 1; + t2->nd = 1; + last = t1; } } else if (t1->to != -1) { /* @@ -2013,16 +2283,39 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { */ ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], t2->to, t2->atom); + /* don't shortcut the computation so all non deterministic + transition get marked down if (ret == 0) return(0); + */ + if (ret == 0) { + t1->nd = 1; + /* t2->nd = 1; */ + last = t1; + } } } + /* don't shortcut the computation so all non deterministic + transition get marked down if (ret == 0) - break; + break; */ + } + + /* + * mark specifically the last non-deterministic transition + * from a state since there is no need to set-up rollback + * from it + */ + if (last != NULL) { + last->nd = 2; } + + /* don't shortcut the computation so all non deterministic + transition get marked down if (ret == 0) - break; + break; */ } + ctxt->determinist = ret; return(ret); } @@ -2336,6 +2629,12 @@ xmlFARegExecSave(xmlRegExecCtxtPtr exec) { xmlFARegDebugExec(exec); exec->transno--; #endif +#ifdef MAX_PUSH + if (exec->nbPush > MAX_PUSH) { + return; + } + exec->nbPush++; +#endif if (exec->maxRollbacks == 0) { exec->maxRollbacks = 4; @@ -2422,10 +2721,11 @@ static int xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { xmlRegExecCtxt execval; xmlRegExecCtxtPtr exec = &execval; - int ret, codepoint = 0, len; + int ret, codepoint = 0, len, deter; exec->inputString = content; exec->index = 0; + exec->nbPush = 0; exec->determinist = 1; exec->maxRollbacks = 0; exec->nbRollbacks = 0; @@ -2482,6 +2782,7 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { continue; atom = trans->atom; ret = 0; + deter = 1; if (trans->count >= 0) { int count; xmlRegCounterPtr counter; @@ -2497,6 +2798,8 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { trans->count, count, counter->min, counter->max); #endif ret = ((count >= counter->min) && (count <= counter->max)); + if ((ret) && (counter->min != counter->max)) + deter = 0; } else if (atom == NULL) { fprintf(stderr, "epsilon transition left at runtime\n"); exec->status = -2; @@ -2509,7 +2812,15 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { /* * this is a multiple input sequence + * If there is a counter associated increment it now. + * before potentially saving and rollback */ + if (trans->counter >= 0) { +#ifdef DEBUG_REGEXP_EXEC + printf("Increasing count %d\n", trans->counter); +#endif + exec->counts[trans->counter]++; + } if (exec->state->nbTrans > exec->transno + 1) { xmlFARegExecSave(exec); } @@ -2559,6 +2870,12 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { if (ret == 0) { goto rollback; } + if (trans->counter >= 0) { +#ifdef DEBUG_REGEXP_EXEC + printf("Decreasing count %d\n", trans->counter); +#endif + exec->counts[trans->counter]--; + } } else if ((ret == 0) && (atom->min == 0) && (atom->max > 0)) { /* * we don't match on the codepoint, but minOccurs of 0 @@ -2576,7 +2893,17 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { ret = 1; } if (ret == 1) { - if (exec->state->nbTrans > exec->transno + 1) { + if ((trans->nd == 1) || + ((trans->count >= 0) && (deter == 0) && + (exec->state->nbTrans > exec->transno + 1))) { +#ifdef DEBUG_REGEXP_EXEC + if (trans->nd == 1) + printf("Saving on nd transition atom %d for %c at %d\n", + trans->atom->no, codepoint, exec->index); + else + printf("Saving on counted transition count %d for %c at %d\n", + trans->count, codepoint, exec->index); +#endif xmlFARegExecSave(exec); } if (trans->counter >= 0) { @@ -2613,6 +2940,10 @@ rollback: * Failed to find a way out */ exec->determinist = 0; +#ifdef DEBUG_REGEXP_EXEC + printf("rollback from state %d on %d:%c\n", exec->state->no, + codepoint,codepoint); +#endif xmlFARegExecRollBack(exec); } progress: @@ -2632,8 +2963,11 @@ progress: xmlFree(exec->counts); if (exec->status == 0) return(1); - if (exec->status == -1) + if (exec->status == -1) { + if (exec->nbPush > MAX_PUSH) + return(-1); return(0); + } return(exec->status); } @@ -2708,6 +3042,7 @@ xmlRegNewExecCtxt(xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data) { exec->inputStack = NULL; exec->errStateNo = -1; exec->errString = NULL; + exec->nbPush = 0; return(exec); } @@ -3344,7 +3679,7 @@ xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, ret = xmlRegExecPushStringInternal(exec, str, data, 1); if (str != buf) - xmlFree(buf); + xmlFree(str); return(ret); } @@ -4784,11 +5119,11 @@ xmlNewAutomata(void) { /* initialize the parser */ ctxt->end = NULL; ctxt->start = ctxt->state = xmlRegNewState(ctxt); - ctxt->start->type = XML_REGEXP_START_STATE; if (ctxt->start == NULL) { xmlFreeAutomata(ctxt); return(NULL); } + ctxt->start->type = XML_REGEXP_START_STATE; if (xmlRegStatePush(ctxt, ctxt->start) < 0) { xmlRegFreeState(ctxt->start); xmlFreeAutomata(ctxt); @@ -5081,7 +5416,7 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from, to = xmlRegNewState(am); xmlRegStatePush(am, to); } - xmlRegStateAddTrans(am, from, atom, to, counter, -1, 0); + xmlRegStateAddTrans(am, from, atom, to, counter, -1); xmlRegAtomPush(am, atom); am->state = to; @@ -5147,7 +5482,7 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, to = xmlRegNewState(am); xmlRegStatePush(am, to); } - xmlRegStateAddTrans(am, from, atom, to, counter, -1, 0); + xmlRegStateAddTrans(am, from, atom, to, counter, -1); xmlRegAtomPush(am, atom); am->state = to; @@ -5236,7 +5571,7 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from, to = xmlRegNewState(am); xmlRegStatePush(am, to); } - xmlRegStateAddTrans(am, from, atom, to, counter, -1, 0); + xmlRegStateAddTrans(am, from, atom, to, counter, -1); xmlRegAtomPush(am, atom); am->state = to; return(to); @@ -5298,7 +5633,7 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, to = xmlRegNewState(am); xmlRegStatePush(am, to); } - xmlRegStateAddTrans(am, from, atom, to, counter, -1, 0); + xmlRegStateAddTrans(am, from, atom, to, counter, -1); xmlRegAtomPush(am, atom); am->state = to; return(to); @@ -6134,7 +6469,7 @@ tail: * xmlExpGetLanguage: * @ctxt: the expression context * @exp: the expression - * @list: where to store the tokens + * @langList: where to store the tokens * @len: the allocated lenght of @list * * Find all the strings used in @exp and store them in @list @@ -6144,10 +6479,10 @@ tail: */ int xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, - const xmlChar**list, int len) { - if ((ctxt == NULL) || (exp == NULL) || (list == NULL) || (len <= 0)) + const xmlChar**langList, int len) { + if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0)) return(-1); - return(xmlExpGetLanguageInt(ctxt, exp, list, len, 0)); + return(xmlExpGetLanguageInt(ctxt, exp, langList, len, 0)); } static int @@ -6200,7 +6535,7 @@ tail: * xmlExpGetStart: * @ctxt: the expression context * @exp: the expression - * @list: where to store the tokens + * @tokList: where to store the tokens * @len: the allocated lenght of @list * * Find all the strings that appears at the start of the languages @@ -6212,10 +6547,10 @@ tail: */ int xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, - const xmlChar**list, int len) { - if ((ctxt == NULL) || (exp == NULL) || (list == NULL) || (len <= 0)) + const xmlChar**tokList, int len) { + if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0)) return(-1); - return(xmlExpGetStartInt(ctxt, exp, list, len, 0)); + return(xmlExpGetStartInt(ctxt, exp, tokList, len, 0)); } /** @@ -6861,10 +7196,10 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); while (len < 0) { const xmlChar **temp; - temp = (const xmlChar **) xmlRealloc(tab, ctxt->tabSize * 2 * + temp = (const xmlChar **) xmlRealloc((xmlChar **) tab, ctxt->tabSize * 2 * sizeof(const xmlChar *)); if (temp == NULL) { - xmlFree(tab); + xmlFree((xmlChar **) tab); return(NULL); } tab = temp; @@ -6875,14 +7210,14 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]); if ((tmp == NULL) || (tmp == forbiddenExp)) { xmlExpFree(ctxt, ret); - xmlFree(tab); + xmlFree((xmlChar **) tab); return(tmp); } tmp2 = xmlExpStringDeriveInt(ctxt, sub, tab[i]); if ((tmp2 == NULL) || (tmp2 == forbiddenExp)) { xmlExpFree(ctxt, tmp); xmlExpFree(ctxt, ret); - xmlFree(tab); + xmlFree((xmlChar **) tab); return(tmp); } tmp3 = xmlExpExpDeriveInt(ctxt, tmp, tmp2); @@ -6891,7 +7226,7 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { if ((tmp3 == NULL) || (tmp3 == forbiddenExp)) { xmlExpFree(ctxt, ret); - xmlFree(tab); + xmlFree((xmlChar **) tab); return(tmp3); } @@ -6900,12 +7235,12 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { else { ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, tmp3, NULL, 0, 0); if (ret == NULL) { - xmlFree(tab); + xmlFree((xmlChar **) tab); return(NULL); } } } - xmlFree(tab); + xmlFree((xmlChar **) tab); return(ret); } diff --git a/xmlsave.c b/xmlsave.c index ca1d876..ba35f32 100644 --- a/xmlsave.c +++ b/xmlsave.c @@ -344,9 +344,9 @@ xmlSaveCtxtInit(xmlSaveCtxtPtr ctxt) ctxt->indent[ctxt->indent_nr * ctxt->indent_size] = 0; } - if (xmlSaveNoEmptyTags) { - ctxt->options |= XML_SAVE_NO_EMPTY; - } + if (xmlSaveNoEmptyTags) { + ctxt->options |= XML_SAVE_NO_EMPTY; + } } /** @@ -400,10 +400,10 @@ xmlNewSaveCtxt(const char *encoding, int options) * Use the options */ - /* Re-check this option as it may already have been set */ - if ((ret->options & XML_SAVE_NO_EMPTY) && ! (options & XML_SAVE_NO_EMPTY)) { - options |= XML_SAVE_NO_EMPTY; - } + /* Re-check this option as it may already have been set */ + if ((ret->options & XML_SAVE_NO_EMPTY) && ! (options & XML_SAVE_NO_EMPTY)) { + options |= XML_SAVE_NO_EMPTY; + } ret->options = options; if (options & XML_SAVE_FORMAT) @@ -1111,6 +1111,10 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur); return; } + if (cur->type == XML_DOCUMENT_FRAG_NODE) { + xhtmlNodeListDumpOutput(ctxt, cur->children); + return; + } buf = ctxt->buf; if (cur->type == XML_ELEMENT_DECL) { xmlDumpElementDecl(buf->buffer, (xmlElementPtr) cur); @@ -1473,13 +1477,36 @@ xmlSaveToFilename(const char *filename, const char *encoding, int options) * with the encoding and the options given * * Returns a new serialization context or NULL in case of error. + */ + xmlSaveCtxtPtr xmlSaveToBuffer(xmlBufferPtr buffer, const char *encoding, int options) { - TODO - return(NULL); + xmlSaveCtxtPtr ret; + xmlOutputBufferPtr out_buff; + xmlCharEncodingHandlerPtr handler; + + ret = xmlNewSaveCtxt(encoding, options); + if (ret == NULL) return(NULL); + + if (encoding != NULL) { + handler = xmlFindCharEncodingHandler(encoding); + if (handler == NULL) { + xmlFree(ret); + return(NULL); + } + } else + handler = NULL; + out_buff = xmlOutputBufferCreateBuffer(buffer, handler); + if (out_buff == NULL) { + xmlFree(ret); + if (handler) xmlCharEncCloseFunc(handler); + return(NULL); + } + + ret->buf = out_buff; + return(ret); } - */ /** * xmlSaveToIO: diff --git a/xmlschemas.c b/xmlschemas.c index abc4802..0da3564 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -17,10 +17,32 @@ * against their types. * - Eliminate item creation for: ?? * + * URGENT TODO: + * - For xsi-driven schema acquisition, augment the IDCs after every + * acquisition episode (xmlSchemaAugmentIDC). + * * NOTES: * - Elimated item creation for: , , * , , , * + * PROBLEMS: + * - http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0337.html + * IDC XPath expression and chameleon includes: the targetNamespace is changed, so + * XPath will have trouble to resolve to this namespace, since not known. + * + * + * CONSTRAINTS: + * + * Schema Component Constraint: + * All Group Limited (cos-all-limited) + * Status: complete + * (1.2) + * In xmlSchemaGroupDefReferenceTermFixup() and + * (2) + * In xmlSchemaParseModelGroup() + * TODO: Actually this should go to component-level checks, + * but is done here due to performance. Move it to an other layer + * is schema construction via an API is implemented. */ #define IN_LIBXML #include "libxml.h" @@ -58,20 +80,24 @@ /* #define DEBUG_AUTOMATA 1 */ -#define DEBUG_ATTR_VALIDATION 0 +/* #define DEBUG_IDC */ -/* #define DEBUG_IDC 1 */ +/* #define DEBUG_IDC_NODE_TABLE */ -/* #define DEBUG_INCLUDES 1 */ +#ifdef DEBUG_IDC + #ifndef DEBUG_IDC_NODE_TABLE + #define DEBUG_IDC_NODE_TABLE + #endif +#endif /* #define ENABLE_PARTICLE_RESTRICTION 1 */ -/* #define ENABLE_SCHEMA_SPACES */ - -/* #define ENABLE_REDEFINE */ +#define ENABLE_REDEFINE /* #define ENABLE_NAMED_LOCALS */ +/* #define ENABLE_IDC_NODE_TABLES_TEST */ + #define DUMP_CONTENT_MODEL #ifdef LIBXML_READER_ENABLED @@ -98,101 +124,160 @@ static const xmlChar *xmlSchemaInstanceNs = (const xmlChar *) static const xmlChar *xmlNamespaceNs = (const xmlChar *) "http://www.w3.org/2000/xmlns/"; -static const xmlChar *xmlSchemaElemDesElemDecl = (const xmlChar *) - "element decl."; -static const xmlChar *xmlSchemaElemDesAttrDecl = (const xmlChar *) - "attribute decl."; -static const xmlChar *xmlSchemaElemDesAttrRef = (const xmlChar *) - "attribute use"; -static const xmlChar *xmlSchemaElemModelGrDef = (const xmlChar *) - "model group"; - -#define IS_SCHEMA(node, type) \ - ((node != NULL) && (node->ns != NULL) && \ - (xmlStrEqual(node->name, (const xmlChar *) type)) && \ - (xmlStrEqual(node->ns->href, xmlSchemaNs))) +/* +* Come casting macros. +*/ +#define ACTXT_CAST (xmlSchemaAbstractCtxtPtr) +#define PCTXT_CAST (xmlSchemaParserCtxtPtr) +#define VCTXT_CAST (xmlSchemaValidCtxtPtr) +#define WXS_BASIC_CAST (xmlSchemaBasicItemPtr) +#define WXS_TREE_CAST (xmlSchemaTreeItemPtr) +#define WXS_PTC_CAST (xmlSchemaParticlePtr) +#define WXS_TYPE_CAST (xmlSchemaTypePtr) +#define WXS_ELEM_CAST (xmlSchemaElementPtr) +#define WXS_ATTR_GROUP_CAST (xmlSchemaAttributeGroupPtr) +#define WXS_ATTR_CAST (xmlSchemaAttributePtr) +#define WXS_ATTR_USE_CAST (xmlSchemaAttributeUsePtr) +#define WXS_ATTR_PROHIB_CAST (xmlSchemaAttributeUseProhibPtr) +#define WXS_MODEL_GROUPDEF_CAST (xmlSchemaModelGroupDefPtr) +#define WXS_MODEL_GROUP_CAST (xmlSchemaModelGroupPtr) +#define WXS_IDC_CAST (xmlSchemaIDCPtr) +#define WXS_QNAME_CAST (xmlSchemaQNameRefPtr) +#define WXS_LIST_CAST (xmlSchemaItemListPtr) -#define FREE_AND_NULL(str) \ - if (str != NULL) { \ - xmlFree((xmlChar *) str); \ - str = NULL; \ - } +/* +* Macros to query common properties of components. +*/ +#define WXS_ITEM_NODE(i) xmlSchemaGetComponentNode(WXS_BASIC_CAST (i)) -#define IS_ANYTYPE(item) \ - ((item->type == XML_SCHEMA_TYPE_BASIC) && \ - (item->builtInType == XML_SCHEMAS_ANYTYPE)) +#define WXS_ITEM_TYPE_NAME(i) xmlSchemaGetComponentTypeStr(WXS_BASIC_CAST (i)) +/* +* Macros for element declarations. +*/ +#define WXS_ELEM_TYPEDEF(e) (e)->subtypes -#define IS_COMPLEX_TYPE(item) \ - ((item->type == XML_SCHEMA_TYPE_COMPLEX) || \ - (item->builtInType == XML_SCHEMAS_ANYTYPE)) +#define WXS_SUBST_HEAD(item) (item)->refDecl +/* +* Macros for attribute declarations. +*/ +#define WXS_ATTR_TYPEDEF(a) (a)->subtypes +/* +* Macros for attribute uses. +*/ +#define WXS_ATTRUSE_DECL(au) WXS_ATTR_CAST (WXS_ATTR_USE_CAST (au))->attrDecl -#define IS_SIMPLE_TYPE(item) \ - ((item->type == XML_SCHEMA_TYPE_SIMPLE) || \ - ((item->type == XML_SCHEMA_TYPE_BASIC) && \ - (item->builtInType != XML_SCHEMAS_ANYTYPE))) +#define WXS_ATTRUSE_TYPEDEF(au) WXS_ATTR_TYPEDEF(WXS_ATTRUSE_DECL( WXS_ATTR_USE_CAST au)) -#define IS_ANY_SIMPLE_TYPE(item) \ - ((item->type == XML_SCHEMA_TYPE_BASIC) && \ - (item->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) +#define WXS_ATTRUSE_DECL_NAME(au) (WXS_ATTRUSE_DECL(au))->name -#define IS_NOT_TYPEFIXED(item) \ - ((item->type != XML_SCHEMA_TYPE_BASIC) && \ - ((item->flags & XML_SCHEMAS_TYPE_INTERNAL_RESOLVED) == 0)) +#define WXS_ATTRUSE_DECL_TNS(au) (WXS_ATTRUSE_DECL(au))->targetNamespace +/* +* Macros for attribute groups. +*/ +#define WXS_ATTR_GROUP_HAS_REFS(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS) +#define WXS_ATTR_GROUP_EXPANDED(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED) +/* +* Macros for particles. +*/ +#define WXS_PARTICLE(p) WXS_PTC_CAST (p) -#define TYPE_IS_NOT_FIXEDUP_1(item) \ - (((item)->type != XML_SCHEMA_TYPE_BASIC) && \ - (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0)) +#define WXS_PARTICLE_TERM(p) (WXS_PARTICLE(p))->children -#define HAS_COMPLEX_CONTENT(item) \ - ((item->contentType == XML_SCHEMA_CONTENT_MIXED) || \ - (item->contentType == XML_SCHEMA_CONTENT_EMPTY) || \ - (item->contentType == XML_SCHEMA_CONTENT_ELEMENTS)) +#define WXS_PARTICLE_MODEL(p) WXS_MODEL_GROUP_CAST WXS_PARTICLE(p)->children +/* +* Macros for model groups definitions. +*/ +#define WXS_MODELGROUPDEF_MODEL(mgd) (WXS_MODEL_GROUP_CAST (mgd))->children +/* +* Macros for model groups. +*/ +#define WXS_IS_MODEL_GROUP(i) \ + (((i)->type == XML_SCHEMA_TYPE_SEQUENCE) || \ + ((i)->type == XML_SCHEMA_TYPE_CHOICE) || \ + ((i)->type == XML_SCHEMA_TYPE_ALL)) -#define HAS_SIMPLE_CONTENT(item) \ - ((item->contentType == XML_SCHEMA_CONTENT_SIMPLE) || \ - (item->contentType == XML_SCHEMA_CONTENT_BASIC)) +#define WXS_MODELGROUP_PARTICLE(mg) WXS_PTC_CAST (mg)->children +/* +* Macros for schema buckets. +*/ +#define WXS_IS_BUCKET_INCREDEF(t) (((t) == XML_SCHEMA_SCHEMA_INCLUDE) || \ + ((t) == XML_SCHEMA_SCHEMA_REDEFINE)) -#define HAS_MIXED_CONTENT(item) (item->contentType == XML_SCHEMA_CONTENT_MIXED) +#define WXS_IS_BUCKET_IMPMAIN(t) (((t) == XML_SCHEMA_SCHEMA_MAIN) || \ + ((t) == XML_SCHEMA_SCHEMA_IMPORT)) + +#define WXS_IMPBUCKET(b) ((xmlSchemaImportPtr) (b)) + +#define WXS_INCBUCKET(b) ((xmlSchemaIncludePtr) (b)) +/* +* Macros for complex/simple types. +*/ +#define WXS_IS_ANYTYPE(i) \ + (( (i)->type == XML_SCHEMA_TYPE_BASIC) && \ + ( (WXS_TYPE_CAST (i))->builtInType == XML_SCHEMAS_ANYTYPE)) -#define IS_PARTICLE_EMPTIABLE(item) \ - (xmlSchemaIsParticleEmptiable((xmlSchemaParticlePtr) item->subtypes)) +#define WXS_IS_COMPLEX(i) \ + (((i)->type == XML_SCHEMA_TYPE_COMPLEX) || \ + ((i)->builtInType == XML_SCHEMAS_ANYTYPE)) -#define GET_NODE(item) xmlSchemaGetComponentNode((xmlSchemaBasicItemPtr) item) +#define WXS_IS_SIMPLE(item) \ + ((item->type == XML_SCHEMA_TYPE_SIMPLE) || \ + ((item->type == XML_SCHEMA_TYPE_BASIC) && \ + (item->builtInType != XML_SCHEMAS_ANYTYPE))) -#define GET_LIST_ITEM_TYPE(item) item->subtypes +#define WXS_IS_ANY_SIMPLE_TYPE(i) \ + (((i)->type == XML_SCHEMA_TYPE_BASIC) && \ + ((i)->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) -#define VARIETY_ATOMIC(item) (item->flags & XML_SCHEMAS_TYPE_VARIETY_ATOMIC) -#define VARIETY_LIST(item) (item->flags & XML_SCHEMAS_TYPE_VARIETY_LIST) -#define VARIETY_UNION(item) (item->flags & XML_SCHEMAS_TYPE_VARIETY_UNION) +#define WXS_IS_RESTRICTION(t) \ + ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) -#define IS_MODEL_GROUP(item) \ - ((item->type == XML_SCHEMA_TYPE_SEQUENCE) || \ - (item->type == XML_SCHEMA_TYPE_CHOICE) || \ - (item->type == XML_SCHEMA_TYPE_ALL)) +#define WXS_IS_EXTENSION(t) \ + ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) -#define INODE_NILLED(item) (item->flags & XML_SCHEMA_ELEM_INFO_NILLED) +#define WXS_IS_TYPE_NOT_FIXED(i) \ + (((i)->type != XML_SCHEMA_TYPE_BASIC) && \ + (((i)->flags & XML_SCHEMAS_TYPE_INTERNAL_RESOLVED) == 0)) -#define ELEM_TYPE(item) item->subtypes +#define WXS_IS_TYPE_NOT_FIXED_1(item) \ + (((item)->type != XML_SCHEMA_TYPE_BASIC) && \ + (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0)) +/* +* Macros for exclusively for complex types. +*/ +#define WXS_HAS_COMPLEX_CONTENT(item) \ + ((item->contentType == XML_SCHEMA_CONTENT_MIXED) || \ + (item->contentType == XML_SCHEMA_CONTENT_EMPTY) || \ + (item->contentType == XML_SCHEMA_CONTENT_ELEMENTS)) -#define GET_PARTICLE(item) (xmlSchemaParticlePtr) item->subtypes; +#define WXS_HAS_SIMPLE_CONTENT(item) \ + ((item->contentType == XML_SCHEMA_CONTENT_SIMPLE) || \ + (item->contentType == XML_SCHEMA_CONTENT_BASIC)) -#define SUBST_GROUP_AFF(item) (item)->refDecl +#define WXS_HAS_MIXED_CONTENT(item) \ + (item->contentType == XML_SCHEMA_CONTENT_MIXED) -#define ACTXT_CAST (xmlSchemaAbstractCtxtPtr) +#define WXS_EMPTIABLE(t) \ + (xmlSchemaIsParticleEmptiable(WXS_PTC_CAST (t)->subtypes)) -#if 0 -#define WXS_GET_NEXT(item) \ - xmlSchemaGetNextComponent((xmlSchemaBasicItemPtr) item) -#endif +#define WXS_TYPE_CONTENTTYPE(t) (t)->subtypes -#define CAN_PARSE_SCHEMA(b) (((b)->doc != NULL) && ((b)->parsed == 0)) +#define WXS_TYPE_PARTICLE(t) WXS_PTC_CAST (t)->subtypes -#define HFAILURE if (res == -1) goto exit_failure; +#define WXS_TYPE_PARTICLE_TERM(t) WXS_PARTICLE_TERM(WXS_TYPE_PARTICLE(t)) +/* +* Macros for exclusively for simple types. +*/ +#define WXS_LIST_ITEMTYPE(t) (t)->subtypes -#define HERROR if (res != 0) goto exit_error; +#define WXS_IS_ATOMIC(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_ATOMIC) -#define HSTOP(ctx) if ((ctx)->stop) goto exit; +#define WXS_IS_LIST(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_LIST) +#define WXS_IS_UNION(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_UNION) +/* +* Misc parser context macros. +*/ #define WXS_CONSTRUCTOR(ctx) (ctx)->constructor #define WXS_HAS_BUCKETS(ctx) \ @@ -201,47 +286,57 @@ static const xmlChar *xmlSchemaElemModelGrDef = (const xmlChar *) #define WXS_SUBST_GROUPS(ctx) WXS_CONSTRUCTOR((ctx))->substGroups -#define WXS_SCHEMA_BUCKET(ctx) WXS_CONSTRUCTOR((ctx))->bucket +#define WXS_BUCKET(ctx) WXS_CONSTRUCTOR((ctx))->bucket #define WXS_SCHEMA(ctx) (ctx)->schema -#define ADD_LOCAL_ITEM(ctx, item) \ - xmlSchemaAddItem(&(WXS_SCHEMA_BUCKET(ctx)->locals), item) - -#define ADD_GLOBAL_ITEM(ctx, item) \ - xmlSchemaAddItem(&(WXS_SCHEMA_BUCKET(ctx)->globals), item) +#define WXS_ADD_LOCAL(ctx, item) \ + xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item) -#define WXS_ADD_PENDING_ITEM(ctx, item) \ - xmlSchemaAddItem(&((ctx)->constructor->pending), item) +#define WXS_ADD_GLOBAL(ctx, item) \ + xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item) -#define WXS_IS_RESTRICTION(t) \ - ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) +#define WXS_ADD_PENDING(ctx, item) \ + xmlSchemaAddItemSize(&((ctx)->constructor->pending), 10, item) +/* +* xmlSchemaItemList macros. +*/ +#define WXS_ILIST_IS_EMPTY(l) ((l == NULL) || ((l)->nbItems == 0)) +/* +* Misc macros. +*/ +#define IS_SCHEMA(node, type) \ + ((node != NULL) && (node->ns != NULL) && \ + (xmlStrEqual(node->name, (const xmlChar *) type)) && \ + (xmlStrEqual(node->ns->href, xmlSchemaNs))) -#define WXS_IS_EXTENSION(t) \ - ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) +#define FREE_AND_NULL(str) if ((str) != NULL) { xmlFree((xmlChar *) (str)); str = NULL; } /* -* @b: The schema bucket +* Since we put the default/fixed values into the dict, we can +* use pointer comparison for those values. +* REMOVED: (xmlStrEqual((v1), (v2))) */ -#define WXS_IS_INCREDEF(t) (((t) == XML_SCHEMA_SCHEMA_INCLUDE) || \ - ((t) == XML_SCHEMA_SCHEMA_REDEFINE)) +#define WXS_ARE_DEFAULT_STR_EQUAL(v1, v2) ((v1) == (v2)) -#define WXS_IS_IMPMAIN(t) (((t) == XML_SCHEMA_SCHEMA_MAIN) || \ - ((t) == XML_SCHEMA_SCHEMA_IMPORT)) +#define INODE_NILLED(item) (item->flags & XML_SCHEMA_ELEM_INFO_NILLED) + +#define CAN_PARSE_SCHEMA(b) (((b)->doc != NULL) && ((b)->parsed == 0)) + +#define HFAILURE if (res == -1) goto exit_failure; -#define IMPBUCKET_CAST(b) ((xmlSchemaImportPtr) (b)) -#define INCBUCKET_CAST(b) ((xmlSchemaIncludePtr) (b)) +#define HERROR if (res != 0) goto exit_error; +#define HSTOP(ctx) if ((ctx)->stop) goto exit; +/* +* Some flags used for various schema constraints. +*/ #define SUBSET_RESTRICTION 1<<0 #define SUBSET_EXTENSION 1<<1 #define SUBSET_SUBSTITUTION 1<<2 #define SUBSET_LIST 1<<3 #define SUBSET_UNION 1<<4 -#define XML_SCHEMAS_PARSE_ERROR 1 - -#define SCHEMAS_PARSE_OPTIONS XML_PARSE_NOENT - typedef struct _xmlSchemaNodeInfo xmlSchemaNodeInfo; typedef xmlSchemaNodeInfo *xmlSchemaNodeInfoPtr; @@ -253,10 +348,13 @@ struct _xmlSchemaItemList { int sizeItems; /* used for dynamic addition of schemata */ }; +#define XML_SCHEMA_CTXT_PARSER 1 +#define XML_SCHEMA_CTXT_VALIDATOR 2 + typedef struct _xmlSchemaAbstractCtxt xmlSchemaAbstractCtxt; typedef xmlSchemaAbstractCtxt *xmlSchemaAbstractCtxtPtr; struct _xmlSchemaAbstractCtxt { - int type; + int type; /* E.g. XML_SCHEMA_CTXT_VALIDATOR */ }; typedef struct _xmlSchemaBucket xmlSchemaBucket; @@ -281,8 +379,12 @@ struct _xmlSchemaSchemaRelation { xmlSchemaBucketPtr bucket; }; +#define XML_SCHEMA_BUCKET_MARKED 1<<0 +#define XML_SCHEMA_BUCKET_COMPS_ADDED 1<<1 + struct _xmlSchemaBucket { int type; + int flags; const xmlChar *schemaLocation; const xmlChar *origTargetNamespace; const xmlChar *targetNamespace; @@ -308,6 +410,7 @@ typedef struct _xmlSchemaImport xmlSchemaImport; typedef xmlSchemaImport *xmlSchemaImportPtr; struct _xmlSchemaImport { int type; /* Main OR import OR include. */ + int flags; const xmlChar *schemaLocation; /* The URI of the schema document. */ /* For chameleon includes, @origTargetNamespace will be NULL */ const xmlChar *origTargetNamespace; @@ -336,6 +439,7 @@ typedef struct _xmlSchemaInclude xmlSchemaInclude; typedef xmlSchemaInclude *xmlSchemaIncludePtr; struct _xmlSchemaInclude { int type; + int flags; const xmlChar *schemaLocation; const xmlChar *origTargetNamespace; const xmlChar *targetNamespace; @@ -352,38 +456,142 @@ struct _xmlSchemaInclude { xmlSchemaImportPtr ownerImport; }; +/** + * xmlSchemaBasicItem: + * + * The abstract base type for schema components. + */ +typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem; +typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr; +struct _xmlSchemaBasicItem { + xmlSchemaTypeType type; +}; + +/** + * xmlSchemaAnnotItem: + * + * The abstract base type for annotated schema components. + * (Extends xmlSchemaBasicItem) + */ +typedef struct _xmlSchemaAnnotItem xmlSchemaAnnotItem; +typedef xmlSchemaAnnotItem *xmlSchemaAnnotItemPtr; +struct _xmlSchemaAnnotItem { + xmlSchemaTypeType type; + xmlSchemaAnnotPtr annot; +}; + +/** + * xmlSchemaTreeItem: + * + * The abstract base type for tree-like structured schema components. + * (Extends xmlSchemaAnnotItem) + */ +typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem; +typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr; +struct _xmlSchemaTreeItem { + xmlSchemaTypeType type; + xmlSchemaAnnotPtr annot; + xmlSchemaTreeItemPtr next; + xmlSchemaTreeItemPtr children; +}; + + +#define XML_SCHEMA_ATTR_USE_FIXED 1<<0 +/** + * xmlSchemaAttributeUsePtr: + * + * The abstract base type for tree-like structured schema components. + * (Extends xmlSchemaTreeItem) + */ +typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse; +typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr; +struct _xmlSchemaAttributeUse { + xmlSchemaTypeType type; + xmlSchemaAnnotPtr annot; + xmlSchemaAttributeUsePtr next; /* The next attr. use. */ + /* + * The attr. decl. OR a QName-ref. to an attr. decl. OR + * a QName-ref. to an attribute group definition. + */ + xmlSchemaAttributePtr attrDecl; + + int flags; + xmlNodePtr node; + int occurs; /* required, optional */ + const xmlChar * defValue; + xmlSchemaValPtr defVal; +}; + +/** + * xmlSchemaAttributeUseProhibPtr: + * + * A helper component to reflect attribute prohibitions. + * (Extends xmlSchemaBasicItem) + */ +typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib; +typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr; +struct _xmlSchemaAttributeUseProhib { + xmlSchemaTypeType type; /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */ + xmlNodePtr node; + const xmlChar *name; + const xmlChar *targetNamespace; + int isRef; +}; + +/** + * xmlSchemaRedef: + */ +typedef struct _xmlSchemaRedef xmlSchemaRedef; +typedef xmlSchemaRedef *xmlSchemaRedefPtr; +struct _xmlSchemaRedef { + xmlSchemaRedefPtr next; + xmlSchemaBasicItemPtr item; /* The redefining component. */ + xmlSchemaBasicItemPtr reference; /* The referencing component. */ + xmlSchemaBasicItemPtr target; /* The to-be-redefined component. */ + const xmlChar *refName; /* The name of the to-be-redefined component. */ + const xmlChar *refTargetNs; /* The target namespace of the + to-be-redefined comp. */ + xmlSchemaBucketPtr targetBucket; /* The redefined schema. */ +}; + +/** + * xmlSchemaConstructionCtxt: + */ typedef struct _xmlSchemaConstructionCtxt xmlSchemaConstructionCtxt; typedef xmlSchemaConstructionCtxt *xmlSchemaConstructionCtxtPtr; struct _xmlSchemaConstructionCtxt { - xmlSchemaPtr schema; /* The main schema. */ + xmlSchemaPtr mainSchema; /* The main schema. */ + xmlSchemaBucketPtr mainBucket; /* The main schema bucket */ xmlDictPtr dict; xmlSchemaItemListPtr buckets; /* List of schema buckets. */ /* xmlSchemaItemListPtr relations; */ /* List of schema relations. */ - xmlSchemaBucketPtr bucket; /* The current schema bucket */ - /* All Components of all schemas that need to be fixed. */ - xmlSchemaItemListPtr pending; + xmlSchemaBucketPtr bucket; /* The current schema bucket */ + xmlSchemaItemListPtr pending; /* All Components of all schemas that + need to be fixed. */ xmlHashTablePtr substGroups; + xmlSchemaRedefPtr redefs; + xmlSchemaRedefPtr lastRedef; }; -#define XML_SCHEMA_CTXT_PARSER 1 -#define XML_SCHEMA_CTXT_VALIDATOR 2 +#define XML_SCHEMAS_PARSE_ERROR 1 +#define SCHEMAS_PARSE_OPTIONS XML_PARSE_NOENT struct _xmlSchemaParserCtxt { int type; - void *userData; /* user specific data block */ + void *errCtxt; /* user specific error context */ xmlSchemaValidityErrorFunc error; /* the callback in case of errors */ xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */ - xmlSchemaValidError err; + int err; int nberrors; xmlStructuredErrorFunc serror; xmlSchemaConstructionCtxtPtr constructor; - int ownsConstructor; /* TODO: Move this to parser flags. */ + int ownsConstructor; /* TODO: Move this to parser *flags*. */ - /* xmlSchemaPtr topschema; The main schema */ - /* xmlHashTablePtr namespaces; Hash table of namespaces to schemas */ + /* xmlSchemaPtr topschema; */ + /* xmlHashTablePtr namespaces; */ - xmlSchemaPtr schema; /* The schema in use */ + xmlSchemaPtr schema; /* The main schema in use */ int counter; const xmlChar *URL; @@ -403,7 +611,6 @@ struct _xmlSchemaParserCtxt { xmlDictPtr dict; /* dictionnary for interned string names */ xmlSchemaTypePtr ctxtType; /* The current context simple/complex type */ - xmlSchemaTypePtr parentItem; /* The current parent schema item */ int options; xmlSchemaValidCtxtPtr vctxt; int isS4S; @@ -411,63 +618,11 @@ struct _xmlSchemaParserCtxt { int xsiAssemble; int stop; /* If the parser should stop; i.e. a critical error. */ const xmlChar *targetNamespace; -}; - -#define XML_SCHEMAS_ATTR_UNKNOWN 1 -#define XML_SCHEMAS_ATTR_ASSESSED 2 -#define XML_SCHEMAS_ATTR_PROHIBITED 3 -#define XML_SCHEMAS_ATTR_ERR_MISSING 4 -#define XML_SCHEMAS_ATTR_INVALID_VALUE 5 -#define XML_SCHEMAS_ATTR_ERR_NO_TYPE 6 -#define XML_SCHEMAS_ATTR_ERR_FIXED_VALUE 7 -#define XML_SCHEMAS_ATTR_DEFAULT 8 -#define XML_SCHEMAS_ATTR_VALIDATE_VALUE 9 -#define XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL 10 -#define XML_SCHEMAS_ATTR_HAS_ATTR_USE 11 -#define XML_SCHEMAS_ATTR_HAS_ATTR_DECL 12 -#define XML_SCHEMAS_ATTR_WILD_SKIP 13 -#define XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL 14 -#define XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID 15 -#define XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID 16 -#define XML_SCHEMAS_ATTR_META 17 - -/** - * xmlSchemaBasicItem: - * - * The abstract base type for schema components. - */ -typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem; -typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr; -struct _xmlSchemaBasicItem { - xmlSchemaTypeType type; -}; - -/** - * xmlSchemaAnnotItem: - * - * The abstract base type for annotated schema components. - * (Extends xmlSchemaBasicItem) - */ -typedef struct _xmlSchemaAnnotItem xmlSchemaAnnotItem; -typedef xmlSchemaAnnotItem *xmlSchemaAnnotItemPtr; -struct _xmlSchemaAnnotItem { - xmlSchemaTypeType type; - xmlSchemaAnnotPtr annot; -}; + xmlSchemaBucketPtr redefined; /* The schema to be redefined. */ -/** - * xmlSchemaTreeItem: - * - * The abstract base type for tree-like structured schema components. - * (Extends xmlSchemaAnnotItem) - */ -typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem; -typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr; -struct _xmlSchemaTreeItem { - xmlSchemaTypeType type; - xmlSchemaAnnotPtr annot; - xmlSchemaTreeItemPtr next; - xmlSchemaTreeItemPtr children; + xmlSchemaRedefPtr redef; /* Used for redefinitions. */ + int redefCounter; /* Used for redefinitions. */ + xmlSchemaItemListPtr attrProhibs; }; /** @@ -480,10 +635,11 @@ typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef; typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr; struct _xmlSchemaQNameRef { xmlSchemaTypeType type; - xmlSchemaBasicItemPtr item; + xmlSchemaBasicItemPtr item; /* The resolved referenced item. */ xmlSchemaTypeType itemType; const xmlChar *name; const xmlChar *targetNamespace; + xmlNodePtr node; }; /** @@ -497,8 +653,10 @@ typedef xmlSchemaParticle *xmlSchemaParticlePtr; struct _xmlSchemaParticle { xmlSchemaTypeType type; xmlSchemaAnnotPtr annot; - xmlSchemaTreeItemPtr next; /* next particle (OR "element decl" OR "wildcard") */ - xmlSchemaTreeItemPtr children; /* the "term" ("model group" OR "group definition") */ + xmlSchemaTreeItemPtr next; /* next particle */ + xmlSchemaTreeItemPtr children; /* the "term" (e.g. a model group, + a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference), + etc.) */ int minOccurs; int maxOccurs; xmlNodePtr node; @@ -521,6 +679,7 @@ struct _xmlSchemaModelGroup { }; #define XML_SCHEMA_MODEL_GROUP_DEF_MARKED 1<<0 +#define XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED 1<<1 /** * xmlSchemaModelGroupDef: * @@ -538,7 +697,6 @@ struct _xmlSchemaModelGroupDef { const xmlChar *targetNamespace; xmlNodePtr node; int flags; - xmlSchemaModelGroupDefPtr redef; /* Redefinitions. */ }; typedef struct _xmlSchemaIDC xmlSchemaIDC; @@ -590,7 +748,7 @@ typedef xmlSchemaIDCAug *xmlSchemaIDCAugPtr; struct _xmlSchemaIDCAug { xmlSchemaIDCAugPtr next; /* next in a list */ xmlSchemaIDCPtr def; /* the IDC definition */ - int bubbleDepth; /* the lowest tree level to which IDC + int keyrefDepth; /* the lowest tree level to which IDC tables need to be bubbled upwards */ }; @@ -634,11 +792,10 @@ struct _xmlSchemaPSVIIDCBinding { xmlSchemaPSVIIDCNodePtr *nodeTable; /* array of key-sequences */ int nbNodes; /* number of entries in the node table */ int sizeNodes; /* size of the node table */ - int nbDupls; /* number of already identified duplicates in the node - table */ - /* int nbKeys; number of keys in each key-sequence */ + xmlSchemaItemListPtr dupls; }; + #define XPATH_STATE_OBJ_TYPE_IDC_SELECTOR 1 #define XPATH_STATE_OBJ_TYPE_IDC_FIELD 2 @@ -673,17 +830,20 @@ struct _xmlSchemaIDCStateObj { /** * xmlSchemaIDCMatcher: * - * Used to IDC selectors (and fields) successively. + * Used to evaluate IDC selectors (and fields). */ struct _xmlSchemaIDCMatcher { int type; int depth; /* the tree depth at creation time */ xmlSchemaIDCMatcherPtr next; /* next in the list */ xmlSchemaIDCAugPtr aidc; /* the augmented IDC item */ + int idcType; xmlSchemaPSVIIDCKeyPtr **keySeqs; /* the key-sequences of the target elements */ int sizeKeySeqs; int targetDepth; + xmlSchemaItemListPtr targets; /* list of target-node + (xmlSchemaPSVIIDCNodePtr) entries */ }; /* @@ -733,9 +893,29 @@ struct _xmlSchemaNodeInfo { const xmlChar **nsBindings; /* Namespace bindings on this element */ int nbNsBindings; - int sizeNsBindings; + int sizeNsBindings; + + int hasKeyrefs; + int appliedXPath; /* Indicates that an XPath has been applied. */ }; +#define XML_SCHEMAS_ATTR_UNKNOWN 1 +#define XML_SCHEMAS_ATTR_ASSESSED 2 +#define XML_SCHEMAS_ATTR_PROHIBITED 3 +#define XML_SCHEMAS_ATTR_ERR_MISSING 4 +#define XML_SCHEMAS_ATTR_INVALID_VALUE 5 +#define XML_SCHEMAS_ATTR_ERR_NO_TYPE 6 +#define XML_SCHEMAS_ATTR_ERR_FIXED_VALUE 7 +#define XML_SCHEMAS_ATTR_DEFAULT 8 +#define XML_SCHEMAS_ATTR_VALIDATE_VALUE 9 +#define XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL 10 +#define XML_SCHEMAS_ATTR_HAS_ATTR_USE 11 +#define XML_SCHEMAS_ATTR_HAS_ATTR_DECL 12 +#define XML_SCHEMAS_ATTR_WILD_SKIP 13 +#define XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL 14 +#define XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID 15 +#define XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID 16 +#define XML_SCHEMAS_ATTR_META 17 /* * @metaType values of xmlSchemaAttrInfo. */ @@ -759,7 +939,7 @@ struct _xmlSchemaAttrInfo { int flags; /* combination of node info flags */ xmlSchemaAttributePtr decl; /* the attribute declaration */ - xmlSchemaAttributePtr use; /* the attribute use */ + xmlSchemaAttributeUsePtr use; /* the attribute use */ int state; int metaType; const xmlChar *vcValue; /* the value constraint value */ @@ -775,7 +955,7 @@ struct _xmlSchemaAttrInfo { */ struct _xmlSchemaValidCtxt { int type; - void *userData; /* user specific data block */ + void *errCtxt; /* user specific data block */ xmlSchemaValidityErrorFunc error; /* the callback in case of errors */ xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */ xmlStructuredErrorFunc serror; @@ -786,7 +966,7 @@ struct _xmlSchemaValidCtxt { xmlCharEncoding enc; xmlSAXHandlerPtr sax; xmlParserCtxtPtr parserCtxt; - void *user_data; + void *user_data; /* TODO: What is this for? */ int err; int nberrors; @@ -836,6 +1016,9 @@ struct _xmlSchemaValidCtxt { int skipDepth; xmlSchemaItemListPtr nodeQNames; + int hasKeyrefs; + int createIDCNodeTables; + int psviExposeIDCNodeTables; }; /** @@ -864,7 +1047,7 @@ static int xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node); static int xmlSchemaTypeFixup(xmlSchemaTypePtr type, - xmlSchemaParserCtxtPtr ctxt); + xmlSchemaAbstractCtxtPtr ctxt); static const xmlChar * xmlSchemaFacetTypeToString(xmlSchemaTypeType type); static int @@ -882,7 +1065,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlNodePtr node, xmlSchemaTypeType type, int withParticle); static const xmlChar * -xmlSchemaCompTypeToString(xmlSchemaTypeType type); +xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item); static xmlSchemaTypeLinkPtr xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type); static void @@ -890,7 +1073,8 @@ xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt, const char *funcName, const char *message); static int -xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, +xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr ctxt, + xmlSchemaTypePtr type, xmlSchemaTypePtr baseType, int subset); static void @@ -898,6 +1082,10 @@ xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, xmlSchemaParserCtxtPtr ctxt); static void xmlSchemaComponentListFree(xmlSchemaItemListPtr list); +static xmlSchemaQNameRefPtr +xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node); /************************************************************************ * * @@ -906,21 +1094,25 @@ xmlSchemaComponentListFree(xmlSchemaItemListPtr list); ************************************************************************/ /** - * xmlSchemaCompTypeToString: + * xmlSchemaItemTypeToStr: * @type: the type of the schema item * * Returns the component name of a schema item. */ static const xmlChar * -xmlSchemaCompTypeToString(xmlSchemaTypeType type) +xmlSchemaItemTypeToStr(xmlSchemaTypeType type) { switch (type) { + case XML_SCHEMA_TYPE_BASIC: + return(BAD_CAST "simple type definition"); case XML_SCHEMA_TYPE_SIMPLE: return(BAD_CAST "simple type definition"); case XML_SCHEMA_TYPE_COMPLEX: return(BAD_CAST "complex type definition"); case XML_SCHEMA_TYPE_ELEMENT: return(BAD_CAST "element declaration"); + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + return(BAD_CAST "attribute use"); case XML_SCHEMA_TYPE_ATTRIBUTE: return(BAD_CAST "attribute declaration"); case XML_SCHEMA_TYPE_GROUP: @@ -950,14 +1142,36 @@ xmlSchemaCompTypeToString(xmlSchemaTypeType type) return(BAD_CAST "wildcard (any)"); case XML_SCHEMA_EXTRA_QNAMEREF: return(BAD_CAST "[helper component] QName reference"); + case XML_SCHEMA_EXTRA_ATTR_USE_PROHIB: + return(BAD_CAST "[helper component] attribute use prohibition"); default: return(BAD_CAST "Not a schema component"); } } /** - * xmlSchemaGetComponentNode: - * @item: a schema component + * xmlSchemaGetComponentTypeStr: + * @type: the type of the schema item + * + * Returns the component name of a schema item. + */ +static const xmlChar * +xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item) +{ + switch (item->type) { + case XML_SCHEMA_TYPE_BASIC: + if (WXS_IS_COMPLEX(WXS_TYPE_CAST item)) + return(BAD_CAST "complex type definition"); + else + return(BAD_CAST "simple type definition"); + default: + return(xmlSchemaItemTypeToStr(item->type)); + } +} + +/** + * xmlSchemaGetComponentNode: + * @item: a schema component * * Returns node associated with the schema component. * NOTE that such a node need not be available; plus, a component's @@ -993,6 +1207,14 @@ xmlSchemaGetComponentNode(xmlSchemaBasicItemPtr item) case XML_SCHEMA_TYPE_IDC_KEY: case XML_SCHEMA_TYPE_IDC_KEYREF: return (((xmlSchemaIDCPtr) item)->node); + case XML_SCHEMA_EXTRA_QNAMEREF: + return(((xmlSchemaQNameRefPtr) item)->node); + /* TODO: What to do with NOTATIONs? + case XML_SCHEMA_TYPE_NOTATION: + return (((xmlSchemaNotationPtr) item)->node); + */ + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + return (((xmlSchemaAttributeUsePtr) item)->node); default: return (NULL); } @@ -1039,37 +1261,6 @@ xmlSchemaGetNextComponent(xmlSchemaBasicItemPtr item) } #endif -/** - * xmlSchemaGetAttrName: - * @attr: the attribute declaration/use - * - * Returns the name of the attribute; if the attribute - * is a reference, the name of the referenced global type will be returned. - */ -static const xmlChar * -xmlSchemaGetAttrName(xmlSchemaAttributePtr attr) -{ - if (attr->ref != NULL) - return(attr->ref); - else - return(attr->name); -} - -/** - * xmlSchemaGetAttrTargetNsURI: - * @type: the type (element or attribute) - * - * Returns the target namespace URI of the type; if the type is a reference, - * the target namespace of the referenced type will be returned. - */ -static const xmlChar * -xmlSchemaGetAttrTargetNsURI(xmlSchemaAttributePtr attr) -{ - if (attr->ref != NULL) - return (attr->refNs); - else - return(attr->targetNamespace); -} /** * xmlSchemaFormatQName: @@ -1089,14 +1280,18 @@ xmlSchemaFormatQName(xmlChar **buf, const xmlChar *localName) { FREE_AND_NULL(*buf) - if (namespaceName == NULL) - return(localName); - - *buf = xmlStrdup(BAD_CAST "{"); - *buf = xmlStrcat(*buf, namespaceName); - *buf = xmlStrcat(*buf, BAD_CAST "}"); - *buf = xmlStrcat(*buf, localName); - + if (namespaceName != NULL) { + *buf = xmlStrdup(BAD_CAST "{"); + *buf = xmlStrcat(*buf, namespaceName); + *buf = xmlStrcat(*buf, BAD_CAST "}"); + } + if (localName != NULL) { + if (namespaceName == NULL) + return(localName); + *buf = xmlStrcat(*buf, localName); + } else { + *buf = xmlStrcat(*buf, BAD_CAST "(NULL)"); + } return ((const xmlChar *) *buf); } @@ -1129,6 +1324,16 @@ xmlSchemaGetComponentName(xmlSchemaBasicItemPtr item) case XML_SCHEMA_TYPE_IDC_UNIQUE: case XML_SCHEMA_TYPE_IDC_KEYREF: return (((xmlSchemaIDCPtr) item)->name); + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + if (WXS_ATTRUSE_DECL(item) != NULL) { + return(xmlSchemaGetComponentName( + WXS_BASIC_CAST WXS_ATTRUSE_DECL(item))); + } else + return(NULL); + case XML_SCHEMA_EXTRA_QNAMEREF: + return (((xmlSchemaQNameRefPtr) item)->name); + case XML_SCHEMA_TYPE_NOTATION: + return (((xmlSchemaNotationPtr) item)->name); default: /* * Other components cannot have names. @@ -1138,6 +1343,22 @@ xmlSchemaGetComponentName(xmlSchemaBasicItemPtr item) return (NULL); } +#define xmlSchemaGetQNameRefName(r) (WXS_QNAME_CAST (r))->name +#define xmlSchemaGetQNameRefTargetNs(r) (WXS_QNAME_CAST (r))->targetNamespace +/* +static const xmlChar * +xmlSchemaGetQNameRefName(void *ref) +{ + return(((xmlSchemaQNameRefPtr) ref)->name); +} + +static const xmlChar * +xmlSchemaGetQNameRefTargetNs(void *ref) +{ + return(((xmlSchemaQNameRefPtr) ref)->targetNamespace); +} +*/ + static const xmlChar * xmlSchemaGetComponentTargetNs(xmlSchemaBasicItemPtr item) { @@ -1159,6 +1380,17 @@ xmlSchemaGetComponentTargetNs(xmlSchemaBasicItemPtr item) case XML_SCHEMA_TYPE_IDC_UNIQUE: case XML_SCHEMA_TYPE_IDC_KEYREF: return (((xmlSchemaIDCPtr) item)->targetNamespace); + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + if (WXS_ATTRUSE_DECL(item) != NULL) { + return(xmlSchemaGetComponentTargetNs( + WXS_BASIC_CAST WXS_ATTRUSE_DECL(item))); + } + /* TODO: Will returning NULL break something? */ + break; + case XML_SCHEMA_EXTRA_QNAMEREF: + return (((xmlSchemaQNameRefPtr) item)->targetNamespace); + case XML_SCHEMA_TYPE_NOTATION: + return (((xmlSchemaNotationPtr) item)->targetNamespace); default: /* * Other components cannot have names. @@ -1178,18 +1410,25 @@ xmlSchemaGetComponentQName(xmlChar **buf, } static const xmlChar* -xmlSchemaGetIDCDesignation(xmlChar **buf, xmlSchemaIDCPtr idc) +xmlSchemaGetComponentDesignation(xmlChar **buf, void *item) { xmlChar *str = NULL; - *buf = xmlStrcat(*buf, xmlSchemaCompTypeToString(idc->type)); + *buf = xmlStrcat(*buf, WXS_ITEM_TYPE_NAME(item)); *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, xmlSchemaGetComponentQName(&str, idc)); + *buf = xmlStrcat(*buf, xmlSchemaGetComponentQName(&str, + (xmlSchemaBasicItemPtr) item)); *buf = xmlStrcat(*buf, BAD_CAST "'"); FREE_AND_NULL(str); return(*buf); } +static const xmlChar* +xmlSchemaGetIDCDesignation(xmlChar **buf, xmlSchemaIDCPtr idc) +{ + return(xmlSchemaGetComponentDesignation(buf, idc)); +} + /** * xmlSchemaWildcardPCToString: * @pc: the type of processContents @@ -1316,7 +1555,7 @@ internal_error: static xmlChar* xmlSchemaFormatItemForReport(xmlChar **buf, const xmlChar *itemDes, - xmlSchemaTypePtr item, + xmlSchemaBasicItemPtr item, xmlNodePtr itemNode) { xmlChar *str = NULL; @@ -1331,84 +1570,99 @@ xmlSchemaFormatItemForReport(xmlChar **buf, *buf = xmlStrdup(itemDes); } else if (item != NULL) { switch (item->type) { - case XML_SCHEMA_TYPE_BASIC: - if (VARIETY_ATOMIC(item)) + case XML_SCHEMA_TYPE_BASIC: { + xmlSchemaTypePtr type = WXS_TYPE_CAST item; + + if (WXS_IS_ATOMIC(type)) *buf = xmlStrdup(BAD_CAST "atomic type 'xs:"); - else if (VARIETY_LIST(item)) + else if (WXS_IS_LIST(type)) *buf = xmlStrdup(BAD_CAST "list type 'xs:"); - else if (VARIETY_UNION(item)) + else if (WXS_IS_UNION(type)) *buf = xmlStrdup(BAD_CAST "union type 'xs:"); else *buf = xmlStrdup(BAD_CAST "simple type 'xs:"); - *buf = xmlStrcat(*buf, item->name); + *buf = xmlStrcat(*buf, type->name); *buf = xmlStrcat(*buf, BAD_CAST "'"); + } break; - case XML_SCHEMA_TYPE_SIMPLE: - if (item->flags & XML_SCHEMAS_TYPE_GLOBAL) { + case XML_SCHEMA_TYPE_SIMPLE: { + xmlSchemaTypePtr type = WXS_TYPE_CAST item; + + if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { *buf = xmlStrdup(BAD_CAST""); } else { *buf = xmlStrdup(BAD_CAST "local "); } - if (VARIETY_ATOMIC(item)) + if (WXS_IS_ATOMIC(type)) *buf = xmlStrcat(*buf, BAD_CAST "atomic type"); - else if (VARIETY_LIST(item)) + else if (WXS_IS_LIST(type)) *buf = xmlStrcat(*buf, BAD_CAST "list type"); - else if (VARIETY_UNION(item)) + else if (WXS_IS_UNION(type)) *buf = xmlStrcat(*buf, BAD_CAST "union type"); else *buf = xmlStrcat(*buf, BAD_CAST "simple type"); - if (item->flags & XML_SCHEMAS_TYPE_GLOBAL) { + if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, item->name); + *buf = xmlStrcat(*buf, type->name); *buf = xmlStrcat(*buf, BAD_CAST "'"); } + } break; - case XML_SCHEMA_TYPE_COMPLEX: - if (item->flags & XML_SCHEMAS_TYPE_GLOBAL) + case XML_SCHEMA_TYPE_COMPLEX: { + xmlSchemaTypePtr type = WXS_TYPE_CAST item; + + if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) *buf = xmlStrdup(BAD_CAST ""); else *buf = xmlStrdup(BAD_CAST "local "); *buf = xmlStrcat(*buf, BAD_CAST "complex type"); - if (item->flags & XML_SCHEMAS_TYPE_GLOBAL) { + if (type->flags & XML_SCHEMAS_TYPE_GLOBAL) { *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, item->name); + *buf = xmlStrcat(*buf, type->name); *buf = xmlStrcat(*buf, BAD_CAST "'"); } + } break; - case XML_SCHEMA_TYPE_ATTRIBUTE: { - xmlSchemaAttributePtr attr; + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: { + xmlSchemaAttributeUsePtr ause; - attr = (xmlSchemaAttributePtr) item; - if ((attr->flags & XML_SCHEMAS_ATTR_GLOBAL) || - (attr->ref == NULL)) { - *buf = xmlStrdup(xmlSchemaElemDesAttrDecl); - *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, - attr->targetNamespace, attr->name)); - FREE_AND_NULL(str) + ause = WXS_ATTR_USE_CAST item; + *buf = xmlStrdup(BAD_CAST "attribute use "); + if (WXS_ATTRUSE_DECL(ause) != NULL) { *buf = xmlStrcat(*buf, BAD_CAST "'"); - } else { - *buf = xmlStrdup(xmlSchemaElemDesAttrRef); - *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, - attr->refNs, attr->ref)); + *buf = xmlStrcat(*buf, + xmlSchemaGetComponentQName(&str, WXS_ATTRUSE_DECL(ause))); FREE_AND_NULL(str) + *buf = xmlStrcat(*buf, BAD_CAST "'"); + } else { + *buf = xmlStrcat(*buf, BAD_CAST "(unknown)"); + } + } + break; + case XML_SCHEMA_TYPE_ATTRIBUTE: { + xmlSchemaAttributePtr attr; + + attr = (xmlSchemaAttributePtr) item; + *buf = xmlStrdup(BAD_CAST "attribute decl."); + *buf = xmlStrcat(*buf, BAD_CAST " '"); + *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, + attr->targetNamespace, attr->name)); + FREE_AND_NULL(str) *buf = xmlStrcat(*buf, BAD_CAST "'"); - } } break; + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + xmlSchemaGetComponentDesignation(buf, item); + break; case XML_SCHEMA_TYPE_ELEMENT: { xmlSchemaElementPtr elem; elem = (xmlSchemaElementPtr) item; - if ((elem->flags & XML_SCHEMAS_ELEM_GLOBAL) || - (elem->ref == NULL)) { - *buf = xmlStrdup(xmlSchemaElemDesElemDecl); - *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, - elem->targetNamespace, elem->name)); - *buf = xmlStrcat(*buf, BAD_CAST "'"); - } + *buf = xmlStrdup(BAD_CAST "element decl."); + *buf = xmlStrcat(*buf, BAD_CAST " '"); + *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, + elem->targetNamespace, elem->name)); + *buf = xmlStrcat(*buf, BAD_CAST "'"); } break; case XML_SCHEMA_TYPE_IDC_UNIQUE: @@ -1445,15 +1699,10 @@ xmlSchemaFormatItemForReport(xmlChar **buf, *buf = xmlStrcat(*buf, xmlSchemaFacetTypeToString(item->type)); *buf = xmlStrcat(*buf, BAD_CAST "'"); break; - case XML_SCHEMA_TYPE_NOTATION: - *buf = xmlStrdup(BAD_CAST "notation"); - break; case XML_SCHEMA_TYPE_GROUP: { - *buf = xmlStrdup(xmlSchemaElemModelGrDef); + *buf = xmlStrdup(BAD_CAST "model group def."); *buf = xmlStrcat(*buf, BAD_CAST " '"); - *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, - ((xmlSchemaModelGroupDefPtr) item)->targetNamespace, - ((xmlSchemaModelGroupDefPtr) item)->name)); + *buf = xmlStrcat(*buf, xmlSchemaGetComponentQName(&str, item)); *buf = xmlStrcat(*buf, BAD_CAST "'"); FREE_AND_NULL(str) } @@ -1462,8 +1711,15 @@ xmlSchemaFormatItemForReport(xmlChar **buf, case XML_SCHEMA_TYPE_CHOICE: case XML_SCHEMA_TYPE_ALL: case XML_SCHEMA_TYPE_PARTICLE: - *buf = xmlStrdup(xmlSchemaCompTypeToString(item->type)); - break; + *buf = xmlStrdup(WXS_ITEM_TYPE_NAME(item)); + break; + case XML_SCHEMA_TYPE_NOTATION: { + *buf = xmlStrdup(WXS_ITEM_TYPE_NAME(item)); + *buf = xmlStrcat(*buf, BAD_CAST " '"); + *buf = xmlStrcat(*buf, xmlSchemaGetComponentQName(&str, item)); + *buf = xmlStrcat(*buf, BAD_CAST "'"); + FREE_AND_NULL(str); + } default: named = 0; } @@ -1575,6 +1831,13 @@ xmlSchemaErrMemory(const char *msg) } #endif +static void +xmlSchemaPSimpleErr(const char *msg) +{ + __xmlSimpleError(XML_FROM_SCHEMASP, XML_ERR_NO_MEMORY, NULL, NULL, + msg); +} + /** * xmlSchemaPErrMemory: * @node: a context node @@ -1613,8 +1876,9 @@ xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, if (ctxt != NULL) { ctxt->nberrors++; + ctxt->err = error; channel = ctxt->error; - data = ctxt->userData; + data = ctxt->errCtxt; schannel = ctxt->serror; } __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, @@ -1678,8 +1942,9 @@ xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, if (ctxt != NULL) { ctxt->nberrors++; + ctxt->err = error; channel = ctxt->error; - data = ctxt->userData; + data = ctxt->errCtxt; schannel = ctxt->serror; } __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, @@ -1737,11 +2002,11 @@ xmlSchemaPSimpleInternalErr(xmlNodePtr node, * Handle a validation error */ static void -xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt, +xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, xmlErrorLevel errorLevel, int error, xmlNodePtr node, int line, const char *msg, const xmlChar *str1, const xmlChar *str2, - const xmlChar *str3) + const xmlChar *str3, const xmlChar *str4) { xmlStructuredErrorFunc schannel = NULL; xmlGenericErrorFunc channel = NULL; @@ -1759,7 +2024,7 @@ xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt, channel = vctxt->warning; } schannel = vctxt->serror; - data = vctxt->userData; + data = vctxt->errCtxt; /* * Error node. If we specify a line number, then @@ -1799,7 +2064,7 @@ xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt, node, XML_FROM_SCHEMASV, error, errorLevel, file, line, (const char *) str1, (const char *) str2, - (const char *) str3, 0, 0, msg, str1, str2, str3); + (const char *) str3, 0, 0, msg, str1, str2, str3, str4); } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) { xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt; @@ -1811,12 +2076,12 @@ xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt, channel = pctxt->warning; } schannel = pctxt->serror; - data = pctxt->userData; + data = pctxt->errCtxt; __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, error, errorLevel, NULL, 0, (const char *) str1, (const char *) str2, - (const char *) str3, 0, 0, msg, str1, str2, str3); + (const char *) str3, 0, 0, msg, str1, str2, str3, str4); } else { TODO } @@ -1840,8 +2105,18 @@ xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2, const xmlChar *str3) { - xmlSchemaErr3Line(actxt, XML_ERR_ERROR, error, node, 0, - msg, str1, str2, str3); + xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, + msg, str1, str2, str3, NULL); +} + +static void +xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, + int error, xmlNodePtr node, const char *msg, + const xmlChar *str1, const xmlChar *str2, + const xmlChar *str3, const xmlChar *str4) +{ + xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, + msg, str1, str2, str3, str4); } static void @@ -1849,7 +2124,7 @@ xmlSchemaErr(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2) { - xmlSchemaErr3(actxt, error, node, msg, str1, str2, NULL); + xmlSchemaErr4(actxt, error, node, msg, str1, str2, NULL, NULL); } static xmlChar * @@ -1859,6 +2134,19 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, { xmlChar *str = NULL; + *msg = NULL; + if ((node != NULL) && + (node->type != XML_ELEMENT_NODE) && + (node->type != XML_ATTRIBUTE_NODE)) + { + /* + * Don't try to format other nodes than element and + * attribute nodes. + * Play save and return an empty string. + */ + *msg = xmlStrdup(BAD_CAST ""); + return(*msg); + } if (node != NULL) { /* * Work on tree nodes. @@ -1923,7 +2211,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, * VAL TODO: The output of the given schema component is currently * disabled. */ -#if 0 +#if 0 if ((type != NULL) && (xmlSchemaIsGlobalItem(type))) { *msg = xmlStrcat(*msg, BAD_CAST " ["); *msg = xmlStrcat(*msg, xmlSchemaFormatItemForReport(&str, @@ -1983,24 +2271,45 @@ xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt, #endif static void -xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, +xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt, xmlParserErrors error, xmlNodePtr node, - xmlSchemaTypePtr type ATTRIBUTE_UNUSED, + xmlSchemaBasicItemPtr item, const char *message, - const xmlChar *str1, - const xmlChar *str2) + const xmlChar *str1, const xmlChar *str2, + const xmlChar *str3, const xmlChar *str4) { xmlChar *msg = NULL; - xmlSchemaFormatNodeForError(&msg, actxt, node); + if ((node == NULL) && (item != NULL) && + (actxt->type == XML_SCHEMA_CTXT_PARSER)) { + node = WXS_ITEM_NODE(item); + xmlSchemaFormatItemForReport(&msg, NULL, item, NULL); + msg = xmlStrcat(msg, BAD_CAST ": "); + } else + xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); - xmlSchemaErr(actxt, error, node, - (const char *) msg, str1, str2); + xmlSchemaErr4(actxt, error, node, + (const char *) msg, str1, str2, str3, str4); FREE_AND_NULL(msg) } +static void +xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, + xmlParserErrors error, + xmlNodePtr node, + xmlSchemaBasicItemPtr item, + const char *message, + const xmlChar *str1, + const xmlChar *str2) +{ + xmlSchemaCustomErr4(actxt, error, node, item, + message, str1, str2, NULL, NULL); +} + + + static void xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, xmlParserErrors error, @@ -2018,8 +2327,8 @@ xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, msg = xmlStrcat(msg, BAD_CAST ".\n"); /* URGENT TODO: Set the error code to something sane. */ - xmlSchemaErr3Line(actxt, XML_ERR_WARNING, error, node, 0, - (const char *) msg, str1, str2, str3); + xmlSchemaErr4Line(actxt, XML_ERR_WARNING, error, node, 0, + (const char *) msg, str1, str2, str3, NULL); FREE_AND_NULL(msg) } @@ -2040,12 +2349,12 @@ xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt, msg = xmlStrdup(BAD_CAST "Element '%s': "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); - xmlSchemaErr3Line(ACTXT_CAST vctxt, XML_ERR_ERROR, + xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR, error, NULL, idcNode->nodeLine, (const char *) msg, xmlSchemaFormatQName(&qname, vctxt->nodeQNames->items[idcNode->nodeQNameID +1], vctxt->nodeQNames->items[idcNode->nodeQNameID]), - str1, str2); + str1, str2, NULL); FREE_AND_NULL(qname); FREE_AND_NULL(msg); } @@ -2114,11 +2423,11 @@ xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt, else msg = xmlStrcat(msg, BAD_CAST "the "); - if (VARIETY_ATOMIC(type)) + if (WXS_IS_ATOMIC(type)) msg = xmlStrcat(msg, BAD_CAST "atomic type"); - else if (VARIETY_LIST(type)) + else if (WXS_IS_LIST(type)) msg = xmlStrcat(msg, BAD_CAST "list type"); - else if (VARIETY_UNION(type)) + else if (WXS_IS_UNION(type)) msg = xmlStrcat(msg, BAD_CAST "union type"); if (xmlSchemaIsGlobalItem(type)) { @@ -2188,7 +2497,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, xmlChar *str = NULL, *msg = NULL; xmlChar *localName, *nsName; const xmlChar *cur, *end; - int i, is_not; + int i; xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); @@ -2211,11 +2520,8 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, continue; if ((cur[0] == 'n') && (cur[1] == 'o') && (cur[2] == 't') && (cur[3] == ' ')) { - is_not = 1; cur += 4; str = xmlStrcat(str, BAD_CAST "##other"); - } else { - is_not = 0; } /* * Get the local name. @@ -2366,12 +2672,12 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, xmlSchemaErr(actxt, error, node, (const char *) msg, value, facet->value); } else if (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE) { - msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be less than " + msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be greater than " "'%s'.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, value, facet->value); } else if (facetType == XML_SCHEMA_FACET_MAXEXCLUSIVE) { - msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be more than " + msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be less than " "'%s'.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, value, facet->value); @@ -2427,7 +2733,7 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, static void xmlSchemaPMissingAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, const char *message) @@ -2464,7 +2770,7 @@ xmlSchemaPMissingAttrErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPResCompAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, const xmlChar *refName, @@ -2476,7 +2782,7 @@ xmlSchemaPResCompAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaFormatItemForReport(&des, NULL, ownerItem, ownerElem); if (refTypeStr == NULL) - refTypeStr = (const char *) xmlSchemaCompTypeToString(refType); + refTypeStr = (const char *) xmlSchemaItemTypeToStr(refType); xmlSchemaPErrExt(ctxt, ownerElem, error, NULL, NULL, NULL, "%s, attribute '%s': The QName value '%s' does not resolve to a(n) " @@ -2501,7 +2807,7 @@ static void xmlSchemaPCustomAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, const char *msg) { @@ -2534,49 +2840,18 @@ xmlSchemaPCustomAttrErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPIllegalAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerComp ATTRIBUTE_UNUSED, xmlAttrPtr attr) { - xmlChar *des = NULL, *strA = NULL; + xmlChar *strA = NULL, *strB = NULL; - if (ownerDes == NULL) - xmlSchemaFormatItemForReport(&des, NULL, ownerItem, attr->parent); - else if (*ownerDes == NULL) { - xmlSchemaFormatItemForReport(ownerDes, NULL, ownerItem, attr->parent); - des = *ownerDes; - } else - des = *ownerDes; - xmlSchemaPErr(ctxt, (xmlNodePtr) attr, error, - "%s: The attribute '%s' is not allowed.\n", BAD_CAST des, - xmlSchemaFormatQNameNs(&strA, attr->ns, attr->name)); - if (ownerDes == NULL) - FREE_AND_NULL(des); + xmlSchemaFormatNodeForError(&strA, ACTXT_CAST ctxt, attr->parent); + xmlSchemaErr4(ACTXT_CAST ctxt, error, (xmlNodePtr) attr, + "%sThe attribute '%s' is not allowed.\n", BAD_CAST strA, + xmlSchemaFormatQNameNs(&strB, attr->ns, attr->name), + NULL, NULL); FREE_AND_NULL(strA); -} - -/** - * xmlSchemaPAquireDes: - * @des: the first designation - * @itemDes: the second designation - * @item: the schema item - * @itemElem: the node of the schema item - * - * Creates a designation for an item. - */ -static void -xmlSchemaPAquireDes(xmlChar **des, - xmlChar **itemDes, - xmlSchemaTypePtr item, - xmlNodePtr itemElem) -{ - if (itemDes == NULL) - xmlSchemaFormatItemForReport(des, NULL, item, itemElem); - else if (*itemDes == NULL) { - xmlSchemaFormatItemForReport(itemDes, NULL, item, itemElem); - *des = *itemDes; - } else - *des = *itemDes; + FREE_AND_NULL(strB); } /** @@ -2596,8 +2871,7 @@ xmlSchemaPAquireDes(xmlChar **des, static void xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **itemDes, - xmlSchemaTypePtr item, + xmlSchemaBasicItemPtr item, xmlNodePtr itemElem, const char *message, const xmlChar *str1, @@ -2606,16 +2880,15 @@ xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt, { xmlChar *des = NULL, *msg = NULL; - xmlSchemaPAquireDes(&des, itemDes, item, itemElem); + xmlSchemaFormatItemForReport(&des, NULL, item, itemElem); msg = xmlStrdup(BAD_CAST "%s: "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); if ((itemElem == NULL) && (item != NULL)) - itemElem = item->node; + itemElem = WXS_ITEM_NODE(item); xmlSchemaPErrExt(ctxt, itemElem, error, NULL, NULL, NULL, (const char *) msg, BAD_CAST des, str1, str2, str3, NULL); - if (itemDes == NULL) - FREE_AND_NULL(des); + FREE_AND_NULL(des); FREE_AND_NULL(msg); } @@ -2634,13 +2907,12 @@ xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **itemDes, - xmlSchemaTypePtr item, + xmlSchemaBasicItemPtr item, xmlNodePtr itemElem, const char *message, const xmlChar *str1) { - xmlSchemaPCustomErrExt(ctxt, error, itemDes, item, itemElem, message, + xmlSchemaPCustomErrExt(ctxt, error, item, itemElem, message, str1, NULL, NULL); } @@ -2658,25 +2930,28 @@ xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt, * Reports an attribute use error during parsing. */ static void -xmlSchemaPAttrUseErr(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlSchemaTypePtr item, - const xmlSchemaAttributePtr attr, + xmlNodePtr node, + xmlSchemaBasicItemPtr ownerItem, + const xmlSchemaAttributeUsePtr attruse, const char *message, - const xmlChar *str1) + const xmlChar *str1, const xmlChar *str2, + const xmlChar *str3,const xmlChar *str4) { xmlChar *str = NULL, *msg = NULL; - xmlSchemaFormatItemForReport(&msg, NULL, item, NULL); - msg = xmlStrcat(msg, BAD_CAST ", "); + + xmlSchemaFormatItemForReport(&msg, NULL, ownerItem, NULL); + msg = xmlStrcat(msg, BAD_CAST ", "); msg = xmlStrcat(msg, BAD_CAST xmlSchemaFormatItemForReport(&str, NULL, - (xmlSchemaTypePtr) attr, NULL)); + WXS_BASIC_CAST attruse, NULL)); FREE_AND_NULL(str); msg = xmlStrcat(msg, BAD_CAST ": "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); - xmlSchemaPErr(ctxt, attr->node, error, - (const char *) msg, str1, NULL); + xmlSchemaErr4(ACTXT_CAST ctxt, error, node, + (const char *) msg, str1, str2, str3, str4); xmlFree(msg); } @@ -2684,9 +2959,8 @@ xmlSchemaPAttrUseErr(xmlSchemaParserCtxtPtr ctxt, * xmlSchemaPIllegalFacetAtomicErr: * @ctxt: the schema parser context * @error: the error code - * @itemDes: the designation of the type - * @item: the schema type - * @baseItem: the base type of type + * @type: the schema type + * @baseType: the base type of type * @facet: the illegal facet * * Reports an illegal facet for atomic simple types. @@ -2694,22 +2968,20 @@ xmlSchemaPAttrUseErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPIllegalFacetAtomicErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **itemDes, - xmlSchemaTypePtr item, - xmlSchemaTypePtr baseItem, + xmlSchemaTypePtr type, + xmlSchemaTypePtr baseType, xmlSchemaFacetPtr facet) { xmlChar *des = NULL, *strT = NULL; - xmlSchemaPAquireDes(&des, itemDes, item, item->node); - xmlSchemaPErrExt(ctxt, item->node, error, NULL, NULL, NULL, + xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST type, type->node); + xmlSchemaPErrExt(ctxt, type->node, error, NULL, NULL, NULL, "%s: The facet '%s' is not allowed on types derived from the " "type %s.\n", BAD_CAST des, xmlSchemaFacetTypeToString(facet->type), - xmlSchemaFormatItemForReport(&strT, NULL, baseItem, NULL), + xmlSchemaFormatItemForReport(&strT, NULL, WXS_BASIC_CAST baseType, NULL), NULL, NULL); - if (itemDes == NULL) - FREE_AND_NULL(des); + FREE_AND_NULL(des); FREE_AND_NULL(strT); } @@ -2726,18 +2998,17 @@ xmlSchemaPIllegalFacetAtomicErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPIllegalFacetListUnionErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **itemDes, - xmlSchemaTypePtr item, + xmlSchemaTypePtr type, xmlSchemaFacetPtr facet) { xmlChar *des = NULL, *strT = NULL; - xmlSchemaPAquireDes(&des, itemDes, item, item->node); - xmlSchemaPErr(ctxt, item->node, error, + xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST type, + type->node); + xmlSchemaPErr(ctxt, type->node, error, "%s: The facet '%s' is not allowed.\n", BAD_CAST des, xmlSchemaFacetTypeToString(facet->type)); - if (itemDes == NULL) - FREE_AND_NULL(des); + FREE_AND_NULL(des); FREE_AND_NULL(strT); } @@ -2754,26 +3025,18 @@ xmlSchemaPIllegalFacetListUnionErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, const char *name1, const char *name2) { xmlChar *des = NULL; - if (ownerDes == NULL) - xmlSchemaFormatItemForReport(&des, NULL, ownerItem, attr->parent); - else if (*ownerDes == NULL) { - xmlSchemaFormatItemForReport(ownerDes, NULL, ownerItem, attr->parent); - des = *ownerDes; - } else - des = *ownerDes; + xmlSchemaFormatItemForReport(&des, NULL, WXS_BASIC_CAST ownerItem, attr->parent); xmlSchemaPErrExt(ctxt, (xmlNodePtr) attr, error, NULL, NULL, NULL, "%s: The attributes '%s' and '%s' are mutually exclusive.\n", BAD_CAST des, BAD_CAST name1, BAD_CAST name2, NULL, NULL); - if (ownerDes == NULL) - FREE_AND_NULL(des) + FREE_AND_NULL(des); } /** @@ -2792,7 +3055,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlSchemaTypePtr ownerItem ATTRIBUTE_UNUSED, + xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED, xmlNodePtr node, xmlSchemaTypePtr type, const char *expected, @@ -2819,11 +3082,11 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, else msg = xmlStrcat(msg, BAD_CAST "the "); - if (VARIETY_ATOMIC(type)) + if (WXS_IS_ATOMIC(type)) msg = xmlStrcat(msg, BAD_CAST "atomic type"); - else if (VARIETY_LIST(type)) + else if (WXS_IS_LIST(type)) msg = xmlStrcat(msg, BAD_CAST "list type"); - else if (VARIETY_UNION(type)) + else if (WXS_IS_UNION(type)) msg = xmlStrcat(msg, BAD_CAST "union type"); if (xmlSchemaIsGlobalItem(type)) { @@ -2882,8 +3145,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, static void xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, xmlNodePtr child, const char *message, @@ -2891,13 +3153,7 @@ xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt, { xmlChar *des = NULL; - if (ownerDes == NULL) - xmlSchemaFormatItemForReport(&des, NULL, ownerItem, ownerElem); - else if (*ownerDes == NULL) { - xmlSchemaFormatItemForReport(ownerDes, NULL, ownerItem, ownerElem); - des = *ownerDes; - } else - des = *ownerDes; + xmlSchemaFormatItemForReport(&des, NULL, ownerItem, ownerElem); if (message != NULL) xmlSchemaPErr2(ctxt, ownerElem, child, error, "%s: %s.\n", @@ -2913,8 +3169,7 @@ xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt, BAD_CAST des, NULL); } } - if (ownerDes == NULL) - FREE_AND_NULL(des) + FREE_AND_NULL(des) } /************************************************************************ @@ -3056,76 +3311,207 @@ xmlSchemaItemListAdd(xmlSchemaItemListPtr list, void *item) return(-1); } } - /* ((xmlSchemaBasicItemPtr *) list->items)[list->nbItems++] = (void *) item; */ list->items[list->nbItems++] = item; return(0); } -/** - * xmlSchemaItemListFree: - * @annot: a schema type structure - * - * Deallocate a annotation structure - */ -static void -xmlSchemaItemListFree(xmlSchemaItemListPtr list) -{ - if (list == NULL) - return; - if (list->items != NULL) - xmlFree(list->items); - xmlFree(list); -} - -static void -xmlSchemaBucketFree(xmlSchemaBucketPtr bucket) +static int +xmlSchemaItemListAddSize(xmlSchemaItemListPtr list, + int initialSize, + void *item) { - if (bucket == NULL) - return; - if (bucket->globals != NULL) { - xmlSchemaComponentListFree(bucket->globals); - xmlSchemaItemListFree(bucket->globals); - } - if (bucket->locals != NULL) { - xmlSchemaComponentListFree(bucket->locals); - xmlSchemaItemListFree(bucket->locals); - } - if (bucket->relations != NULL) { - xmlSchemaSchemaRelationPtr prev, cur = bucket->relations; - do { - prev = cur; - cur = cur->next; - xmlFree(prev); - } while (cur != NULL); - } - if ((! bucket->preserveDoc) && (bucket->doc != NULL)) { - xmlFreeDoc(bucket->doc); - } - if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) { - if (IMPBUCKET_CAST(bucket)->schema != NULL) - xmlSchemaFree(IMPBUCKET_CAST(bucket)->schema); + if (list->items == NULL) { + if (initialSize <= 0) + initialSize = 1; + list->items = (void **) xmlMalloc( + initialSize * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "allocating new item list", NULL); + return(-1); + } + list->sizeItems = initialSize; + } else if (list->sizeItems <= list->nbItems) { + list->sizeItems *= 2; + list->items = (void **) xmlRealloc(list->items, + list->sizeItems * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "growing item list", NULL); + list->sizeItems = 0; + return(-1); + } } - xmlFree(bucket); + list->items[list->nbItems++] = item; + return(0); } -static xmlSchemaBucketPtr -xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, - int type, - const xmlChar *targetNamespace) -{ - xmlSchemaBucketPtr ret; - xmlSchemaConstructionCtxtPtr constr = pctxt->constructor; - int size; - xmlSchemaPtr mainSchema; +static int +xmlSchemaItemListInsert(xmlSchemaItemListPtr list, void *item, int idx) +{ + if (list->items == NULL) { + list->items = (void **) xmlMalloc( + 20 * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "allocating new item list", NULL); + return(-1); + } + list->sizeItems = 20; + } else if (list->sizeItems <= list->nbItems) { + list->sizeItems *= 2; + list->items = (void **) xmlRealloc(list->items, + list->sizeItems * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "growing item list", NULL); + list->sizeItems = 0; + return(-1); + } + } + /* + * Just append if the index is greater/equal than the item count. + */ + if (idx >= list->nbItems) { + list->items[list->nbItems++] = item; + } else { + int i; + for (i = list->nbItems; i > idx; i--) + list->items[i] = list->items[i-1]; + list->items[idx] = item; + list->nbItems++; + } + return(0); +} + +#if 0 /* enable if ever needed */ +static int +xmlSchemaItemListInsertSize(xmlSchemaItemListPtr list, + int initialSize, + void *item, + int idx) +{ + if (list->items == NULL) { + if (initialSize <= 0) + initialSize = 1; + list->items = (void **) xmlMalloc( + initialSize * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "allocating new item list", NULL); + return(-1); + } + list->sizeItems = initialSize; + } else if (list->sizeItems <= list->nbItems) { + list->sizeItems *= 2; + list->items = (void **) xmlRealloc(list->items, + list->sizeItems * sizeof(void *)); + if (list->items == NULL) { + xmlSchemaPErrMemory(NULL, "growing item list", NULL); + list->sizeItems = 0; + return(-1); + } + } + /* + * Just append if the index is greater/equal than the item count. + */ + if (idx >= list->nbItems) { + list->items[list->nbItems++] = item; + } else { + int i; + for (i = list->nbItems; i > idx; i--) + list->items[i] = list->items[i-1]; + list->items[idx] = item; + list->nbItems++; + } + return(0); +} +#endif + +static int +xmlSchemaItemListRemove(xmlSchemaItemListPtr list, int idx) +{ + int i; + if ((list->items == NULL) || (idx >= list->nbItems)) { + xmlSchemaPSimpleErr("Internal error: xmlSchemaItemListRemove, " + "index error.\n"); + return(-1); + } + + if (list->nbItems == 1) { + /* TODO: Really free the list? */ + xmlFree(list->items); + list->items = NULL; + list->nbItems = 0; + list->sizeItems = 0; + } else if (list->nbItems -1 == idx) { + list->nbItems--; + } else { + for (i = idx; i < list->nbItems -1; i++) + list->items[i] = list->items[i+1]; + list->nbItems--; + } + return(0); +} + +/** + * xmlSchemaItemListFree: + * @annot: a schema type structure + * + * Deallocate a annotation structure + */ +static void +xmlSchemaItemListFree(xmlSchemaItemListPtr list) +{ + if (list == NULL) + return; + if (list->items != NULL) + xmlFree(list->items); + xmlFree(list); +} + +static void +xmlSchemaBucketFree(xmlSchemaBucketPtr bucket) +{ + if (bucket == NULL) + return; + if (bucket->globals != NULL) { + xmlSchemaComponentListFree(bucket->globals); + xmlSchemaItemListFree(bucket->globals); + } + if (bucket->locals != NULL) { + xmlSchemaComponentListFree(bucket->locals); + xmlSchemaItemListFree(bucket->locals); + } + if (bucket->relations != NULL) { + xmlSchemaSchemaRelationPtr prev, cur = bucket->relations; + do { + prev = cur; + cur = cur->next; + xmlFree(prev); + } while (cur != NULL); + } + if ((! bucket->preserveDoc) && (bucket->doc != NULL)) { + xmlFreeDoc(bucket->doc); + } + if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) { + if (WXS_IMPBUCKET(bucket)->schema != NULL) + xmlSchemaFree(WXS_IMPBUCKET(bucket)->schema); + } + xmlFree(bucket); +} + +static xmlSchemaBucketPtr +xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, + int type, const xmlChar *targetNamespace) +{ + xmlSchemaBucketPtr ret; + int size; + xmlSchemaPtr mainSchema; - if (constr->schema == NULL) { + if (WXS_CONSTRUCTOR(pctxt)->mainSchema == NULL) { PERROR_INT("xmlSchemaBucketCreate", "no main schema on constructor"); return(NULL); } - mainSchema = constr->schema; + mainSchema = WXS_CONSTRUCTOR(pctxt)->mainSchema; /* Create the schema bucket. */ - if (WXS_IS_INCREDEF(type)) + if (WXS_IS_BUCKET_INCREDEF(type)) size = sizeof(xmlSchemaInclude); else size = sizeof(xmlSchemaImport); @@ -3137,13 +3523,23 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, memset(ret, 0, size); ret->targetNamespace = targetNamespace; ret->type = type; + ret->globals = xmlSchemaItemListCreate(); + if (ret->globals == NULL) { + xmlFree(ret); + return(NULL); + } + ret->locals = xmlSchemaItemListCreate(); + if (ret->locals == NULL) { + xmlFree(ret); + return(NULL); + } /* * The following will assure that only the first bucket is marked as * XML_SCHEMA_SCHEMA_MAIN and it points to the *main* schema. * For each following import buckets an xmlSchema will be created. */ if (! WXS_HAS_BUCKETS(pctxt)) { - if (WXS_IS_INCREDEF(type)) { + if (WXS_IS_BUCKET_INCREDEF(type)) { PERROR_INT("xmlSchemaBucketCreate", "first bucket but it's an include or redefine"); xmlSchemaBucketFree(ret); @@ -3152,7 +3548,8 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ ret->type = XML_SCHEMA_SCHEMA_MAIN; /* Point to the *main* schema. */ - IMPBUCKET_CAST(ret)->schema = mainSchema; + WXS_CONSTRUCTOR(pctxt)->mainBucket = ret; + WXS_IMPBUCKET(ret)->schema = mainSchema; } else { if (type == XML_SCHEMA_SCHEMA_MAIN) { PERROR_INT("xmlSchemaBucketCreate", @@ -3163,18 +3560,19 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, /* * Create a schema for imports. */ - IMPBUCKET_CAST(ret)->schema = xmlSchemaNewSchema(pctxt); - if (IMPBUCKET_CAST(ret)->schema == NULL) { + WXS_IMPBUCKET(ret)->schema = xmlSchemaNewSchema(pctxt); + if (WXS_IMPBUCKET(ret)->schema == NULL) { xmlSchemaBucketFree(ret); return(NULL); } } } - if (WXS_IS_IMPMAIN(type)) { + if (WXS_IS_BUCKET_IMPMAIN(type)) { int res; - /* Imports got into the "schemasImports" slot of the main *schema*. */ + /* Imports go into the "schemasImports" slot of the main *schema*. */ if (mainSchema->schemasImports == NULL) { - mainSchema->schemasImports = xmlHashCreateDict(5, constr->dict); + mainSchema->schemasImports = xmlHashCreateDict(5, + WXS_CONSTRUCTOR(pctxt)->dict); if (mainSchema->schemasImports == NULL) { xmlSchemaBucketFree(ret); return(NULL); @@ -3194,12 +3592,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, } } else { /* Set the @ownerImport of an include bucket. */ - if (WXS_IS_IMPMAIN(constr->bucket->type)) - INCBUCKET_CAST(ret)->ownerImport = - IMPBUCKET_CAST(constr->bucket); + if (WXS_IS_BUCKET_IMPMAIN(WXS_CONSTRUCTOR(pctxt)->bucket->type)) + WXS_INCBUCKET(ret)->ownerImport = + WXS_IMPBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket); else - INCBUCKET_CAST(ret)->ownerImport = - INCBUCKET_CAST(constr->bucket)->ownerImport; + WXS_INCBUCKET(ret)->ownerImport = + WXS_INCBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket)->ownerImport; /* Includes got into the "includes" slot of the *main* schema. */ if (mainSchema->includes == NULL) { @@ -3215,20 +3613,20 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, * Add to list of all buckets; this is used for lookup * during schema construction time only. */ - if (xmlSchemaItemListAdd(constr->buckets, ret) == -1) + if (xmlSchemaItemListAdd(WXS_CONSTRUCTOR(pctxt)->buckets, ret) == -1) return(NULL); return(ret); } static int -xmlSchemaAddItem(xmlSchemaItemListPtr *list, void *item) +xmlSchemaAddItemSize(xmlSchemaItemListPtr *list, int initialSize, void *item) { if (*list == NULL) { *list = xmlSchemaItemListCreate(); if (*list == NULL) return(-1); } - xmlSchemaItemListAdd(*list, item); + xmlSchemaItemListAddSize(*list, initialSize, item); return(0); } @@ -3272,9 +3670,9 @@ xmlSchemaFreeNotation(xmlSchemaNotationPtr nota) /** * xmlSchemaFreeAttribute: - * @schema: a schema attribute structure + * @attr: an attribute declaration * - * Deallocate a Schema Attribute structure. + * Deallocates an attribute declaration structure. */ static void xmlSchemaFreeAttribute(xmlSchemaAttributePtr attr) @@ -3288,6 +3686,38 @@ xmlSchemaFreeAttribute(xmlSchemaAttributePtr attr) xmlFree(attr); } +/** + * xmlSchemaFreeAttributeUse: + * @use: an attribute use + * + * Deallocates an attribute use structure. + */ +static void +xmlSchemaFreeAttributeUse(xmlSchemaAttributeUsePtr use) +{ + if (use == NULL) + return; + if (use->annot != NULL) + xmlSchemaFreeAnnot(use->annot); + if (use->defVal != NULL) + xmlSchemaFreeValue(use->defVal); + xmlFree(use); +} + +/** + * xmlSchemaFreeAttributeUseProhib: + * @prohib: an attribute use prohibition + * + * Deallocates an attribute use structure. + */ +static void +xmlSchemaFreeAttributeUseProhib(xmlSchemaAttributeUseProhibPtr prohib) +{ + if (prohib == NULL) + return; + xmlFree(prohib); +} + /** * xmlSchemaFreeWildcardNsSet: * set: a schema wildcard namespace @@ -3333,31 +3763,15 @@ xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard) * Deallocate a Schema Attribute Group structure. */ static void -xmlSchemaFreeAttributeGroup(xmlSchemaAttributeGroupPtr attr) +xmlSchemaFreeAttributeGroup(xmlSchemaAttributeGroupPtr attrGr) { - if (attr == NULL) + if (attrGr == NULL) return; - if (attr->annot != NULL) - xmlSchemaFreeAnnot(attr->annot); - xmlFree(attr); -} - -/** - * xmlSchemaFreeAttributeUseList: - * @attrUse: an attribute link - * - * Deallocate a list of schema attribute uses. - */ -static void -xmlSchemaFreeAttributeUseList(xmlSchemaAttributeLinkPtr attrUse) -{ - xmlSchemaAttributeLinkPtr next; - - while (attrUse != NULL) { - next = attrUse->next; - xmlFree(attrUse); - attrUse = next; - } + if (attrGr->annot != NULL) + xmlSchemaFreeAnnot(attrGr->annot); + if (attrGr->attrUses != NULL) + xmlSchemaItemListFree(WXS_LIST_CAST attrGr->attrUses); + xmlFree(attrGr); } /** @@ -3503,13 +3917,8 @@ xmlSchemaFreeType(xmlSchemaTypePtr type) facet = next; } } - if (type->type != XML_SCHEMA_TYPE_BASIC) { - /* - * TODO: Why is this restricted to non built-in types? - */ - if (type->attributeUses != NULL) - xmlSchemaFreeAttributeUseList(type->attributeUses); - } + if (type->attrUses != NULL) + xmlSchemaItemListFree((xmlSchemaItemListPtr) type->attrUses); if (type->memberTypes != NULL) xmlSchemaFreeTypeLinkList(type->memberTypes); if (type->facetSet != NULL) { @@ -3555,24 +3964,6 @@ xmlSchemaFreeModelGroup(xmlSchemaModelGroupPtr item) xmlFree(item); } -/** - * xmlSchemaFreeTypeList: - * @type: a schema type structure - * - * Deallocate a Schema Type structure. - */ -static void -xmlSchemaFreeTypeList(xmlSchemaTypePtr type) -{ - xmlSchemaTypePtr next; - - while (type != NULL) { - next = type->redef; - xmlSchemaFreeType(type); - type = next; - } -} - static void xmlSchemaComponentListFree(xmlSchemaItemListPtr list) { @@ -3590,11 +3981,18 @@ xmlSchemaComponentListFree(xmlSchemaItemListPtr list) switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: - xmlSchemaFreeTypeList((xmlSchemaTypePtr) item); + xmlSchemaFreeType((xmlSchemaTypePtr) item); break; case XML_SCHEMA_TYPE_ATTRIBUTE: xmlSchemaFreeAttribute((xmlSchemaAttributePtr) item); - break; + break; + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + xmlSchemaFreeAttributeUse((xmlSchemaAttributeUsePtr) item); + break; + case XML_SCHEMA_EXTRA_ATTR_USE_PROHIB: + xmlSchemaFreeAttributeUseProhib( + (xmlSchemaAttributeUseProhibPtr) item); + break; case XML_SCHEMA_TYPE_ELEMENT: xmlSchemaFreeElement((xmlSchemaElementPtr) item); break; @@ -3636,8 +4034,7 @@ xmlSchemaComponentListFree(xmlSchemaItemListPtr list) xmlSchemaPSimpleInternalErr(NULL, "Internal error: xmlSchemaComponentListFree, " "unexpected component type '%s'\n", - (const xmlChar *) - xmlSchemaCompTypeToString(item->type)); + (const xmlChar *) WXS_ITEM_TYPE_NAME(item)); } break; } @@ -3707,6 +4104,9 @@ xmlSchemaFree(xmlSchemaPtr schema) #ifdef LIBXML_OUTPUT_ENABLED +static void +xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output); /* forward */ + /** * xmlSchemaElementDump: * @elem: an element @@ -3723,20 +4123,15 @@ xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output, if (elem == NULL) return; - if (elem->flags & XML_SCHEMAS_ELEM_REF) { - fprintf(output, "Particle: %s", name); - fprintf(output, ", term element: %s", elem->ref); - if (elem->refNs != NULL) - fprintf(output, " ns %s", elem->refNs); - } else { - fprintf(output, "Element"); - if (elem->flags & XML_SCHEMAS_ELEM_GLOBAL) - fprintf(output, " (global)"); - fprintf(output, ": %s ", elem->name); - if (namespace != NULL) - fprintf(output, "ns %s", namespace); - } + + fprintf(output, "Element"); + if (elem->flags & XML_SCHEMAS_ELEM_GLOBAL) + fprintf(output, " (global)"); + fprintf(output, ": '%s' ", elem->name); + if (namespace != NULL) + fprintf(output, "ns '%s'", namespace); fprintf(output, "\n"); +#if 0 if ((elem->minOccurs != 1) || (elem->maxOccurs != 1)) { fprintf(output, " min %d ", elem->minOccurs); if (elem->maxOccurs >= UNBOUNDED) @@ -3746,14 +4141,14 @@ xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output, else fprintf(output, "\n"); } +#endif /* * Misc other properties. */ if ((elem->flags & XML_SCHEMAS_ELEM_NILLABLE) || (elem->flags & XML_SCHEMAS_ELEM_ABSTRACT) || (elem->flags & XML_SCHEMAS_ELEM_FIXED) || - (elem->flags & XML_SCHEMAS_ELEM_DEFAULT) || - (elem->id != NULL)) { + (elem->flags & XML_SCHEMAS_ELEM_DEFAULT)) { fprintf(output, " props: "); if (elem->flags & XML_SCHEMAS_ELEM_FIXED) fprintf(output, "[fixed] "); @@ -3763,8 +4158,6 @@ xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output, fprintf(output, "[abstract] "); if (elem->flags & XML_SCHEMAS_ELEM_NILLABLE) fprintf(output, "[nillable] "); - if (elem->id != NULL) - fprintf(output, "[id: '%s'] ", elem->id); fprintf(output, "\n"); } /* @@ -3776,19 +4169,24 @@ xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output, * Type. */ if (elem->namedType != NULL) { - fprintf(output, " type: %s ", elem->namedType); + fprintf(output, " type: '%s' ", elem->namedType); if (elem->namedTypeNs != NULL) - fprintf(output, "ns %s\n", elem->namedTypeNs); + fprintf(output, "ns '%s'\n", elem->namedTypeNs); else fprintf(output, "\n"); + } else if (elem->subtypes != NULL) { + /* + * Dump local types. + */ + xmlSchemaTypeDump(elem->subtypes, output); } /* * Substitution group. */ if (elem->substGroup != NULL) { - fprintf(output, " substitutionGroup: %s ", elem->substGroup); + fprintf(output, " substitutionGroup: '%s' ", elem->substGroup); if (elem->substGroupNs != NULL) - fprintf(output, "ns %s\n", elem->substGroupNs); + fprintf(output, "ns '%s'\n", elem->substGroupNs); else fprintf(output, "\n"); } @@ -3818,9 +4216,10 @@ xmlSchemaAnnotDump(FILE * output, xmlSchemaAnnotPtr annot) } /** - * xmlSchemaTypeDump: - * @output: the file output - * @type: a type structure + * xmlSchemaContentModelDump: + * @particle: the schema particle + * @output: the file output + * @depth: the depth used for intentation * * Dump a SchemaType structure */ @@ -3843,27 +4242,32 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept return; } term = particle->children; - switch (term->type) { - case XML_SCHEMA_TYPE_ELEMENT: - fprintf(output, "ELEM '%s'", xmlSchemaFormatQName(&str, - ((xmlSchemaElementPtr)term)->targetNamespace, - ((xmlSchemaElementPtr)term)->name)); - break; - case XML_SCHEMA_TYPE_SEQUENCE: - fprintf(output, "SEQUENCE"); - break; - case XML_SCHEMA_TYPE_CHOICE: - fprintf(output, "CHOICE"); - break; - case XML_SCHEMA_TYPE_ALL: - fprintf(output, "ALL"); - break; - case XML_SCHEMA_TYPE_ANY: - fprintf(output, "ANY"); - break; - default: - fprintf(output, "UNKNOWN\n"); - return; + if (term == NULL) { + fprintf(output, "(NULL)"); + } else { + switch (term->type) { + case XML_SCHEMA_TYPE_ELEMENT: + fprintf(output, "ELEM '%s'", xmlSchemaFormatQName(&str, + ((xmlSchemaElementPtr)term)->targetNamespace, + ((xmlSchemaElementPtr)term)->name)); + FREE_AND_NULL(str); + break; + case XML_SCHEMA_TYPE_SEQUENCE: + fprintf(output, "SEQUENCE"); + break; + case XML_SCHEMA_TYPE_CHOICE: + fprintf(output, "CHOICE"); + break; + case XML_SCHEMA_TYPE_ALL: + fprintf(output, "ALL"); + break; + case XML_SCHEMA_TYPE_ANY: + fprintf(output, "ANY"); + break; + default: + fprintf(output, "UNKNOWN\n"); + return; + } } if (particle->minOccurs != 1) fprintf(output, " min: %d", particle->minOccurs); @@ -3872,10 +4276,11 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept else if (particle->maxOccurs != 1) fprintf(output, " max: %d", particle->maxOccurs); fprintf(output, "\n"); - if (((term->type == XML_SCHEMA_TYPE_SEQUENCE) || - (term->type == XML_SCHEMA_TYPE_CHOICE) || - (term->type == XML_SCHEMA_TYPE_ALL)) && - (term->children != NULL)) { + if (term && + ((term->type == XML_SCHEMA_TYPE_SEQUENCE) || + (term->type == XML_SCHEMA_TYPE_CHOICE) || + (term->type == XML_SCHEMA_TYPE_ALL)) && + (term->children != NULL)) { xmlSchemaContentModelDump((xmlSchemaParticlePtr) term->children, output, depth +1); } @@ -3883,6 +4288,51 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept xmlSchemaContentModelDump((xmlSchemaParticlePtr) particle->next, output, depth); } + +/** + * xmlSchemaAttrUsesDump: + * @uses: attribute uses list + * @output: the file output + * + * Dumps a list of attribute use components. + */ +static void +xmlSchemaAttrUsesDump(xmlSchemaItemListPtr uses, FILE * output) +{ + xmlSchemaAttributeUsePtr use; + xmlSchemaAttributeUseProhibPtr prohib; + xmlSchemaQNameRefPtr ref; + const xmlChar *name, *tns; + xmlChar *str = NULL; + int i; + + if ((uses == NULL) || (uses->nbItems == 0)) + return; + + fprintf(output, " attributes:\n"); + for (i = 0; i < uses->nbItems; i++) { + use = uses->items[i]; + if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { + fprintf(output, " [prohibition] "); + prohib = (xmlSchemaAttributeUseProhibPtr) use; + name = prohib->name; + tns = prohib->targetNamespace; + } else if (use->type == XML_SCHEMA_EXTRA_QNAMEREF) { + fprintf(output, " [reference] "); + ref = (xmlSchemaQNameRefPtr) use; + name = ref->name; + tns = ref->targetNamespace; + } else { + fprintf(output, " [use] "); + name = WXS_ATTRUSE_DECL_NAME(use); + tns = WXS_ATTRUSE_DECL_TNS(use); + } + fprintf(output, "'%s'\n", + (const char *) xmlSchemaFormatQName(&str, tns, name)); + FREE_AND_NULL(str); + } +} + /** * xmlSchemaTypeDump: * @output: the file output @@ -3899,11 +4349,11 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output) } fprintf(output, "Type: "); if (type->name != NULL) - fprintf(output, "%s ", type->name); + fprintf(output, "'%s' ", type->name); else - fprintf(output, "no name "); + fprintf(output, "(no name) "); if (type->targetNamespace != NULL) - fprintf(output, "ns %s ", type->targetNamespace); + fprintf(output, "ns '%s' ", type->targetNamespace); switch (type->type) { case XML_SCHEMA_TYPE_BASIC: fprintf(output, "[basic] "); @@ -3965,12 +4415,14 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output) } fprintf(output, "\n"); if (type->base != NULL) { - fprintf(output, " base type: %s", type->base); + fprintf(output, " base type: '%s'", type->base); if (type->baseNs != NULL) - fprintf(output, " ns %s\n", type->baseNs); + fprintf(output, " ns '%s'\n", type->baseNs); else fprintf(output, "\n"); } + if (type->attrUses != NULL) + xmlSchemaAttrUsesDump(type->attrUses, output); if (type->annot != NULL) xmlSchemaAnnotDump(output, type->annot); #ifdef DUMP_CONTENT_MODEL @@ -4010,14 +4462,13 @@ xmlSchemaDump(FILE * output, xmlSchemaPtr schema) fprintf(output, "\n"); if (schema->annot != NULL) xmlSchemaAnnotDump(output, schema->annot); - xmlHashScan(schema->typeDecl, (xmlHashScanner) xmlSchemaTypeDump, output); xmlHashScanFull(schema->elemDecl, (xmlHashScannerFull) xmlSchemaElementDump, output); } -#ifdef DEBUG_IDC +#ifdef DEBUG_IDC_NODE_TABLE /** * xmlSchemaDebugDumpIDCTable: * @vctxt: the WXS validation context @@ -4030,21 +4481,22 @@ xmlSchemaDebugDumpIDCTable(FILE * output, const xmlChar *localName, xmlSchemaPSVIIDCBindingPtr bind) { - xmlChar *str = NULL, *value; + xmlChar *str = NULL; + const xmlChar *value; xmlSchemaPSVIIDCNodePtr tab; xmlSchemaPSVIIDCKeyPtr key; int i, j, res; - fprintf(output, "IDC: TABLES on %s\n", + fprintf(output, "IDC: TABLES on '%s'\n", xmlSchemaFormatQName(&str, namespaceName, localName)); FREE_AND_NULL(str) if (bind == NULL) return; do { - fprintf(output, "IDC: BINDING %s\n", - xmlSchemaFormatQName(&str, bind->definition->targetNamespace, - bind->definition->name)); + fprintf(output, "IDC: BINDING '%s' (%d)\n", + xmlSchemaGetComponentQName(&str, + bind->definition), bind->nbNodes); FREE_AND_NULL(str) for (i = 0; i < bind->nbNodes; i++) { tab = bind->nodeTable[i]; @@ -4054,7 +4506,7 @@ xmlSchemaDebugDumpIDCTable(FILE * output, if ((key != NULL) && (key->val != NULL)) { res = xmlSchemaGetCanonValue(key->val, &value); if (res >= 0) - fprintf(output, "\"%s\" ", value); + fprintf(output, "'%s' ", value); else fprintf(output, "CANON-VALUE-FAILED "); if (res == 0) @@ -4066,6 +4518,29 @@ xmlSchemaDebugDumpIDCTable(FILE * output, } fprintf(output, ")\n"); } + if (bind->dupls && bind->dupls->nbItems) { + fprintf(output, "IDC: dupls (%d):\n", bind->dupls->nbItems); + for (i = 0; i < bind->dupls->nbItems; i++) { + tab = bind->dupls->items[i]; + fprintf(output, " ( "); + for (j = 0; j < bind->definition->nbFields; j++) { + key = tab->keys[j]; + if ((key != NULL) && (key->val != NULL)) { + res = xmlSchemaGetCanonValue(key->val, &value); + if (res >= 0) + fprintf(output, "'%s' ", value); + else + fprintf(output, "CANON-VALUE-FAILED "); + if (res == 0) + FREE_AND_NULL(value) + } else if (key != NULL) + fprintf(output, "(no val), "); + else + fprintf(output, "(key missing), "); + } + fprintf(output, ")\n"); + } + } bind = bind->next; } while (bind != NULL); } @@ -4147,6 +4622,12 @@ xmlSchemaGetNodeContent(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node) return(ret); } +static const xmlChar * +xmlSchemaGetNodeContentNoDict(xmlNodePtr node) +{ + return((const xmlChar*) xmlNodeGetContent(node)); +} + /** * xmlSchemaGetProp: * @ctxt: the parser context @@ -4263,10 +4744,7 @@ xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name, WXS_FIND_GLOBAL_ITEM(typeDecl) } exit: - if ((ret != NULL) && (ret->redef != NULL)) { - /* Return the last redefinition. */ - ret = ret->redef; - } + #ifdef DEBUG if (ret == NULL) { if (nsName == NULL) @@ -4375,10 +4853,7 @@ xmlSchemaGetGroup(xmlSchemaPtr schema, const xmlChar * name, WXS_FIND_GLOBAL_ITEM(groupDecl) } exit: - if ((ret != NULL) && (ret->redef != NULL)) { - /* Return the last redefinition. */ - ret = ret->redef; - } + #ifdef DEBUG if (ret == NULL) { if (nsName == NULL) @@ -4491,19 +4966,94 @@ xmlSchemaIsBlank(xmlChar * str, int len) return (1); } -#define WXS_GET_GLOBAL_HASH(c, s, slot) \ -{ \ - if (WXS_IS_IMPMAIN((c)->type)) \ - table = &(IMPBUCKET_CAST((c))->schema->slot); \ - else \ - table = &(INCBUCKET_CAST((c))->ownerImport->schema->slot); \ -} \ - -#define WXS_INIT_GLOBAL_HASH(ctx, tbl) \ -if (*(tbl) == NULL) *(tbl) = xmlHashCreateDict(10, (ctx)->dict); \ -if (*(tbl) == NULL) { if (ret != NULL) xmlFree(ret); return (NULL); } - -/** +#define WXS_COMP_NAME(c, t) ((t) (c))->name +#define WXS_COMP_TNS(c, t) ((t) (c))->targetNamespace +/* +* xmlSchemaFindRedefCompInGraph: +* ATTENTION TODO: This uses pointer comp. for strings. +*/ +static xmlSchemaBasicItemPtr +xmlSchemaFindRedefCompInGraph(xmlSchemaBucketPtr bucket, + xmlSchemaTypeType type, + const xmlChar *name, + const xmlChar *nsName) +{ + xmlSchemaBasicItemPtr ret; + int i; + + if ((bucket == NULL) || (name == NULL)) + return(NULL); + if ((bucket->globals == NULL) || + (bucket->globals->nbItems == 0)) + goto subschemas; + /* + * Search in global components. + */ + for (i = 0; i < bucket->globals->nbItems; i++) { + ret = bucket->globals->items[i]; + if (ret->type == type) { + switch (type) { + case XML_SCHEMA_TYPE_COMPLEX: + case XML_SCHEMA_TYPE_SIMPLE: + if ((WXS_COMP_NAME(ret, xmlSchemaTypePtr) == name) && + (WXS_COMP_TNS(ret, xmlSchemaTypePtr) == + nsName)) + { + return(ret); + } + break; + case XML_SCHEMA_TYPE_GROUP: + if ((WXS_COMP_NAME(ret, + xmlSchemaModelGroupDefPtr) == name) && + (WXS_COMP_TNS(ret, + xmlSchemaModelGroupDefPtr) == nsName)) + { + return(ret); + } + break; + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + if ((WXS_COMP_NAME(ret, + xmlSchemaAttributeGroupPtr) == name) && + (WXS_COMP_TNS(ret, + xmlSchemaAttributeGroupPtr) == nsName)) + { + return(ret); + } + break; + default: + /* Should not be hit. */ + return(NULL); + } + } + } +subschemas: + /* + * Process imported/included schemas. + */ + if (bucket->relations != NULL) { + xmlSchemaSchemaRelationPtr rel = bucket->relations; + + /* + * TODO: Marking the bucket will not avoid multiple searches + * in the same schema, but avoids at least circularity. + */ + bucket->flags |= XML_SCHEMA_BUCKET_MARKED; + do { + if ((rel->bucket != NULL) && + ((rel->bucket->flags & XML_SCHEMA_BUCKET_MARKED) == 0)) { + ret = xmlSchemaFindRedefCompInGraph(rel->bucket, + type, name, nsName); + if (ret != NULL) + return(ret); + } + rel = rel->next; + } while (rel != NULL); + bucket->flags ^= XML_SCHEMA_BUCKET_MARKED; + } + return(NULL); +} + +/** * xmlSchemaAddNotation: * @ctxt: a schema parser context * @schema: the schema being built @@ -4516,18 +5066,14 @@ if (*(tbl) == NULL) { if (ret != NULL) xmlFree(ret); return (NULL); } */ static xmlSchemaNotationPtr xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - const xmlChar *name) + const xmlChar *name, const xmlChar *nsName, + xmlNodePtr node ATTRIBUTE_UNUSED) { xmlSchemaNotationPtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) return (NULL); - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, notaDecl) - - WXS_INIT_GLOBAL_HASH(ctxt, table) ret = (xmlSchemaNotationPtr) xmlMalloc(sizeof(xmlSchemaNotation)); if (ret == NULL) { xmlSchemaPErrMemory(ctxt, "add annotation", NULL); @@ -4535,18 +5081,11 @@ xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } memset(ret, 0, sizeof(xmlSchemaNotation)); ret->type = XML_SCHEMA_TYPE_NOTATION; - ret->name = xmlDictLookup(ctxt->dict, name, -1); - - val = xmlHashAddEntry(*table, ret->name, ret); - if (val != 0) { - xmlSchemaPErr(ctxt, (xmlNodePtr) ctxt->doc, - XML_SCHEMAP_REDEFINED_NOTATION, - "A notation declaration with the name '%s' does already exist.\n", - name, NULL); - xmlFree(ret); - return (NULL); - } - ADD_GLOBAL_ITEM(ctxt, ret); + ret->name = name; + ret->targetNamespace = nsName; + /* TODO: do we need the node to be set? + * ret->node = node;*/ + WXS_ADD_GLOBAL(ctxt, ret); return (ret); } @@ -4568,8 +5107,6 @@ xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlNodePtr node, int topLevel) { xmlSchemaAttributePtr ret = NULL; - int val; - xmlHashTablePtr *table; if ((ctxt == NULL) || (schema == NULL)) return (NULL); @@ -4580,86 +5117,138 @@ xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, return (NULL); } memset(ret, 0, sizeof(xmlSchemaAttribute)); - ret->name = xmlDictLookup(ctxt->dict, name, -1); + ret->type = XML_SCHEMA_TYPE_ATTRIBUTE; + ret->node = node; + ret->name = name; ret->targetNamespace = nsName; - if (topLevel) { - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, attrDecl) - WXS_INIT_GLOBAL_HASH(ctxt, table) - val = xmlHashAddEntry(*table, name, ret); - if (val != 0) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_REDEFINED_ATTR, - NULL, NULL, node, - "A global attribute declaration with the name '%s' does " - "already exist", name); - xmlFree(ret); - return (NULL); - } - ADD_GLOBAL_ITEM(ctxt, ret); - } else - ADD_LOCAL_ITEM(ctxt, ret); - WXS_ADD_PENDING_ITEM(ctxt, ret); + if (topLevel) + WXS_ADD_GLOBAL(ctxt, ret); + else + WXS_ADD_LOCAL(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); + return (ret); +} + +/** + * xmlSchemaAddAttributeUse: + * @ctxt: a schema parser context + * @schema: the schema being built + * @name: the item name + * @namespace: the namespace + * + * Add an XML schema Attrribute declaration + * *WARNING* this interface is highly subject to change + * + * Returns the new struture or NULL in case of error + */ +static xmlSchemaAttributeUsePtr +xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt, + xmlNodePtr node) +{ + xmlSchemaAttributeUsePtr ret = NULL; + + if (pctxt == NULL) + return (NULL); + + ret = (xmlSchemaAttributeUsePtr) xmlMalloc(sizeof(xmlSchemaAttributeUse)); + if (ret == NULL) { + xmlSchemaPErrMemory(pctxt, "allocating attribute", NULL); + return (NULL); + } + memset(ret, 0, sizeof(xmlSchemaAttributeUse)); + ret->type = XML_SCHEMA_TYPE_ATTRIBUTE_USE; + ret->node = node; + + WXS_ADD_LOCAL(pctxt, ret); + return (ret); +} + +/* +* xmlSchemaAddRedef: +* +* Adds a redefinition information. This is used at a later stage to: +* resolve references to the redefined components and to check constraints. +*/ +static xmlSchemaRedefPtr +xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaBucketPtr targetBucket, + void *item, + const xmlChar *refName, + const xmlChar *refTargetNs) +{ + xmlSchemaRedefPtr ret; + + ret = (xmlSchemaRedefPtr) + xmlMalloc(sizeof(xmlSchemaRedef)); + if (ret == NULL) { + xmlSchemaPErrMemory(pctxt, + "allocating redefinition info", NULL); + return (NULL); + } + memset(ret, 0, sizeof(xmlSchemaRedef)); + ret->item = item; + ret->targetBucket = targetBucket; + ret->refName = refName; + ret->refTargetNs = refTargetNs; + if (WXS_CONSTRUCTOR(pctxt)->redefs == NULL) + WXS_CONSTRUCTOR(pctxt)->redefs = ret; + else + WXS_CONSTRUCTOR(pctxt)->lastRedef->next = ret; + WXS_CONSTRUCTOR(pctxt)->lastRedef = ret; + return (ret); } /** - * xmlSchemaAddAttributeGroup: + * xmlSchemaAddAttributeGroupDefinition: * @ctxt: a schema parser context * @schema: the schema being built * @name: the item name + * @nsName: the target namespace + * @node: the corresponding node * - * Add an XML schema Attrribute Group declaration + * Add an XML schema Attrribute Group definition. * * Returns the new struture or NULL in case of error */ static xmlSchemaAttributeGroupPtr -xmlSchemaAddAttributeGroup(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaPtr schema, - const xmlChar * name, - xmlNodePtr node, - int topLevel) +xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema ATTRIBUTE_UNUSED, + const xmlChar *name, + const xmlChar *nsName, + xmlNodePtr node) { xmlSchemaAttributeGroupPtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; - if ((ctxt == NULL) || (schema == NULL)) + if ((pctxt == NULL) || (name == NULL)) return (NULL); ret = (xmlSchemaAttributeGroupPtr) xmlMalloc(sizeof(xmlSchemaAttributeGroup)); if (ret == NULL) { - xmlSchemaPErrMemory(ctxt, "allocating attribute group", NULL); + xmlSchemaPErrMemory(pctxt, "allocating attribute group", NULL); return (NULL); } memset(ret, 0, sizeof(xmlSchemaAttributeGroup)); ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP; - ret->node = node; - - if (topLevel) { - ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL; - ret->name = xmlDictLookup(ctxt->dict, name, -1); - ret->targetNamespace = ctxt->targetNamespace; - - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, attrgrpDecl) - WXS_INIT_GLOBAL_HASH(ctxt, table) - - val = xmlHashAddEntry(*table, name, ret); - if (val != 0) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_REDEFINED_ATTRGROUP, - NULL, NULL, node, - "A global attribute group definition with the name '%s' " - "does already exist", name); + ret->name = name; + ret->targetNamespace = nsName; + ret->node = node; + + /* TODO: Remove the flag. */ + ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL; + if (pctxt->isRedefine) { + pctxt->redef = xmlSchemaAddRedef(pctxt, pctxt->redefined, + ret, name, nsName); + if (pctxt->redef == NULL) { xmlFree(ret); - return (NULL); - } - ADD_GLOBAL_ITEM(ctxt, ret); - } else - ADD_LOCAL_ITEM(ctxt, ret); - - WXS_ADD_PENDING_ITEM(ctxt, ret); + return(NULL); + } + pctxt->redefCounter = 0; + } + WXS_ADD_GLOBAL(pctxt, ret); + WXS_ADD_PENDING(pctxt, ret); return (ret); } @@ -4676,15 +5265,13 @@ xmlSchemaAddAttributeGroup(xmlSchemaParserCtxtPtr ctxt, * Returns the new struture or NULL in case of error */ static xmlSchemaElementPtr -xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, +xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, const xmlChar * name, const xmlChar * nsName, xmlNodePtr node, int topLevel) { xmlSchemaElementPtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; - if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) + if ((ctxt == NULL) || (name == NULL)) return (NULL); ret = (xmlSchemaElementPtr) xmlMalloc(sizeof(xmlSchemaElement)); @@ -4693,26 +5280,16 @@ xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, return (NULL); } memset(ret, 0, sizeof(xmlSchemaElement)); - ret->name = xmlDictLookup(ctxt->dict, name, -1); + ret->type = XML_SCHEMA_TYPE_ELEMENT; + ret->name = name; ret->targetNamespace = nsName; + ret->node = node; - if (topLevel) { - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, elemDecl) - WXS_INIT_GLOBAL_HASH(ctxt, table) - val = xmlHashAddEntry(*table, name, ret); - if (val != 0) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_REDEFINED_ELEMENT, - NULL, NULL, node, - "A global element declaration with the name '%s' does " - "already exist", name); - xmlFree(ret); - return (NULL); - } - ADD_GLOBAL_ITEM(ctxt, ret); - } else - ADD_LOCAL_ITEM(ctxt, ret); - WXS_ADD_PENDING_ITEM(ctxt, ret); + if (topLevel) + WXS_ADD_GLOBAL(ctxt, ret); + else + WXS_ADD_LOCAL(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -4730,12 +5307,11 @@ xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ static xmlSchemaTypePtr xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, + xmlSchemaTypeType type, const xmlChar * name, const xmlChar * nsName, xmlNodePtr node, int topLevel) { xmlSchemaTypePtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; if ((ctxt == NULL) || (schema == NULL)) return (NULL); @@ -4746,53 +5322,24 @@ xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, return (NULL); } memset(ret, 0, sizeof(xmlSchemaType)); - if (name != NULL) - ret->name = xmlDictLookup(ctxt->dict, name, -1); + ret->type = type; + ret->name = name; ret->targetNamespace = nsName; ret->node = node; - /* TODO: Get rid of occurences here. */ - ret->minOccurs = 1; - ret->maxOccurs = 1; - if (topLevel) { - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, typeDecl) - WXS_INIT_GLOBAL_HASH(ctxt, table) - val = xmlHashAddEntry(*table, name, ret); - if (val != 0) { - if (! ctxt->isRedefine) { - xmlChar *str = NULL; - - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_REDEFINED_TYPE, - NULL, NULL, node, - "A global type definition with the name '%s' does " - "already exist", - xmlSchemaFormatQName(&str, nsName, name)); - FREE_AND_NULL(str); - xmlFree(ret); - return (NULL); - } else { - xmlSchemaTypePtr prev; - - /* REDEFINE: Add a redefinition. */ - TODO - prev = xmlHashLookup(*table, name); - if (prev == NULL) { - PERROR_INT2("xmlSchemaAddType", "hash list did not " - "return a redefined type component, but should"); - xmlFree(ret); - return (NULL); - } - ret->redef = prev->redef; - prev->redef = ret; - /* TODO: Add to locals; dunno if this will make trouble. */ - ADD_LOCAL_ITEM(ctxt, ret); - } - } else - ADD_GLOBAL_ITEM(ctxt, ret); + if (ctxt->isRedefine) { + ctxt->redef = xmlSchemaAddRedef(ctxt, ctxt->redefined, + ret, name, nsName); + if (ctxt->redef == NULL) { + xmlFree(ret); + return(NULL); + } + ctxt->redefCounter = 0; + } + WXS_ADD_GLOBAL(ctxt, ret); } else - ADD_LOCAL_ITEM(ctxt, ret); - WXS_ADD_PENDING_ITEM(ctxt, ret); + WXS_ADD_LOCAL(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -4811,6 +5358,7 @@ xmlSchemaNewQNameRef(xmlSchemaParserCtxtPtr pctxt, "allocating QName reference item", NULL); return (NULL); } + ret->node = NULL; ret->type = XML_SCHEMA_EXTRA_QNAMEREF; ret->name = refName; ret->targetNamespace = refNs; @@ -4819,10 +5367,29 @@ xmlSchemaNewQNameRef(xmlSchemaParserCtxtPtr pctxt, /* * Store the reference item in the schema. */ - ADD_LOCAL_ITEM(pctxt, ret); + WXS_ADD_LOCAL(pctxt, ret); return (ret); } +static xmlSchemaAttributeUseProhibPtr +xmlSchemaAddAttributeUseProhib(xmlSchemaParserCtxtPtr pctxt) +{ + xmlSchemaAttributeUseProhibPtr ret; + + ret = (xmlSchemaAttributeUseProhibPtr) + xmlMalloc(sizeof(xmlSchemaAttributeUseProhib)); + if (ret == NULL) { + xmlSchemaPErrMemory(pctxt, + "allocating attribute use prohibition", NULL); + return (NULL); + } + memset(ret, 0, sizeof(xmlSchemaAttributeUseProhib)); + ret->type = XML_SCHEMA_EXTRA_ATTR_USE_PROHIB; + WXS_ADD_LOCAL(pctxt, ret); + return (ret); +} + + /** * xmlSchemaAddModelGroup: * @ctxt: a schema parser context @@ -4856,7 +5423,10 @@ xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt, memset(ret, 0, sizeof(xmlSchemaModelGroup)); ret->type = type; ret->node = node; - ADD_LOCAL_ITEM(ctxt, ret); + WXS_ADD_LOCAL(ctxt, ret); + if ((type == XML_SCHEMA_TYPE_SEQUENCE) || + (type == XML_SCHEMA_TYPE_CHOICE)) + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -4900,12 +5470,12 @@ xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ret->next = NULL; ret->children = NULL; - ADD_LOCAL_ITEM(ctxt, ret); + WXS_ADD_LOCAL(ctxt, ret); /* * Note that addition to pending components will be done locally * to the specific parsing function, since the most particles * need not to be fixed up (i.e. the reference to be resolved). - * REMOVED: WXS_ADD_PENDING_ITEM(ctxt, ret); + * REMOVED: WXS_ADD_PENDING(ctxt, ret); */ return (ret); } @@ -4928,15 +5498,10 @@ xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node) { xmlSchemaModelGroupDefPtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) return (NULL); - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, groupDecl) - WXS_INIT_GLOBAL_HASH(ctxt, table) - ret = (xmlSchemaModelGroupDefPtr) xmlMalloc(sizeof(xmlSchemaModelGroupDef)); if (ret == NULL) { @@ -4944,23 +5509,22 @@ xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, return (NULL); } memset(ret, 0, sizeof(xmlSchemaModelGroupDef)); - ret->name = xmlDictLookup(ctxt->dict, name, -1); + ret->name = name; ret->type = XML_SCHEMA_TYPE_GROUP; ret->node = node; ret->targetNamespace = nsName; - val = xmlHashAddEntry(*table, ret->name, ret); - if (val != 0) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_REDEFINED_GROUP, - NULL, NULL, node, - "A global model group definition with the name '%s' does " - "already exist", name); - xmlFree(ret); - return (NULL); + if (ctxt->isRedefine) { + ctxt->redef = xmlSchemaAddRedef(ctxt, ctxt->redefined, + ret, name, nsName); + if (ctxt->redef == NULL) { + xmlFree(ret); + return(NULL); + } + ctxt->redefCounter = 0; } - ADD_GLOBAL_ITEM(ctxt, ret); - WXS_ADD_PENDING_ITEM(ctxt, ret); + WXS_ADD_GLOBAL(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -4993,16 +5557,11 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, const xmlChar *name, const xmlChar *nsName, int category, xmlNodePtr node) { - xmlSchemaIDCPtr ret = NULL; - xmlHashTablePtr *table = NULL; - int val; + xmlSchemaIDCPtr ret = NULL; if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) return (NULL); - WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, idcDef) - WXS_INIT_GLOBAL_HASH(ctxt, table) - ret = (xmlSchemaIDCPtr) xmlMalloc(sizeof(xmlSchemaIDC)); if (ret == NULL) { xmlSchemaPErrMemory(ctxt, @@ -5016,25 +5575,12 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ret->type = category; ret->node = node; - val = xmlHashAddEntry(*table, ret->name, ret); - if (val != 0) { - xmlSchemaPCustomErrExt(ctxt, - /* TODO: Error code! */ - XML_SCHEMAP_REDEFINED_TYPE, - NULL, NULL, node, - "An identity-constraint definition with the name '%s' " - "and targetNamespace '%s' does already exist", - ret->name, ret->targetNamespace, NULL); - - xmlFree(ret); - return (NULL); - } - ADD_GLOBAL_ITEM(ctxt, ret); + WXS_ADD_GLOBAL(ctxt, ret); /* * Only keyrefs need to be fixup up. */ if (category == XML_SCHEMA_TYPE_IDC_KEYREF) - WXS_ADD_PENDING_ITEM(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -5064,11 +5610,8 @@ xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } memset(ret, 0, sizeof(xmlSchemaWildcard)); ret->type = type; - ret->node = node; - ret->minOccurs = 1; - ret->maxOccurs = 1; - - ADD_LOCAL_ITEM(ctxt, ret); + ret->node = node; + WXS_ADD_LOCAL(ctxt, ret); return (ret); } @@ -5187,8 +5730,7 @@ xmlSchemaAddElementSubstitutionMember(xmlSchemaParserCtxtPtr pctxt, static int xmlSchemaPValAttrNodeQNameValue(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlChar **ownerDes ATTRIBUTE_UNUSED, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, const xmlChar *value, const xmlChar **uri, @@ -5269,8 +5811,7 @@ xmlSchemaPValAttrNodeQNameValue(xmlSchemaParserCtxtPtr ctxt, static int xmlSchemaPValAttrNodeQName(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, const xmlChar **uri, const xmlChar **local) @@ -5279,7 +5820,7 @@ xmlSchemaPValAttrNodeQName(xmlSchemaParserCtxtPtr ctxt, value = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); return (xmlSchemaPValAttrNodeQNameValue(ctxt, schema, - ownerDes, ownerItem, attr, value, uri, local)); + ownerItem, attr, value, uri, local)); } /** @@ -5301,8 +5842,7 @@ xmlSchemaPValAttrNodeQName(xmlSchemaParserCtxtPtr ctxt, static int xmlSchemaPValAttrQName(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, const xmlChar **uri, @@ -5317,7 +5857,7 @@ xmlSchemaPValAttrQName(xmlSchemaParserCtxtPtr ctxt, return (0); } return (xmlSchemaPValAttrNodeQName(ctxt, schema, - ownerDes, ownerItem, attr, uri, local)); + ownerItem, attr, uri, local)); } /** @@ -5335,25 +5875,15 @@ xmlSchemaPValAttrQName(xmlSchemaParserCtxtPtr ctxt, * if not valid and -1 if an internal error occurs. */ static int -xmlSchemaPValAttrID(xmlSchemaParserCtxtPtr ctxt, - xmlChar **ownerDes ATTRIBUTE_UNUSED, - xmlSchemaTypePtr ownerItem, - xmlNodePtr ownerElem, - const xmlChar *name) +xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, xmlAttrPtr attr) { int ret; - xmlChar *value; - xmlAttrPtr attr; - - value = xmlGetNoNsProp(ownerElem, name); - if (value == NULL) - return (0); + const xmlChar *value; - attr = xmlSchemaGetPropNode(ownerElem, (const char *) name); if (attr == NULL) - return (-1); - - ret = xmlValidateNCName(BAD_CAST value, 1); + return(0); + value = xmlSchemaGetNodeContentNoDict((xmlNodePtr) attr); + ret = xmlValidateNCName(value, 1); if (ret == 0) { /* * NOTE: the IDness might have already be declared in the DTD @@ -5366,38 +5896,53 @@ xmlSchemaPValAttrID(xmlSchemaParserCtxtPtr ctxt, * TODO: Use xmlSchemaStrip here; it's not exported at this * moment. */ - strip = xmlSchemaCollapseString(BAD_CAST value); - if (strip != NULL) + strip = xmlSchemaCollapseString(value); + if (strip != NULL) { + xmlFree((xmlChar *) value); value = strip; - res = xmlAddID(NULL, ownerElem->doc, BAD_CAST value, attr); + } + res = xmlAddID(NULL, attr->doc, value, attr); if (res == NULL) { ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - ownerItem, (xmlNodePtr) attr, + NULL, (xmlNodePtr) attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_ID), NULL, NULL, "Duplicate value '%s' of simple " - "type 'xs:ID'", BAD_CAST value, NULL); + "type 'xs:ID'", value, NULL); } else attr->atype = XML_ATTRIBUTE_ID; - if (strip != NULL) - xmlFree(strip); } } else if (ret > 0) { ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - ownerItem, (xmlNodePtr) attr, + NULL, (xmlNodePtr) attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_ID), NULL, NULL, "The value '%s' of simple type 'xs:ID' is " "not a valid 'xs:NCName'", - BAD_CAST value, NULL); + value, NULL); } - xmlFree(value); + if (value != NULL) + xmlFree((xmlChar *)value); return (ret); } +static int +xmlSchemaPValAttrID(xmlSchemaParserCtxtPtr ctxt, + xmlNodePtr ownerElem, + const xmlChar *name) +{ + xmlAttrPtr attr; + + attr = xmlSchemaGetPropNode(ownerElem, (const char *) name); + if (attr == NULL) + return(0); + return(xmlSchemaPValAttrNodeID(ctxt, attr)); + +} + /** * xmlGetMaxOccurs: * @ctxt: a schema validation context @@ -5528,8 +6073,7 @@ xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, */ static int xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt, - xmlChar **ownerDes ATTRIBUTE_UNUSED, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr node) { xmlChar *value = NULL; @@ -5576,8 +6120,6 @@ xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt, */ static int xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, - xmlChar **ownerDes ATTRIBUTE_UNUSED, - xmlSchemaTypePtr ownerItem, xmlNodePtr node, const char *name, int def) { @@ -5602,7 +6144,7 @@ xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, else { xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_INVALID_BOOLEAN, - ownerItem, + NULL, (xmlNodePtr) xmlSchemaGetPropNode(node, name), xmlSchemaGetBuiltInType(XML_SCHEMAS_BOOLEAN), NULL, val, NULL, NULL, NULL); @@ -5629,15 +6171,12 @@ static xmlSchemaTypePtr xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr xmlSchemaPtr schema, xmlNodePtr node, xmlSchemaTypeType parentType); -static xmlSchemaAttributePtr xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr - ctxt, - xmlSchemaPtr schema, - xmlNodePtr node, - int topLevel); -static xmlSchemaAttributeGroupPtr -xmlSchemaParseAttributeGroup(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaPtr schema, xmlNodePtr node, - int topLevel); +static xmlSchemaBasicItemPtr +xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node, + xmlSchemaItemListPtr uses, + int parentType); static xmlSchemaTypePtr xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlNodePtr node); @@ -5664,8 +6203,7 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, */ static int xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, - xmlChar **ownerDes ATTRIBUTE_UNUSED, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, const xmlChar *value, xmlSchemaTypePtr type) @@ -5695,7 +6233,8 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, break; default: { PERROR_INT("xmlSchemaPValAttrNodeValue", - "validation using the given type is not supported"); + "validation using the given type is not supported while " + "parsing a schema"); return (-1); } } @@ -5707,7 +6246,7 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, "failed to validate a schema attribute value"); return (-1); } else if (ret > 0) { - if (VARIETY_LIST(type)) + if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; @@ -5737,8 +6276,7 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, */ static int xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, + xmlSchemaBasicItemPtr ownerItem, xmlAttrPtr attr, xmlSchemaTypePtr type, const xmlChar **value) @@ -5752,7 +6290,7 @@ xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt, if (value != NULL) *value = val; - return (xmlSchemaPValAttrNodeValue(ctxt, ownerDes, ownerItem, attr, + return (xmlSchemaPValAttrNodeValue(ctxt, ownerItem, attr, val, type)); } @@ -5776,9 +6314,8 @@ xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt, * number otherwise and -1 in case of an internal or API error. */ static int -xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, - xmlChar **ownerDes, - xmlSchemaTypePtr ownerItem, +xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, + xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, xmlSchemaTypePtr type, @@ -5807,7 +6344,7 @@ xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, *value = NULL; return (0); } - return (xmlSchemaPValAttrNode(ctxt, ownerDes, ownerItem, attr, + return (xmlSchemaPValAttrNode(ctxt, ownerItem, attr, type, value)); } @@ -5815,87 +6352,90 @@ static int xmlSchemaCheckReference(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema ATTRIBUTE_UNUSED, xmlNodePtr node, - xmlSchemaBasicItemPtr item, + xmlAttrPtr attr, const xmlChar *namespaceName) { /* TODO: Pointer comparison instead? */ if (xmlStrEqual(pctxt->targetNamespace, namespaceName)) - return (1); + return (0); if (xmlStrEqual(xmlSchemaNs, namespaceName)) - return (1); + return (0); /* * Check if the referenced namespace was ed. */ - if (WXS_SCHEMA_BUCKET(pctxt)->relations != NULL) { + if (WXS_BUCKET(pctxt)->relations != NULL) { xmlSchemaSchemaRelationPtr rel; - rel = WXS_SCHEMA_BUCKET(pctxt)->relations; + rel = WXS_BUCKET(pctxt)->relations; do { - if (WXS_IS_IMPMAIN(rel->type) && + if (WXS_IS_BUCKET_IMPMAIN(rel->type) && xmlStrEqual(namespaceName, rel->importNamespace)) - return (1); + return (0); rel = rel->next; } while (rel != NULL); } /* * No matching ed namespace found. */ - if (namespaceName == NULL) - xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_RESOLVE, - NULL, (xmlSchemaTypePtr) item, node, - "References from this schema to components in no " - "namespace are not valid, since not indicated by an import " - "statement", NULL); - else - xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_RESOLVE, - NULL, (xmlSchemaTypePtr) item, node, - "References from this schema to components in the " - "namespace '%s' are not valid, since not indicated by an import " - "statement", namespaceName); - return (0); + { + xmlNodePtr n = (attr != NULL) ? (xmlNodePtr) attr : node; + + if (namespaceName == NULL) + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_SRC_RESOLVE, n, NULL, + "References from this schema to components in no " + "namespace are not allowed, since not indicated by an " + "import statement", NULL, NULL); + else + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_SRC_RESOLVE, n, NULL, + "References from this schema to components in the " + "namespace '%s' are not allowed, since not indicated by an " + "import statement", namespaceName, NULL); + } + return (XML_SCHEMAP_SRC_RESOLVE); } /** - * xmlSchemaParseAttrDecls: + * xmlSchemaParseLocalAttributes: * @ctxt: a schema validation context * @schema: the schema being built * @node: a subtree containing XML Schema informations * @type: the hosting type where the attributes will be anchored * - * parse a XML schema attrDecls declaration corresponding to - * + * Parses attribute uses and attribute declarations and + * attribute group references. */ -static xmlNodePtr -xmlSchemaParseAttrDecls(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlNodePtr child, xmlSchemaTypePtr type) -{ - xmlSchemaAttributePtr lastattr = NULL, attr; - - while ((IS_SCHEMA(child, "attribute")) || - (IS_SCHEMA(child, "attributeGroup"))) { - attr = NULL; - if (IS_SCHEMA(child, "attribute")) { - attr = xmlSchemaParseAttribute(ctxt, schema, child, 0); - } else if (IS_SCHEMA(child, "attributeGroup")) { - attr = (xmlSchemaAttributePtr) - xmlSchemaParseAttributeGroup(ctxt, schema, child, 0); - } - if (attr != NULL) { - if (lastattr == NULL) { - if (type->type == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) - ((xmlSchemaAttributeGroupPtr) type)->attributes = attr; - else - type->attributes = attr; - lastattr = attr; - } else { - lastattr->next = attr; - lastattr = attr; - } +static int +xmlSchemaParseLocalAttributes(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, + xmlNodePtr *child, xmlSchemaItemListPtr *list, + int parentType, int *hasRefs) +{ + void *item; + + while ((IS_SCHEMA((*child), "attribute")) || + (IS_SCHEMA((*child), "attributeGroup"))) { + if (IS_SCHEMA((*child), "attribute")) { + item = xmlSchemaParseLocalAttribute(ctxt, schema, *child, + *list, parentType); + } else { + item = xmlSchemaParseAttributeGroupRef(ctxt, schema, *child); + if ((item != NULL) && (hasRefs != NULL)) + *hasRefs = 1; } - child = child->next; + if (item != NULL) { + if (*list == NULL) { + /* TODO: Customize grow factor. */ + *list = xmlSchemaItemListCreate(); + if (*list == NULL) + return(-1); + } + if (xmlSchemaItemListAddSize(*list, 2, item) == -1) + return(-1); + } + *child = (*child)->next; } - return (child); + return (0); } /** @@ -5912,7 +6452,7 @@ xmlSchemaParseAttrDecls(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ static xmlSchemaAnnotPtr xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlNodePtr node) + xmlNodePtr node, int needed) { xmlSchemaAnnotPtr ret; xmlNodePtr child = NULL; @@ -5929,7 +6469,10 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) return (NULL); - ret = xmlSchemaNewAnnot(ctxt, node); + if (needed) + ret = xmlSchemaNewAnnot(ctxt, node); + else + ret = NULL; attr = node->properties; while (attr != NULL) { if (((attr->ns == NULL) && @@ -5938,12 +6481,11 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlStrEqual(attr->ns->href, xmlSchemaNs))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... */ @@ -5964,12 +6506,11 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlStrEqual(attr->ns->href, xmlSchemaNs))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttr(ctxt, NULL, NULL, child, "source", + xmlSchemaPValAttr(ctxt, NULL, child, "source", xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), NULL); child = child->next; } else if (IS_SCHEMA(child, "documentation")) { @@ -5984,8 +6525,7 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (attr->ns == NULL) { if (!xmlStrEqual(attr->name, BAD_CAST "source")) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else { if (xmlStrEqual(attr->ns->href, xmlSchemaNs) || @@ -5993,8 +6533,7 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, (!xmlStrEqual(attr->ns->href, XML_XML_NAMESPACE)))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } attr = attr->next; @@ -6004,14 +6543,14 @@ xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ attr = xmlSchemaGetPropNodeNs(child, (const char *) XML_XML_NAMESPACE, "lang"); if (attr != NULL) - xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr, + xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_LANGUAGE), NULL); child = child->next; } else { if (!barked) xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, "(appinfo | documentation)*"); + NULL, node, child, NULL, "(appinfo | documentation)*"); barked = 1; child = child->next; } @@ -6085,8 +6624,7 @@ xmlSchemaParseFacet(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaFreeFacet(facet); return (NULL); } - xmlSchemaPValAttrID(ctxt, NULL, - (xmlSchemaTypePtr) facet, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); facet->value = value; if ((facet->type != XML_SCHEMA_FACET_PATTERN) && (facet->type != XML_SCHEMA_FACET_ENUMERATION)) { @@ -6101,7 +6639,7 @@ xmlSchemaParseFacet(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, child = node->children; if (IS_SCHEMA(child, "annotation")) { - facet->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + facet->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child != NULL) { @@ -6199,7 +6737,7 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt, /* * Validate the item (anyURI). */ - xmlSchemaPValAttrNodeValue(ctxt, NULL, NULL, attr, + xmlSchemaPValAttrNodeValue(ctxt, NULL, attr, nsItem, xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI)); dictnsItem = xmlDictLookup(ctxt->dict, nsItem, -1); } @@ -6317,17 +6855,15 @@ xmlSchemaParseAny(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && (!xmlStrEqual(attr->name, BAD_CAST "processContents"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * minOccurs/maxOccurs. */ @@ -6348,13 +6884,13 @@ xmlSchemaParseAny(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - annot = xmlSchemaParseAnnotation(ctxt, schema, child); + annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?)"); } /* @@ -6371,8 +6907,6 @@ xmlSchemaParseAny(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (particle == NULL) return (NULL); particle->annot = annot; - wild->minOccurs = min; - wild->maxOccurs = max; particle->children = (xmlSchemaTreeItemPtr) wild; return (particle); @@ -6404,29 +6938,26 @@ xmlSchemaParseNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, "Notation has no name\n", NULL, NULL); return (NULL); } - ret = xmlSchemaAddNotation(ctxt, schema, name); - if (ret == NULL) { + ret = xmlSchemaAddNotation(ctxt, schema, name, + ctxt->targetNamespace, node); + if (ret == NULL) return (NULL); - } - ret->targetNamespace = ctxt->targetNamespace; - - xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret, - node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); if (IS_SCHEMA(child, "annotation")) { - ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } child = node->children; if (IS_SCHEMA(child, "annotation")) { - ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?)"); } @@ -6470,18 +7001,15 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && (!xmlStrEqual(attr->name, BAD_CAST "processContents"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret, - node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Parse the namespace list. */ @@ -6492,13 +7020,13 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?)"); } @@ -6517,466 +7045,765 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, * * Returns the attribute declaration. */ -static xmlSchemaAttributePtr -xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlNodePtr node, int topLevel) +static xmlSchemaBasicItemPtr +xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node, + xmlSchemaItemListPtr uses, + int parentType) { - const xmlChar *name, *attrValue; - xmlChar *repName = NULL; /* The reported designation. */ - xmlSchemaAttributePtr ret; + const xmlChar *attrValue, *name = NULL, *ns = NULL; + xmlSchemaAttributeUsePtr use = NULL; xmlNodePtr child = NULL; - xmlAttrPtr attr, nameAttr; - int isRef = 0; + xmlAttrPtr attr; + const xmlChar *tmpNs = NULL, *tmpName = NULL, *defValue = NULL; + int isRef = 0, occurs = XML_SCHEMAS_ATTR_USE_OPTIONAL; + int nberrors, hasForm = 0, defValueType = 0; + +#define WXS_ATTR_DEF_VAL_DEFAULT 1 +#define WXS_ATTR_DEF_VAL_FIXED 2 /* - * Note that the w3c spec assumes the schema to be validated with schema - * for schemas beforehand. - * * 3.2.3 Constraints on XML Representations of Attribute Declarations */ - if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) + if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) return (NULL); attr = xmlSchemaGetPropNode(node, "ref"); - nameAttr = xmlSchemaGetPropNode(node, "name"); - - if ((attr == NULL) && (nameAttr == NULL)) { - /* - * 3.2.3 : 3.1 - * One of ref or name must be present, but not both - */ - xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_3_1, - NULL, node, NULL, - "One of the attributes 'ref' or 'name' must be present"); - return (NULL); - } - if ((topLevel) || (attr == NULL)) { - if (nameAttr == NULL) { - xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, - NULL, node, "name", NULL); + if (attr != NULL) { + if (xmlSchemaPValAttrNodeQName(pctxt, schema, + NULL, attr, &tmpNs, &tmpName) != 0) { return (NULL); } - } else + if (xmlSchemaCheckReference(pctxt, schema, node, attr, tmpNs) != 0) + return(NULL); isRef = 1; - - if (isRef) { -#ifdef ENABLE_NAMED_LOCALS - char buf[50]; -#endif - const xmlChar *refNs = NULL, *ref = NULL; - - /* - * Parse as attribute reference. - */ - if (xmlSchemaPValAttrNodeQName(ctxt, schema, - (xmlChar **) &xmlSchemaElemDesAttrRef, NULL, attr, &refNs, - &ref) != 0) { - return (NULL); - } -#ifdef ENABLE_NAMED_LOCALS - snprintf(buf, 49, "#aRef%d", ctxt->counter++ + 1); - name = (const xmlChar *) buf; - ret = xmlSchemaAddAttribute(ctxt, schema, name, NULL, node, 0); -#else - ret = xmlSchemaAddAttribute(ctxt, schema, NULL, NULL, node, 0); -#endif - - if (ret == NULL) { - if (repName != NULL) - xmlFree(repName); - return (NULL); - } - ret->type = XML_SCHEMA_TYPE_ATTRIBUTE; - ret->node = node; - ret->refNs = refNs; - ret->ref = ref; - xmlSchemaCheckReference(ctxt, schema, node, (xmlSchemaBasicItemPtr) ret, - refNs); - /* - xmlSchemaFormatTypeRep(&repName, (xmlSchemaTypePtr) ret, NULL, NULL); - */ - if (nameAttr != NULL) - xmlSchemaPMutualExclAttrErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_3_1, - &repName, (xmlSchemaTypePtr) ret, nameAttr, - "ref", "name"); - /* - * Check for illegal attributes. - */ - attr = node->properties; - while (attr != NULL) { - if (attr->ns == NULL) { - if (xmlStrEqual(attr->name, BAD_CAST "type") || - xmlStrEqual(attr->name, BAD_CAST "form")) { + } + nberrors = pctxt->nberrors; + /* + * Check for illegal attributes. + */ + attr = node->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + if (isRef) { + if (xmlStrEqual(attr->name, BAD_CAST "id")) { + xmlSchemaPValAttrNodeID(pctxt, attr); + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "ref")) { + goto attr_next; + } + } else { + if (xmlStrEqual(attr->name, BAD_CAST "name")) { + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "id")) { + xmlSchemaPValAttrNodeID(pctxt, attr); + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "type")) { + xmlSchemaPValAttrNodeQName(pctxt, schema, NULL, + attr, &tmpNs, &tmpName); + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "form")) { /* - * 3.2.3 : 3.2 - * If ref is present, then all of , - * form and type must be absent. + * Evaluate the target namespace */ - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_SRC_ATTRIBUTE_3_2, &repName, - (xmlSchemaTypePtr) ret, attr); - } else if ((!xmlStrEqual(attr->name, BAD_CAST "ref")) && - (!xmlStrEqual(attr->name, BAD_CAST "use")) && - (!xmlStrEqual(attr->name, BAD_CAST "id")) && - (!xmlStrEqual(attr->name, BAD_CAST "name")) && - (!xmlStrEqual(attr->name, BAD_CAST "fixed")) && - (!xmlStrEqual(attr->name, BAD_CAST "default"))) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, attr); + hasForm = 1; + attrValue = xmlSchemaGetNodeContent(pctxt, + (xmlNodePtr) attr); + if (xmlStrEqual(attrValue, BAD_CAST "qualified")) { + ns = pctxt->targetNamespace; + } else if (!xmlStrEqual(attrValue, BAD_CAST "unqualified")) + { + xmlSchemaPSimpleTypeErr(pctxt, + XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, + NULL, (xmlNodePtr) attr, + NULL, "(qualified | unqualified)", + attrValue, NULL, NULL, NULL); + } + goto attr_next; } - } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, attr); } - attr = attr->next; - } - } else { - const xmlChar *ns = NULL; + if (xmlStrEqual(attr->name, BAD_CAST "use")) { + + attrValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); + /* TODO: Maybe we need to normalize the value beforehand. */ + if (xmlStrEqual(attrValue, BAD_CAST "optional")) + occurs = XML_SCHEMAS_ATTR_USE_OPTIONAL; + else if (xmlStrEqual(attrValue, BAD_CAST "prohibited")) + occurs = XML_SCHEMAS_ATTR_USE_PROHIBITED; + else if (xmlStrEqual(attrValue, BAD_CAST "required")) + occurs = XML_SCHEMAS_ATTR_USE_REQUIRED; + else { + xmlSchemaPSimpleTypeErr(pctxt, + XML_SCHEMAP_INVALID_ATTR_USE, + NULL, (xmlNodePtr) attr, + NULL, "(optional | prohibited | required)", + attrValue, NULL, NULL, NULL); + } + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "default")) { + /* + * 3.2.3 : 1 + * default and fixed must not both be present. + */ + if (defValue) { + xmlSchemaPMutualExclAttrErr(pctxt, + XML_SCHEMAP_SRC_ATTRIBUTE_1, + NULL, attr, "default", "fixed"); + } else { + defValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); + defValueType = WXS_ATTR_DEF_VAL_DEFAULT; + } + goto attr_next; + } else if (xmlStrEqual(attr->name, BAD_CAST "fixed")) { + /* + * 3.2.3 : 1 + * default and fixed must not both be present. + */ + if (defValue) { + xmlSchemaPMutualExclAttrErr(pctxt, + XML_SCHEMAP_SRC_ATTRIBUTE_1, + NULL, attr, "default", "fixed"); + } else { + defValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); + defValueType = WXS_ATTR_DEF_VAL_FIXED; + } + goto attr_next; + } + } else if (! xmlStrEqual(attr->ns->href, xmlSchemaNs)) + goto attr_next; + + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + +attr_next: + attr = attr->next; + } + /* + * 3.2.3 : 2 + * If default and use are both present, use must have + * the actual value optional. + */ + if ((defValueType == WXS_ATTR_DEF_VAL_DEFAULT) && + (occurs != XML_SCHEMAS_ATTR_USE_OPTIONAL)) { + xmlSchemaPSimpleTypeErr(pctxt, + XML_SCHEMAP_SRC_ATTRIBUTE_2, + NULL, node, NULL, + "(optional | prohibited | required)", NULL, + "The value of the attribute 'use' must be 'optional' " + "if the attribute 'default' is present", + NULL, NULL); + } + /* + * We want correct attributes. + */ + if (nberrors != pctxt->nberrors) + return(NULL); + if (! isRef) { + xmlSchemaAttributePtr attrDecl; + /* TODO: move XML_SCHEMAS_QUALIF_ATTR to the parser. */ + if ((! hasForm) && (schema->flags & XML_SCHEMAS_QUALIF_ATTR)) + ns = pctxt->targetNamespace; /* - * Parse as attribute declaration. + * 3.2.6 Schema Component Constraint: xsi: Not Allowed + * TODO: Move this to the component layer. */ - if (xmlSchemaPValAttrNode(ctxt, - (xmlChar **) &xmlSchemaElemDesAttrDecl, NULL, nameAttr, + if (xmlStrEqual(ns, xmlSchemaInstanceNs)) { + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_NO_XSI, + node, NULL, + "The target namespace must not match '%s'", + xmlSchemaInstanceNs, NULL); + } + attr = xmlSchemaGetPropNode(node, "name"); + if (attr == NULL) { + xmlSchemaPMissingAttrErr(pctxt, XML_SCHEMAP_S4S_ATTR_MISSING, + NULL, node, "name", NULL); + return (NULL); + } + if (xmlSchemaPValAttrNode(pctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); } /* - xmlSchemaFormatTypeRep(&repName, NULL, xmlSchemaElemDesAttrDecl, name); - */ - /* * 3.2.6 Schema Component Constraint: xmlns Not Allowed * TODO: Move this to the component layer. */ if (xmlStrEqual(name, BAD_CAST "xmlns")) { - xmlSchemaPSimpleTypeErr(ctxt, + xmlSchemaPSimpleTypeErr(pctxt, XML_SCHEMAP_NO_XMLNS, - NULL, (xmlNodePtr) nameAttr, + NULL, (xmlNodePtr) attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), NULL, NULL, - "The value of type 'xs:NCName' must not match 'xmlns'", + "The value of the attribute must not match 'xmlns'", NULL, NULL); - if (repName != NULL) - xmlFree(repName); return (NULL); } + if (occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) + goto check_children; /* - * Evaluate the target namespace + * Create the attribute use component. */ - if (topLevel) { - ns = ctxt->targetNamespace; - } else { - attr = xmlSchemaGetPropNode(node, "form"); - if (attr != NULL) { - attrValue = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); - if (xmlStrEqual(attrValue, BAD_CAST "qualified")) { - ns = ctxt->targetNamespace; - } else if (!xmlStrEqual(attrValue, BAD_CAST "unqualified")) { - xmlSchemaPSimpleTypeErr(ctxt, - XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - NULL, (xmlNodePtr) attr, - NULL, "(qualified | unqualified)", - attrValue, NULL, NULL, NULL); - } - } else if (schema->flags & XML_SCHEMAS_QUALIF_ATTR) - /* TODO: move XML_SCHEMAS_QUALIF_ATTR to the parser. */ - ns = ctxt->targetNamespace; - } - ret = xmlSchemaAddAttribute(ctxt, schema, name, ns, node, topLevel); - if (ret == NULL) { - if (repName != NULL) - xmlFree(repName); + use = xmlSchemaAddAttributeUse(pctxt, node); + if (use == NULL) + return(NULL); + use->occurs = occurs; + /* + * Create the attribute declaration. + */ + attrDecl = xmlSchemaAddAttribute(pctxt, schema, name, ns, node, 0); + if (attrDecl == NULL) return (NULL); + if (tmpName != NULL) { + attrDecl->typeName = tmpName; + attrDecl->typeNs = tmpNs; } - ret->type = XML_SCHEMA_TYPE_ATTRIBUTE; - ret->node = node; - if (topLevel) - ret->flags |= XML_SCHEMAS_ATTR_GLOBAL; + use->attrDecl = attrDecl; /* - * 3.2.6 Schema Component Constraint: xsi: Not Allowed - * TODO: Move this to the component layer. - */ - if (xmlStrEqual(ret->targetNamespace, xmlSchemaInstanceNs)) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_NO_XSI, - &repName, (xmlSchemaTypePtr) ret, node, - "The target namespace must not match '%s'", - xmlSchemaInstanceNs); + * Value constraint. + */ + if (defValue != NULL) { + attrDecl->defValue = defValue; + if (defValueType == WXS_ATTR_DEF_VAL_FIXED) + attrDecl->flags |= XML_SCHEMAS_ATTR_FIXED; } + } else if (occurs != XML_SCHEMAS_ATTR_USE_PROHIBITED) { + xmlSchemaQNameRefPtr ref; + /* - * Check for illegal attributes. + * Create the attribute use component. */ - attr = node->properties; - while (attr != NULL) { - if (attr->ns == NULL) { - if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && - (!xmlStrEqual(attr->name, BAD_CAST "default")) && - (!xmlStrEqual(attr->name, BAD_CAST "fixed")) && - (!xmlStrEqual(attr->name, BAD_CAST "name")) && - (!xmlStrEqual(attr->name, BAD_CAST "type"))) { - if ((topLevel) || - ((!xmlStrEqual(attr->name, BAD_CAST "form")) && - (!xmlStrEqual(attr->name, BAD_CAST "use")))) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, attr); - } - } - } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, attr); - } - attr = attr->next; - } - xmlSchemaPValAttrQName(ctxt, schema, &repName, (xmlSchemaTypePtr) ret, - node, "type", &ret->typeNs, &ret->typeName); - } - xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret, - node, BAD_CAST "id"); - /* - * Attribute "fixed". - */ - ret->defValue = xmlSchemaGetProp(ctxt, node, "fixed"); - if (ret->defValue != NULL) - ret->flags |= XML_SCHEMAS_ATTR_FIXED; - /* - * Attribute "default". - */ - attr = xmlSchemaGetPropNode(node, "default"); - if (attr != NULL) { + use = xmlSchemaAddAttributeUse(pctxt, node); + if (use == NULL) + return(NULL); /* - * 3.2.3 : 1 - * default and fixed must not both be present. + * We need to resolve the reference at later stage. */ - if (ret->flags & XML_SCHEMAS_ATTR_FIXED) { - xmlSchemaPMutualExclAttrErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_1, - &repName, (xmlSchemaTypePtr) ret, attr, "default", "fixed"); - } else - ret->defValue = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); - } - if (topLevel == 0) { + WXS_ADD_PENDING(pctxt, use); + use->occurs = occurs; /* - * Attribute "use". + * Create a QName reference to the attribute declaration. */ - attr = xmlSchemaGetPropNode(node, "use"); - if (attr != NULL) { - attrValue = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); - if (xmlStrEqual(attrValue, BAD_CAST "optional")) - ret->occurs = XML_SCHEMAS_ATTR_USE_OPTIONAL; - else if (xmlStrEqual(attrValue, BAD_CAST "prohibited")) - ret->occurs = XML_SCHEMAS_ATTR_USE_PROHIBITED; - else if (xmlStrEqual(attrValue, BAD_CAST "required")) - ret->occurs = XML_SCHEMAS_ATTR_USE_REQUIRED; - else - xmlSchemaPSimpleTypeErr(ctxt, - XML_SCHEMAP_INVALID_ATTR_USE, - (xmlSchemaTypePtr) ret, (xmlNodePtr) attr, - NULL, "(optional | prohibited | required)", - attrValue, NULL, NULL, NULL); - } else - ret->occurs = XML_SCHEMAS_ATTR_USE_OPTIONAL; + ref = xmlSchemaNewQNameRef(pctxt, XML_SCHEMA_TYPE_ATTRIBUTE, + tmpName, tmpNs); + if (ref == NULL) + return(NULL); /* - * 3.2.3 : 2 - * If default and use are both present, use must have - * the actual value optional. + * Assign the reference. This will be substituted for the + * referenced attribute declaration when the QName is resolved. */ - if ((ret->occurs != XML_SCHEMAS_ATTR_USE_OPTIONAL) && - (ret->defValue != NULL) && - ((ret->flags & XML_SCHEMAS_ATTR_FIXED) == 0)) { - xmlSchemaPSimpleTypeErr(ctxt, - XML_SCHEMAP_SRC_ATTRIBUTE_2, - (xmlSchemaTypePtr) ret, (xmlNodePtr) attr, - NULL, "(optional | prohibited | required)", NULL, - "The value must be 'optional' if the attribute " - "'default' is present as well", NULL, NULL); - } + use->attrDecl = WXS_ATTR_CAST ref; + /* + * Value constraint. + */ + if (defValue != NULL) + use->defValue = defValue; + if (defValueType == WXS_ATTR_DEF_VAL_FIXED) + use->flags |= XML_SCHEMA_ATTR_USE_FIXED; } + +check_children: /* * And now for the children... */ child = node->children; - if (IS_SCHEMA(child, "annotation")) { - ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child); - child = child->next; - } - if (isRef) { - if (child != NULL) { - if (IS_SCHEMA(child, "simpleType")) - /* - * 3.2.3 : 3.2 - * If ref is present, then all of , - * form and type must be absent. - */ - xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_3_2, - &repName, (xmlSchemaTypePtr) ret, node, child, NULL, - "(annotation?)"); - else - xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, node, child, NULL, - "(annotation?)"); - } - } else { - if (IS_SCHEMA(child, "simpleType")) { - if (ret->typeName != NULL) { - /* - * 3.2.3 : 4 - * type and must not both be present. - */ - xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_4, - &repName, (xmlSchemaTypePtr) ret, node, child, - "The attribute 'type' and the child " - "are mutually exclusive", NULL); - } else - ret->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child, 0); + if (occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { + xmlSchemaAttributeUseProhibPtr prohib; + + if (IS_SCHEMA(child, "annotation")) { + xmlSchemaParseAnnotation(pctxt, schema, child, 0); child = child->next; } - if (child != NULL) - xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - &repName, (xmlSchemaTypePtr) ret, node, child, NULL, - "(annotation?, simpleType?)"); - } - /* - * Cleanup. - */ - if (repName != NULL) - xmlFree(repName); - return (ret); -} - -/** - * xmlSchemaParseAttributeGroup: - * @ctxt: a schema validation context - * @schema: the schema being built - * @node: a subtree containing XML Schema informations - * - * parse a XML schema Attribute Group declaration - * *WARNING* this interface is highly subject to change - * - * Returns the attribute group or NULL in case of error. - */ -static xmlSchemaAttributeGroupPtr -xmlSchemaParseAttributeGroup(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaPtr schema, xmlNodePtr node, - int topLevel) -{ - const xmlChar *name; - xmlSchemaAttributeGroupPtr ret; - xmlNodePtr child = NULL; - xmlAttrPtr attr, nameAttr; - - if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) - return (NULL); - - nameAttr = xmlSchemaGetPropNode(node, "name"); - attr = xmlSchemaGetPropNode(node, "ref"); - if ((topLevel) || (attr == NULL)) { + if (child != NULL) { + xmlSchemaPContentErr(pctxt, + XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, + NULL, node, child, NULL, + "(annotation?)"); + } /* - * Parse as an attribute group definition. - * Note that those are allowed at top level only. + * Check for pointlessness of attribute prohibitions. */ - if (nameAttr == NULL) { - xmlSchemaPMissingAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_MISSING, - NULL, node, "name", NULL); - return (NULL); + if (parentType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { + xmlSchemaCustomWarning(ACTXT_CAST pctxt, + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, + node, NULL, + "Skipping attribute use prohibition, since it is " + "pointless inside an ", + NULL, NULL, NULL); + return(NULL); + } else if (parentType == XML_SCHEMA_TYPE_EXTENSION) { + xmlSchemaCustomWarning(ACTXT_CAST pctxt, + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, + node, NULL, + "Skipping attribute use prohibition, since it is " + "pointless when extending a type", + NULL, NULL, NULL); + return(NULL); + } + if (! isRef) { + tmpName = name; + tmpNs = ns; } - /* REDUNDANT: name = xmlSchemaGetNodeContent(ctxt, - * (xmlNodePtr) nameAttr); - */ /* - * The name is crucial, exit if invalid. + * Check for duplicate attribute prohibitions. */ - if (xmlSchemaPValAttrNode(ctxt, - NULL, NULL, nameAttr, - xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { - return (NULL); + if (uses) { + int i; + + for (i = 0; i < uses->nbItems; i++) { + use = uses->items[i]; + if ((use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) && + (tmpName == (WXS_ATTR_PROHIB_CAST use)->name) && + (tmpNs == (WXS_ATTR_PROHIB_CAST use)->targetNamespace)) + { + xmlChar *str = NULL; + + xmlSchemaCustomWarning(ACTXT_CAST pctxt, + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, + node, NULL, + "Skipping duplicate attribute use prohibition '%s'", + xmlSchemaFormatQName(&str, tmpNs, tmpName), + NULL, NULL); + FREE_AND_NULL(str) + return(NULL); + } + } } - ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node, 1); - if (ret == NULL) - return (NULL); - } else { -#ifdef ENABLE_NAMED_LOCALS - char buf[50]; -#endif - const xmlChar *refNs = NULL, *ref = NULL; - /* - * Parse as an attribute group definition reference. + * Create the attribute prohibition helper component. */ - if (attr == NULL) { - xmlSchemaPMissingAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_MISSING, - NULL, node, "ref", NULL); + prohib = xmlSchemaAddAttributeUseProhib(pctxt); + if (prohib == NULL) + return(NULL); + prohib->node = node; + prohib->name = tmpName; + prohib->targetNamespace = tmpNs; + if (isRef) { + /* + * We need at least to resolve to the attribute declaration. + */ + WXS_ADD_PENDING(pctxt, prohib); } - xmlSchemaPValAttrNodeQName(ctxt, schema, - NULL, NULL, attr, &refNs,&ref); -#ifdef ENABLE_NAMED_LOCALS - snprintf(buf, 49, "#agRef%d", ctxt->counter++ + 1); - name = (const xmlChar *) buf; - if (name == NULL) { - xmlSchemaPErrMemory(ctxt, "creating internal name for an " - "attribute group definition reference", node); - return (NULL); - } - ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node, 0); -#else - ret = xmlSchemaAddAttributeGroup(ctxt, schema, NULL, node, 0); -#endif - if (ret == NULL) - return (NULL); - ret->ref = ref; - ret->refNs = refNs; - xmlSchemaCheckReference(ctxt, schema, node, - (xmlSchemaBasicItemPtr) ret, refNs); + return(WXS_BASIC_CAST prohib); + } else { + if (IS_SCHEMA(child, "annotation")) { + /* + * TODO: Should this go into the attr decl? + */ + use->annot = xmlSchemaParseAnnotation(pctxt, schema, child, 1); + child = child->next; + } + if (isRef) { + if (child != NULL) { + if (IS_SCHEMA(child, "simpleType")) + /* + * 3.2.3 : 3.2 + * If ref is present, then all of , + * form and type must be absent. + */ + xmlSchemaPContentErr(pctxt, + XML_SCHEMAP_SRC_ATTRIBUTE_3_2, + NULL, node, child, NULL, + "(annotation?)"); + else + xmlSchemaPContentErr(pctxt, + XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, + NULL, node, child, NULL, + "(annotation?)"); + } + } else { + if (IS_SCHEMA(child, "simpleType")) { + if (WXS_ATTRUSE_DECL(use)->typeName != NULL) { + /* + * 3.2.3 : 4 + * type and must not both be present. + */ + xmlSchemaPContentErr(pctxt, XML_SCHEMAP_SRC_ATTRIBUTE_4, + NULL, node, child, + "The attribute 'type' and the child " + "are mutually exclusive", NULL); + } else + WXS_ATTRUSE_TYPEDEF(use) = + xmlSchemaParseSimpleType(pctxt, schema, child, 0); + child = child->next; + } + if (child != NULL) + xmlSchemaPContentErr(pctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, + NULL, node, child, NULL, + "(annotation?, simpleType?)"); + } + } + return (WXS_BASIC_CAST use); +} + + +static xmlSchemaAttributePtr +xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node) +{ + const xmlChar *attrValue; + xmlSchemaAttributePtr ret; + xmlNodePtr child = NULL; + xmlAttrPtr attr; + + /* + * Note that the w3c spec assumes the schema to be validated with schema + * for schemas beforehand. + * + * 3.2.3 Constraints on XML Representations of Attribute Declarations + */ + if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) + return (NULL); + /* + * 3.2.3 : 3.1 + * One of ref or name must be present, but not both + */ + attr = xmlSchemaGetPropNode(node, "name"); + if (attr == NULL) { + xmlSchemaPMissingAttrErr(pctxt, XML_SCHEMAP_S4S_ATTR_MISSING, + NULL, node, "name", NULL); + return (NULL); + } + if (xmlSchemaPValAttrNode(pctxt, NULL, attr, + xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &attrValue) != 0) { + return (NULL); + } + /* + * 3.2.6 Schema Component Constraint: xmlns Not Allowed + * TODO: Move this to the component layer. + */ + if (xmlStrEqual(attrValue, BAD_CAST "xmlns")) { + xmlSchemaPSimpleTypeErr(pctxt, + XML_SCHEMAP_NO_XMLNS, + NULL, (xmlNodePtr) attr, + xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), NULL, NULL, + "The value of the attribute must not match 'xmlns'", + NULL, NULL); + return (NULL); + } + /* + * 3.2.6 Schema Component Constraint: xsi: Not Allowed + * TODO: Move this to the component layer. + * Or better leave it here and add it to the component layer + * if we have a schema construction API. + */ + if (xmlStrEqual(pctxt->targetNamespace, xmlSchemaInstanceNs)) { + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_NO_XSI, node, NULL, + "The target namespace must not match '%s'", + xmlSchemaInstanceNs, NULL); + } + + ret = xmlSchemaAddAttribute(pctxt, schema, attrValue, + pctxt->targetNamespace, node, 1); + if (ret == NULL) + return (NULL); + ret->flags |= XML_SCHEMAS_ATTR_GLOBAL; + + /* + * Check for illegal attributes. + */ + attr = node->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && + (!xmlStrEqual(attr->name, BAD_CAST "default")) && + (!xmlStrEqual(attr->name, BAD_CAST "fixed")) && + (!xmlStrEqual(attr->name, BAD_CAST "name")) && + (!xmlStrEqual(attr->name, BAD_CAST "type"))) + { + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + } + } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + } + attr = attr->next; + } + xmlSchemaPValAttrQName(pctxt, schema, NULL, + node, "type", &ret->typeNs, &ret->typeName); + + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); + /* + * Attribute "fixed". + */ + ret->defValue = xmlSchemaGetProp(pctxt, node, "fixed"); + if (ret->defValue != NULL) + ret->flags |= XML_SCHEMAS_ATTR_FIXED; + /* + * Attribute "default". + */ + attr = xmlSchemaGetPropNode(node, "default"); + if (attr != NULL) { + /* + * 3.2.3 : 1 + * default and fixed must not both be present. + */ + if (ret->flags & XML_SCHEMAS_ATTR_FIXED) { + xmlSchemaPMutualExclAttrErr(pctxt, XML_SCHEMAP_SRC_ATTRIBUTE_1, + WXS_BASIC_CAST ret, attr, "default", "fixed"); + } else + ret->defValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); + } + /* + * And now for the children... + */ + child = node->children; + if (IS_SCHEMA(child, "annotation")) { + ret->annot = xmlSchemaParseAnnotation(pctxt, schema, child, 1); + child = child->next; + } + if (IS_SCHEMA(child, "simpleType")) { + if (ret->typeName != NULL) { + /* + * 3.2.3 : 4 + * type and must not both be present. + */ + xmlSchemaPContentErr(pctxt, XML_SCHEMAP_SRC_ATTRIBUTE_4, + NULL, node, child, + "The attribute 'type' and the child " + "are mutually exclusive", NULL); + } else + ret->subtypes = xmlSchemaParseSimpleType(pctxt, schema, child, 0); + child = child->next; } + if (child != NULL) + xmlSchemaPContentErr(pctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, + NULL, node, child, NULL, + "(annotation?, simpleType?)"); + + return (ret); +} + +/** + * xmlSchemaParseAttributeGroupRef: + * @ctxt: a schema validation context + * @schema: the schema being built + * @node: a subtree containing XML Schema informations + * + * Parse an attribute group definition reference. + * Note that a reference to an attribute group does not + * correspond to any component at all. + * *WARNING* this interface is highly subject to change + * + * Returns the attribute group or NULL in case of error. + */ +static xmlSchemaQNameRefPtr +xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node) +{ + xmlSchemaQNameRefPtr ret; + xmlNodePtr child = NULL; + xmlAttrPtr attr; + const xmlChar *refNs = NULL, *ref = NULL; + + if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) + return (NULL); + + attr = xmlSchemaGetPropNode(node, "ref"); + if (attr == NULL) { + xmlSchemaPMissingAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_MISSING, + NULL, node, "ref", NULL); + return (NULL); + } + xmlSchemaPValAttrNodeQName(pctxt, schema, + NULL, attr, &refNs, &ref); + if (xmlSchemaCheckReference(pctxt, schema, node, attr, refNs) != 0) + return(NULL); + /* * Check for illegal attributes. */ attr = node->properties; while (attr != NULL) { if (attr->ns == NULL) { - if ((((topLevel == 0) && - (!xmlStrEqual(attr->name, BAD_CAST "ref"))) || - (topLevel && (!xmlStrEqual(attr->name, BAD_CAST "name")))) && + if ((!xmlStrEqual(attr->name, BAD_CAST "ref")) && (!xmlStrEqual(attr->name, BAD_CAST "id"))) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } /* Attribute ID */ - xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret, - node, BAD_CAST "id"); + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); + /* * And now for the children... */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + /* + * TODO: We do not have a place to store the annotation, do we? + */ + xmlSchemaParseAnnotation(pctxt, schema, child, 0); child = child->next; } - if (topLevel) { - child = xmlSchemaParseAttrDecls(ctxt, schema, child, - (xmlSchemaTypePtr) ret); - if (IS_SCHEMA(child, "anyAttribute")) { - ret->attributeWildcard = xmlSchemaParseAnyAttribute(ctxt, - schema, child); - child = child->next; + if (child != NULL) { + xmlSchemaPContentErr(pctxt, + XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, + NULL, node, child, NULL, + "(annotation?)"); + } + + /* + * Handle attribute group redefinitions. + */ + if (pctxt->isRedefine && pctxt->redef && + (pctxt->redef->item->type == + XML_SCHEMA_TYPE_ATTRIBUTEGROUP) && + (ref == pctxt->redef->refName) && + (refNs == pctxt->redef->refTargetNs)) + { + /* + * SPEC src-redefine: + * (7.1) "If it has an among its contents + * the ·actual value· of whose ref [attribute] is the same + * as the ·actual value· of its own name attribute plus + * target namespace, then it must have exactly one such group." + */ + if (pctxt->redefCounter != 0) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_SRC_REDEFINE, node, NULL, + "The redefining attribute group definition " + "'%s' must not contain more than one " + "reference to the redefined definition", + xmlSchemaFormatQName(&str, refNs, ref), NULL); + FREE_AND_NULL(str); + return(NULL); + } + pctxt->redefCounter++; + /* + * URGENT TODO: How to ensure that the reference will not be + * handled by the normal component resolution mechanism? + */ + ret = xmlSchemaNewQNameRef(pctxt, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, ref, refNs); + if (ret == NULL) + return(NULL); + ret->node = node; + pctxt->redef->reference = WXS_BASIC_CAST ret; + } else { + /* + * Create a QName-reference helper component. We will substitute this + * component for the attribute uses of the referenced attribute group + * definition. + */ + ret = xmlSchemaNewQNameRef(pctxt, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, ref, refNs); + if (ret == NULL) + return(NULL); + ret->node = node; + /* Add to pending items, to be able to resolve the reference. */ + WXS_ADD_PENDING(pctxt, ret); + } + return (ret); +} + +/** + * xmlSchemaParseAttributeGroupDefinition: + * @pctxt: a schema validation context + * @schema: the schema being built + * @node: a subtree containing XML Schema informations + * + * parse a XML schema Attribute Group declaration + * *WARNING* this interface is highly subject to change + * + * Returns the attribute group definition or NULL in case of error. + */ +static xmlSchemaAttributeGroupPtr +xmlSchemaParseAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaPtr schema, + xmlNodePtr node) +{ + const xmlChar *name; + xmlSchemaAttributeGroupPtr ret; + xmlNodePtr child = NULL; + xmlAttrPtr attr; + int hasRefs = 0; + + if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) + return (NULL); + + attr = xmlSchemaGetPropNode(node, "name"); + if (attr == NULL) { + xmlSchemaPMissingAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_MISSING, + NULL, node, "name", NULL); + return (NULL); + } + /* + * The name is crucial, exit if invalid. + */ + if (xmlSchemaPValAttrNode(pctxt, + NULL, attr, + xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { + return (NULL); + } + ret = xmlSchemaAddAttributeGroupDefinition(pctxt, schema, + name, pctxt->targetNamespace, node); + if (ret == NULL) + return (NULL); + /* + * Check for illegal attributes. + */ + attr = node->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + if ((!xmlStrEqual(attr->name, BAD_CAST "name")) && + (!xmlStrEqual(attr->name, BAD_CAST "id"))) + { + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + } + } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { + xmlSchemaPIllegalAttrErr(pctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } + attr = attr->next; + } + /* Attribute ID */ + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); + /* + * And now for the children... + */ + child = node->children; + if (IS_SCHEMA(child, "annotation")) { + ret->annot = xmlSchemaParseAnnotation(pctxt, schema, child, 1); + child = child->next; + } + /* + * Parse contained attribute decls/refs. + */ + if (xmlSchemaParseLocalAttributes(pctxt, schema, &child, + (xmlSchemaItemListPtr *) &(ret->attrUses), + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, &hasRefs) == -1) + return(NULL); + if (hasRefs) + ret->flags |= XML_SCHEMAS_ATTRGROUP_HAS_REFS; + /* + * Parse the attribute wildcard. + */ + if (IS_SCHEMA(child, "anyAttribute")) { + ret->attributeWildcard = xmlSchemaParseAnyAttribute(pctxt, + schema, child); + child = child->next; } if (child != NULL) { - xmlSchemaPContentErr(ctxt, + xmlSchemaPContentErr(pctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, - "(annotation?)"); + NULL, node, child, NULL, + "(annotation?, ((attribute | attributeGroup)*, anyAttribute?))"); } return (ret); } @@ -7139,7 +7966,7 @@ xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPCustomErr(ctxt, /* TODO: Adjust error code. */ XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - NULL, NULL, node, + NULL, node, "The XPath expression of the selector is not valid", NULL); return (XML_SCHEMAP_S4S_ATTR_INVALID_VALUE); } else { @@ -7159,7 +7986,6 @@ xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt, */ if (nsList != NULL) { int i, count = 0; - xmlNsPtr ns; for (i = 0; nsList[i] != NULL; i++) count++; @@ -7169,10 +7995,10 @@ xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt, if (nsArray == NULL) { xmlSchemaPErrMemory(ctxt, "allocating a namespace array", NULL); + xmlFree(nsList); return (-1); } for (i = 0; i < count; i++) { - ns = nsList[i]; nsArray[2 * i] = nsList[i]->href; nsArray[2 * i + 1] = nsList[i]->prefix; } @@ -7195,7 +8021,7 @@ xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPCustomErr(ctxt, /* TODO: Adjust error code? */ XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - NULL, NULL, node, + NULL, node, "The XPath expression '%s' could not be " "compiled", selector->xpath); return (XML_SCHEMAP_S4S_ATTR_INVALID_VALUE); @@ -7304,7 +8130,7 @@ xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, default: xmlSchemaPCustomErr(NULL, XML_SCHEMAP_INTERNAL, - NULL, NULL, NULL, + NULL, NULL, "Internal error: xmlSchemaAddAnnotation, " "The item is not a annotated schema component", NULL); break; @@ -7343,13 +8169,11 @@ xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "xpath"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -7390,7 +8214,7 @@ xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, } } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... */ @@ -7400,13 +8224,13 @@ xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, * Add the annotation to the parent IDC. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) idc, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?)"); } @@ -7447,13 +8271,11 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, ((idcCategory != XML_SCHEMA_TYPE_IDC_KEYREF) || (!xmlStrEqual(attr->name, BAD_CAST "refer")))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -7468,7 +8290,7 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, "name", NULL); return (NULL); } else if (xmlSchemaPValAttrNode(ctxt, - NULL, NULL, attr, + NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); } @@ -7478,8 +8300,7 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, if (item == NULL) return(NULL); - xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) item, - node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); if (idcCategory == XML_SCHEMA_TYPE_IDC_KEYREF) { /* * Attribute "refer" (mandatory). @@ -7499,11 +8320,10 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, if (item->ref == NULL) return (NULL); xmlSchemaPValAttrNodeQName(ctxt, schema, - NULL, NULL, attr, + NULL, attr, &(item->ref->targetNamespace), &(item->ref->name)); - xmlSchemaCheckReference(ctxt, schema, node, - (xmlSchemaBasicItemPtr) item, + xmlSchemaCheckReference(ctxt, schema, node, attr, item->ref->targetNamespace); } } @@ -7512,13 +8332,13 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - item->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + item->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, NULL, node, child, + NULL, node, child, "A child element is missing", "(annotation?, (selector, field+))"); } @@ -7550,14 +8370,14 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, } else { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?, (selector, field+))"); } } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?, (selector, field+))"); } @@ -7579,7 +8399,7 @@ xmlSchemaParseIDC(xmlSchemaParserCtxtPtr ctxt, */ static xmlSchemaBasicItemPtr xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, - xmlNodePtr node, int topLevel) + xmlNodePtr node, int *isElemRef, int topLevel) { xmlSchemaElementPtr decl = NULL; xmlSchemaParticlePtr particle = NULL; @@ -7594,6 +8414,9 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) return (NULL); + + if (isElemRef != NULL) + *isElemRef = 0; /* * If we get a "ref" attribute on a local we will assume it's * a reference - even if there's a "name" attribute; this seems to be more @@ -7611,10 +8434,10 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else isRef = 1; - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); child = node->children; if (IS_SCHEMA(child, "annotation")) { - annot = xmlSchemaParseAnnotation(ctxt, schema, child); + annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } /* @@ -7640,16 +8463,18 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * The reference part ============================================= */ + if (isElemRef != NULL) + *isElemRef = 1; + xmlSchemaPValAttrNodeQName(ctxt, schema, - NULL, NULL, attr, &refNs, &ref); - xmlSchemaCheckReference(ctxt, schema, node, NULL, refNs); + NULL, attr, &refNs, &ref); + xmlSchemaCheckReference(ctxt, schema, node, attr, refNs); /* * SPEC (3.3.3 : 2.1) "One of ref or name must be present, but not both" */ if (nameAttr != NULL) { xmlSchemaPMutualExclAttrErr(ctxt, - XML_SCHEMAP_SRC_ELEMENT_2_1, - NULL, NULL, nameAttr, "ref", "name"); + XML_SCHEMAP_SRC_ELEMENT_2_1, NULL, nameAttr, "ref", "name"); } /* * Check for illegal attributes. @@ -7676,8 +8501,7 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -7686,12 +8510,12 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, "(annotation?)"); + NULL, node, child, NULL, "(annotation?)"); } if ((min == 0) && (max == 0)) goto return_null; /* - * Create the reference item. + * Create the reference item and attach it to the particle. */ refer = xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_ELEMENT, ref, refNs); @@ -7703,7 +8527,7 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Add the particle to pending components, since the reference * need to be resolved. */ - WXS_ADD_PENDING_ITEM(ctxt, particle); + WXS_ADD_PENDING(ctxt, particle); return ((xmlSchemaBasicItemPtr) particle); } /* @@ -7714,7 +8538,7 @@ declaration_part: const xmlChar *ns = NULL, *fixed, *name, *attrValue; xmlSchemaIDCPtr curIDC = NULL, lastIDC = NULL; - if (xmlSchemaPValAttrNode(ctxt, NULL, NULL, nameAttr, + if (xmlSchemaPValAttrNode(ctxt, NULL, nameAttr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) goto return_null; /* @@ -7738,13 +8562,10 @@ declaration_part: } else if (schema->flags & XML_SCHEMAS_QUALIF_ELEM) ns = ctxt->targetNamespace; } - decl = xmlSchemaAddElement(ctxt, schema, name, ns, node, topLevel); + decl = xmlSchemaAddElement(ctxt, name, ns, node, topLevel); if (decl == NULL) { goto return_null; } - decl->type = XML_SCHEMA_TYPE_ELEMENT; - decl->node = node; - decl->targetNamespace = ns; /* * Check for illegal attributes. */ @@ -7765,23 +8586,20 @@ declaration_part: (!xmlStrEqual(attr->name, BAD_CAST "form"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, (xmlSchemaTypePtr) decl, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if ((!xmlStrEqual(attr->name, BAD_CAST "final")) && (!xmlStrEqual(attr->name, BAD_CAST "abstract")) && (!xmlStrEqual(attr->name, BAD_CAST "substitutionGroup"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, (xmlSchemaTypePtr) decl, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, (xmlSchemaTypePtr) decl, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -7794,11 +8612,10 @@ declaration_part: */ decl->flags |= XML_SCHEMAS_ELEM_GLOBAL; decl->flags |= XML_SCHEMAS_ELEM_TOPLEVEL; - xmlSchemaPValAttrQName(ctxt, schema, NULL, - (xmlSchemaTypePtr) decl, node, "substitutionGroup", + xmlSchemaPValAttrQName(ctxt, schema, + NULL, node, "substitutionGroup", &(decl->substGroupNs), &(decl->substGroup)); - if (xmlGetBooleanProp(ctxt, NULL, (xmlSchemaTypePtr) decl, - node, "abstract", 0)) + if (xmlGetBooleanProp(ctxt, node, "abstract", 0)) decl->flags |= XML_SCHEMAS_ELEM_ABSTRACT; /* * Attribute "final". @@ -7817,7 +8634,7 @@ declaration_part: XML_SCHEMAS_ELEM_FINAL_RESTRICTION, -1, -1, -1) != 0) { xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - (xmlSchemaTypePtr) decl, (xmlNodePtr) attr, + NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction))", attrValue, NULL, NULL, NULL); } @@ -7846,23 +8663,22 @@ declaration_part: XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION, -1, -1) != 0) { xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - (xmlSchemaTypePtr) decl, (xmlNodePtr) attr, + NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | " "restriction | substitution))", attrValue, NULL, NULL, NULL); } } - if (xmlGetBooleanProp(ctxt, NULL, (xmlSchemaTypePtr) decl, - node, "nillable", 0)) + if (xmlGetBooleanProp(ctxt, node, "nillable", 0)) decl->flags |= XML_SCHEMAS_ELEM_NILLABLE; attr = xmlSchemaGetPropNode(node, "type"); if (attr != NULL) { xmlSchemaPValAttrNodeQName(ctxt, schema, - NULL, (xmlSchemaTypePtr) decl, attr, + NULL, attr, &(decl->namedTypeNs), &(decl->namedType)); xmlSchemaCheckReference(ctxt, schema, node, - (xmlSchemaBasicItemPtr) decl, decl->namedTypeNs); + attr, decl->namedTypeNs); } decl->value = xmlSchemaGetProp(ctxt, node, "default"); attr = xmlSchemaGetPropNode(node, "fixed"); @@ -7875,8 +8691,7 @@ declaration_part: */ xmlSchemaPMutualExclAttrErr(ctxt, XML_SCHEMAP_SRC_ELEMENT_1, - NULL, (xmlSchemaTypePtr) decl, attr, - "default", "fixed"); + NULL, attr, "default", "fixed"); } else { decl->flags |= XML_SCHEMAS_ELEM_FIXED; decl->value = fixed; @@ -7894,11 +8709,11 @@ declaration_part: if (decl->namedType != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_ELEMENT_3, - NULL, (xmlSchemaTypePtr) decl, node, child, + NULL, node, child, "The attribute 'type' and the child are " "mutually exclusive", NULL); } else - ELEM_TYPE(decl) = xmlSchemaParseComplexType(ctxt, schema, child, 0); + WXS_ELEM_TYPEDEF(decl) = xmlSchemaParseComplexType(ctxt, schema, child, 0); child = child->next; } else if (IS_SCHEMA(child, "simpleType")) { /* @@ -7909,11 +8724,11 @@ declaration_part: if (decl->namedType != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_ELEMENT_3, - NULL, (xmlSchemaTypePtr) decl, node, child, + NULL, node, child, "The attribute 'type' and the child are " "mutually exclusive", NULL); } else - ELEM_TYPE(decl) = xmlSchemaParseSimpleType(ctxt, schema, child, 0); + WXS_ELEM_TYPEDEF(decl) = xmlSchemaParseSimpleType(ctxt, schema, child, 0); child = child->next; } while ((IS_SCHEMA(child, "unique")) || @@ -7938,7 +8753,7 @@ declaration_part: if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, (xmlSchemaTypePtr) decl, node, child, + NULL, node, child, NULL, "(annotation?, ((simpleType | complexType)?, " "(unique | key | keyref)*))"); } @@ -8011,17 +8826,15 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "memberTypes"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Attribute "memberTypes". This is a list of QNames. * TODO: Check the value to contain anything. @@ -8035,7 +8848,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaQNameRefPtr ref; cur = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); - type->ref = cur; + type->base = cur; do { while (IS_BLANK_CH(*cur)) cur++; @@ -8045,7 +8858,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (end == cur) break; tmp = xmlStrndup(cur, end - cur); - if (xmlSchemaPValAttrNodeQNameValue(ctxt, schema, NULL, + if (xmlSchemaPValAttrNodeQNameValue(ctxt, schema, NULL, attr, BAD_CAST tmp, &nsName, &localName) == 0) { /* * Create the member type link. @@ -8093,7 +8906,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Add the annotation to the simple type ancestor. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (IS_SCHEMA(child, "simpleType")) { @@ -8122,7 +8935,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, "(annotation?, simpleType*)"); + NULL, node, child, NULL, "(annotation?, simpleType*)"); } if ((attr == NULL) && (type->subtypes == NULL)) { /* @@ -8132,7 +8945,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, - NULL, NULL, node, + NULL, node, "Either the attribute 'memberTypes' or " "at least one child must be present", NULL); } @@ -8181,32 +8994,33 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "itemType"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Attribute "itemType". NOTE that we will use the "ref" and "refNs" * fields for holding the reference to the itemType. + * + * REVAMP TODO: Use the "base" and "baseNs" fields, since we will remove + * the "ref" fields. */ - xmlSchemaPValAttrQName(ctxt, schema, NULL, NULL, - node, "itemType", &(type->refNs), &(type->ref)); + xmlSchemaPValAttrQName(ctxt, schema, NULL, + node, "itemType", &(type->baseNs), &(type->base)); /* * And now for the children... */ child = node->children; if (IS_SCHEMA(child, "annotation")) { xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (IS_SCHEMA(child, "simpleType")) { @@ -8215,34 +9029,34 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Either the itemType [attribute] or the [child] of * the element must be present, but not both. */ - if (type->ref != NULL) { + if (type->base != NULL) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_SIMPLE_TYPE_1, - NULL, NULL, node, + NULL, node, "The attribute 'itemType' and the child " "are mutually exclusive", NULL); } else { type->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child, 0); } child = child->next; - } else if (type->ref == NULL) { + } else if (type->base == NULL) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_SIMPLE_TYPE_1, - NULL, NULL, node, + NULL, node, "Either the attribute 'itemType' or the child " "must be present", NULL); } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, "(annotation?, simpleType?)"); + NULL, node, child, NULL, "(annotation?, simpleType?)"); } - if ((type->ref == NULL) && + if ((type->base == NULL) && (type->subtypes == NULL) && (xmlSchemaGetPropNode(node, "itemType") == NULL)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_SIMPLE_TYPE_1, - NULL, NULL, node, + NULL, node, "Either the attribute 'itemType' or the child " "must be present", NULL); } @@ -8265,7 +9079,7 @@ static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlNodePtr node, int topLevel) { - xmlSchemaTypePtr type, oldCtxtType, oldParentItem; + xmlSchemaTypePtr type, oldCtxtType; xmlNodePtr child = NULL; const xmlChar *attrValue = NULL; xmlAttrPtr attr; @@ -8284,7 +9098,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, return (NULL); } else { if (xmlSchemaPValAttrNode(ctxt, - NULL, NULL, attr, + NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &attrValue) != 0) return (NULL); /* @@ -8300,7 +9114,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * about this case. */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE, - NULL, NULL, node, + NULL, node, "Redefinition of built-in simple types is not " "supported", NULL); return(NULL); @@ -8326,11 +9140,14 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ #ifdef ENABLE_NAMED_LOCALS snprintf(buf, 39, "#ST%d", ctxt->counter++ + 1); - type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf, + type = xmlSchemaAddType(ctxt, schema, + XML_SCHEMA_TYPE_SIMPLE, + xmlDictLookup(ctxt->dict, (const xmlChar *)buf, -1), ctxt->targetNamespace, node, 0); #else - type = xmlSchemaAddType(ctxt, schema, NULL, - ctxt->targetNamespace, node, 0); + type = xmlSchemaAddType(ctxt, schema, + XML_SCHEMA_TYPE_SIMPLE, + NULL, ctxt->targetNamespace, node, 0); #endif if (type == NULL) return (NULL); @@ -8344,13 +9161,11 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (attr->ns == NULL) { if (!xmlStrEqual(attr->name, BAD_CAST "id")) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -8360,8 +9175,8 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * * Note that attrValue is the value of the attribute "name" here. */ - type = xmlSchemaAddType(ctxt, schema, attrValue, - ctxt->targetNamespace, node, 1); + type = xmlSchemaAddType(ctxt, schema, XML_SCHEMA_TYPE_SIMPLE, + attrValue, ctxt->targetNamespace, node, 1); if (type == NULL) return (NULL); type->type = XML_SCHEMA_TYPE_SIMPLE; @@ -8377,13 +9192,11 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, (!xmlStrEqual(attr->name, BAD_CAST "name")) && (!xmlStrEqual(attr->name, BAD_CAST "final"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -8407,29 +9220,29 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - type, (xmlNodePtr) attr, + WXS_BASIC_CAST type, (xmlNodePtr) attr, NULL, "(#all | List of (list | union | restriction)", attrValue, NULL, NULL, NULL); } } } type->targetNamespace = ctxt->targetNamespace; - xmlSchemaPValAttrID(ctxt, NULL, type, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... */ oldCtxtType = ctxt->ctxtType; - oldParentItem = ctxt->parentItem; + ctxt->ctxtType = type; - ctxt->parentItem = type; + child = node->children; if (IS_SCHEMA(child, "annotation")) { - type->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + type->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, type, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (restriction | list | union))"); } else if (IS_SCHEMA(child, "restriction")) { xmlSchemaParseRestriction(ctxt, schema, child, @@ -8445,7 +9258,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, type, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (restriction | list | union))"); } /* @@ -8457,26 +9270,24 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ if (topLevel && ctxt->isRedefine && (! hasRestriction)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE, - NULL, NULL, node, "This is a redefinition, thus the " + NULL, node, "This is a redefinition, thus the " " must have a child", NULL); } - - ctxt->parentItem = oldParentItem; + ctxt->ctxtType = oldCtxtType; return (type); } /** * xmlSchemaParseModelGroupDefRef: - * @ctxt: a schema validation context - * @schema: the schema being built - * @node: a subtree containing XML Schema informations + * @ctxt: the parser context + * @schema: the schema being built + * @node: the node * - * Parses a XML schema particle (reference to a model group definition). - * *WARNING* this interface is highly subject to change + * Parses a reference to a model group definition. * - * Returns -1 in case of error, 0 if the declaration is improper and - * 1 in case of success. + * We will return a particle component with a qname-component or + * NULL in case of an error. */ static xmlSchemaTreeItemPtr xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, @@ -8496,13 +9307,13 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, if (attr == NULL) { xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, - NULL, node, - "ref", NULL); + NULL, node, "ref", NULL); return (NULL); - } else if (xmlSchemaPValAttrNodeQName(ctxt, schema, NULL, NULL, + } else if (xmlSchemaPValAttrNodeQName(ctxt, schema, NULL, attr, &refNs, &ref) != 0) { return (NULL); } + xmlSchemaCheckReference(ctxt, schema, node, attr, refNs); min = xmlGetMinOccurs(ctxt, node, 0, -1, 1, "xs:nonNegativeInteger"); max = xmlGetMaxOccurs(ctxt, node, 0, UNBOUNDED, 1, "(xs:nonNegativeInteger | unbounded)"); @@ -8517,29 +9328,24 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, (!xmlStrEqual(attr->name, BAD_CAST "minOccurs")) && (!xmlStrEqual(attr->name, BAD_CAST "maxOccurs"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); item = xmlSchemaAddParticle(ctxt, schema, node, min, max); if (item == NULL) - return (NULL); - /* Add to pending components; the reference needs to be resolved. */ - WXS_ADD_PENDING_ITEM(ctxt, item); + return (NULL); /* - * Create a reference item as the term; it will be substituted for - * the model group after the reference has been resolved. + * Create a qname-reference and set as the term; it will be substituted + * for the model group after the reference has been resolved. */ item->children = (xmlSchemaTreeItemPtr) - xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); - xmlSchemaCheckReference(ctxt, schema, node, (xmlSchemaBasicItemPtr) item, refNs); + xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); xmlSchemaPCheckParticleCorrect_2(ctxt, item, node, min, max); /* * And now for the children... @@ -8550,13 +9356,13 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, /* * TODO: What to do exactly with the annotation? */ - item->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + item->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?)"); } /* @@ -8575,6 +9381,11 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, * @node: a subtree containing XML Schema informations * * Parses a XML schema model group definition. + * + * Note that the contraint src-redefine (6.2) can't be applied until + * references have been resolved. So we will do this at the + * component fixup level. + * * *WARNING* this interface is highly subject to change * * Returns -1 in case of error, 0 if the declaration is improper and @@ -8600,8 +9411,7 @@ xmlSchemaParseModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, NULL, node, "name", NULL); return (NULL); - } else if (xmlSchemaPValAttrNode(ctxt, - NULL, NULL, attr, + } else if (xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); } @@ -8618,23 +9428,21 @@ xmlSchemaParseModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, if ((!xmlStrEqual(attr->name, BAD_CAST "name")) && (!xmlStrEqual(attr->name, BAD_CAST "id"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - item->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + item->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (IS_SCHEMA(child, "all")) { @@ -8650,13 +9458,15 @@ xmlSchemaParseModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, XML_SCHEMA_TYPE_SEQUENCE, 0); child = child->next; } + + + if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (all | choice | sequence)?)"); } - return (item); } @@ -8776,7 +9586,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, * since they are not visible at the component level. I.e. * they are used if processing schema *documents* only. */ - res = xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + res = xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); HFAILURE; /* @@ -8793,7 +9603,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, */ attr = xmlSchemaGetPropNode(node, "targetNamespace"); if (attr != NULL) { - res = xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr, + res = xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), NULL); HFAILURE; if (res != 0) { @@ -8897,7 +9707,7 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, (IS_SCHEMA(child, "redefine")) || (IS_SCHEMA(child, "annotation"))) { if (IS_SCHEMA(child, "annotation")) { - annot = xmlSchemaParseAnnotation(ctxt, schema, child); + annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); if (schema->annot == NULL) schema->annot = annot; else @@ -8938,13 +9748,13 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, xmlSchemaParseSimpleType(ctxt, schema, child, 1); child = child->next; } else if (IS_SCHEMA(child, "element")) { - xmlSchemaParseElement(ctxt, schema, child, 1); + xmlSchemaParseElement(ctxt, schema, child, NULL, 1); child = child->next; } else if (IS_SCHEMA(child, "attribute")) { - xmlSchemaParseAttribute(ctxt, schema, child, 1); + xmlSchemaParseGlobalAttribute(ctxt, schema, child); child = child->next; } else if (IS_SCHEMA(child, "attributeGroup")) { - xmlSchemaParseAttributeGroup(ctxt, schema, child, 1); + xmlSchemaParseAttributeGroupDefinition(ctxt, schema, child); child = child->next; } else if (IS_SCHEMA(child, "group")) { xmlSchemaParseModelGroupDefinition(ctxt, schema, child); @@ -8955,14 +9765,17 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, } else { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, child->parent, child, + NULL, child->parent, child, NULL, "((include | import | redefine | annotation)*, " "(((simpleType | complexType | group | attributeGroup) " "| element | attribute | notation), annotation*)*)"); child = child->next; } while (IS_SCHEMA(child, "annotation")) { - annot = xmlSchemaParseAnnotation(ctxt, schema, child); + /* + * TODO: We should add all annotations. + */ + annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); if (schema->annot == NULL) schema->annot = annot; else @@ -8971,7 +9784,6 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, } } exit: - ctxt->parentItem = NULL; ctxt->ctxtType = NULL; if (oldErrs != ctxt->nberrors) res = ctxt->err; @@ -9003,6 +9815,18 @@ xmlSchemaSchemaRelationFree(xmlSchemaSchemaRelationPtr rel) } #endif +static void +xmlSchemaRedefListFree(xmlSchemaRedefPtr redef) +{ + xmlSchemaRedefPtr prev; + + while (redef != NULL) { + prev = redef; + redef = redef->next; + xmlFree(prev); + } +} + static void xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con) { @@ -9019,6 +9843,8 @@ xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con) if (con->substGroups != NULL) xmlHashFree(con->substGroups, (xmlHashDeallocator) xmlSchemaSubstGroupFree); + if (con->redefs != NULL) + xmlSchemaRedefListFree(con->redefs); if (con->dict != NULL) xmlDictFree(con->dict); xmlFree(con); @@ -9070,6 +9896,11 @@ xmlSchemaParserCtxtCreate(void) } memset(ret, 0, sizeof(xmlSchemaParserCtxt)); ret->type = XML_SCHEMA_CTXT_PARSER; + ret->attrProhibs = xmlSchemaItemListCreate(); + if (ret->attrProhibs == NULL) { + xmlFree(ret); + return(NULL); + } return(ret); } @@ -9114,7 +9945,9 @@ xmlSchemaCreatePCtxtOnVCtxt(xmlSchemaValidCtxtPtr vctxt) } /* TODO: Pass user data. */ xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error, - vctxt->warning, vctxt->userData); + vctxt->warning, vctxt->errCtxt); + xmlSchemaSetParserStructuredErrors(vctxt->pctxt, vctxt->serror, + vctxt->errCtxt); } return (0); } @@ -9312,7 +10145,9 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, */ newpctxt->schema = schema; xmlSchemaSetParserErrors(newpctxt, pctxt->error, pctxt->warning, - pctxt->userData); + pctxt->errCtxt); + xmlSchemaSetParserStructuredErrors(newpctxt, pctxt->serror, + pctxt->errCtxt); newpctxt->counter = pctxt->counter; @@ -9459,7 +10294,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, /* * Save the namespace import information. */ - if (WXS_IS_IMPMAIN(type)) { + if (WXS_IS_BUCKET_IMPMAIN(type)) { relation->importNamespace = importNamespace; if (schemaLocation == NULL) { /* @@ -9475,7 +10310,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, /* Did we already fetch the doc? */ if (bkt != NULL) { /* TODO: The following nasty cases will produce an error. */ - if ((WXS_IS_IMPMAIN(type)) && (! bkt->imported)) { + if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) { /* We included/redefined and then try to import a schema. */ xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, @@ -9483,7 +10318,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, "it was already included or redefined", schemaLocation, NULL); goto exit; - } else if ((! WXS_IS_IMPMAIN(type)) && (bkt->imported)) { + } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) { /* We imported and then try to include/redefine a schema. */ xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, @@ -9494,7 +10329,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } } - if (WXS_IS_IMPMAIN(type)) { + if (WXS_IS_BUCKET_IMPMAIN(type)) { /* * Given that the schemaLocation [attribute] is only a hint, it is open * to applications to ignore all but the first for a given @@ -9751,7 +10586,7 @@ doc_load: if (preserveDoc) bkt->preserveDoc = 1; } - if (WXS_IS_IMPMAIN(type)) + if (WXS_IS_BUCKET_IMPMAIN(type)) bkt->imported++; /* * Add it to the graph of schemas. @@ -9803,8 +10638,8 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, xmlNodePtr node) { xmlNodePtr child; - const xmlChar *namespaceName = NULL; - const xmlChar *schemaLocation = NULL; + const xmlChar *namespaceName = NULL, *schemaLocation = NULL; + const xmlChar *thisTargetNamespace; xmlAttrPtr attr; int ret = 0; xmlSchemaBucketPtr bucket = NULL; @@ -9822,20 +10657,18 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, (!xmlStrEqual(attr->name, BAD_CAST "namespace")) && (!xmlStrEqual(attr->name, BAD_CAST "schemaLocation"))) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } /* * Extract and validate attributes. */ - if (xmlSchemaPValAttr(pctxt, NULL, NULL, node, + if (xmlSchemaPValAttr(pctxt, NULL, node, "namespace", xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), &namespaceName) != 0) { xmlSchemaPSimpleTypeErr(pctxt, @@ -9846,7 +10679,7 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, return (pctxt->err); } - if (xmlSchemaPValAttr(pctxt, NULL, NULL, node, + if (xmlSchemaPValAttr(pctxt, NULL, node, "schemaLocation", xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), &schemaLocation) != 0) { xmlSchemaPSimpleTypeErr(pctxt, @@ -9870,25 +10703,31 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, if (child != NULL) { xmlSchemaPContentErr(pctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?)"); } /* * Apply additional constraints. + * + * Note that it is important to use the original @targetNamespace + * (or none at all), to rule out imports of schemas _with_ a + * @targetNamespace if the importing schema is a chameleon schema + * (with no @targetNamespace). */ + thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace; if (namespaceName != NULL) { /* * 1.1 If the namespace [attribute] is present, then its ·actual value· * must not match the ·actual value· of the enclosing 's * targetNamespace [attribute]. */ - if (xmlStrEqual(pctxt->targetNamespace, namespaceName)) { + if (xmlStrEqual(thisTargetNamespace, namespaceName)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_IMPORT_1_1, - NULL, NULL, node, + NULL, node, "The value of the attribute 'namespace' must not match " "the target namespace '%s' of the importing schema", - pctxt->targetNamespace); + thisTargetNamespace); return (pctxt->err); } } else { @@ -9896,10 +10735,10 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, * 1.2 If the namespace [attribute] is not present, then the enclosing * must have a targetNamespace [attribute]. */ - if (pctxt->targetNamespace == NULL) { + if (thisTargetNamespace == NULL) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_IMPORT_1_2, - NULL, NULL, node, + NULL, node, "The attribute 'namespace' must be existent if " "the importing schema has no target namespace", NULL); @@ -9907,13 +10746,13 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, } } /* - * Locate and aquire the schema document. + * Locate and acquire the schema document. */ if (schemaLocation != NULL) schemaLocation = xmlSchemaBuildAbsoluteURI(pctxt->dict, schemaLocation, node); ret = xmlSchemaAddSchemaDoc(pctxt, XML_SCHEMA_SCHEMA_IMPORT, - schemaLocation, NULL, NULL, 0, node, pctxt->targetNamespace, + schemaLocation, NULL, NULL, 0, node, thisTargetNamespace, namespaceName, &bucket); if (ret != 0) @@ -9965,17 +10804,15 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "schemaLocation"))) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(pctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); /* * Preliminary step, extract the URI-Reference and make an URI * from the base. @@ -9988,7 +10825,7 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, xmlChar *base = NULL; xmlChar *uri = NULL; - if (xmlSchemaPValAttrNode(pctxt, NULL, NULL, attr, + if (xmlSchemaPValAttrNode(pctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), (const xmlChar **) schemaLocation) != 0) goto exit_error; @@ -10019,13 +10856,13 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, if (type == XML_SCHEMA_SCHEMA_REDEFINE) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_REDEFINE, - NULL, NULL, node, + NULL, node, "The schema document '%s' cannot redefine itself.", *schemaLocation); } else { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_INCLUDE, - NULL, NULL, node, + NULL, node, "The schema document '%s' cannot include itself.", *schemaLocation); } @@ -10047,7 +10884,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, { xmlNodePtr child = NULL; const xmlChar *schemaLocation = NULL; - int res = 0, /* docRes = 0, located = 0, */ hasRedefinitions = 0; + int res = 0; /* hasRedefinitions = 0 */ int isChameleon = 0, wasChameleon = 0; xmlSchemaBucketPtr bucket = NULL; @@ -10070,12 +10907,10 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, if (res != 0) return(res); /* - if (bucket == NULL) { - PERROR_INT("xmlSchemaParseIncludeOrRedefine", - "no schema bucket aquired"); - return(-1); - } - */ + * If we get no schema bucket back, then this means that the schema + * document could not be located or was broken XML or was not + * a schema document. + */ if ((bucket == NULL) || (bucket->doc == NULL)) { if (type == XML_SCHEMA_SCHEMA_INCLUDE) { /* @@ -10139,7 +10974,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, /* TODO: Change error function. */ xmlSchemaPCustomErrExt(pctxt, XML_SCHEMAP_SRC_INCLUDE, - NULL, NULL, node, + NULL, node, "The target namespace '%s' of the included/redefined " "schema '%s' differs from '%s' of the " "including/redefining schema", @@ -10186,11 +11021,11 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * And now for the children... */ child = node->children; - if (type == XML_SCHEMA_SCHEMA_REDEFINE) { - + if (type == XML_SCHEMA_SCHEMA_REDEFINE) { /* * Parse (simpleType | complexType | group | attributeGroup))* */ + pctxt->redefined = bucket; /* * How to proceed if the redefined schema was not located? */ @@ -10204,30 +11039,23 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, /* * TODO: discard or not? */ - } else if (bucket && bucket->parsed) { - /* - * TODO: Not nice: we won't parse the stuff if the redefined - * document was not parsed or not located. - */ - if (IS_SCHEMA(child, "simpleType")) { - xmlSchemaParseSimpleType(pctxt, schema, child, 1); - } else if (IS_SCHEMA(child, "complexType")) { - xmlSchemaParseComplexType(pctxt, schema, child, 1); - hasRedefinitions = 1; - } else if (IS_SCHEMA(child, "group")) { - TODO - hasRedefinitions = 1; - /* xmlSchemaParseModelGroupDefinition(pctxt, - schema, child); */ - } else if (IS_SCHEMA(child, "attributeGroup")) { - TODO - hasRedefinitions = 1; - /* xmlSchemaParseAttributeGroup(pctxt, schema, - child, 1); */ - } + } else if (IS_SCHEMA(child, "simpleType")) { + xmlSchemaParseSimpleType(pctxt, schema, child, 1); + } else if (IS_SCHEMA(child, "complexType")) { + xmlSchemaParseComplexType(pctxt, schema, child, 1); + /* hasRedefinitions = 1; */ + } else if (IS_SCHEMA(child, "group")) { + /* hasRedefinitions = 1; */ + xmlSchemaParseModelGroupDefinition(pctxt, + schema, child); + } else if (IS_SCHEMA(child, "attributeGroup")) { + /* hasRedefinitions = 1; */ + xmlSchemaParseAttributeGroupDefinition(pctxt, schema, + child); } child = child->next; } + pctxt->redefined = NULL; pctxt->isRedefine = 0; } else { if (IS_SCHEMA(child, "annotation")) { @@ -10241,11 +11069,11 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, res = XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED; if (type == XML_SCHEMA_SCHEMA_REDEFINE) { xmlSchemaPContentErr(pctxt, res, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation | (simpleType | complexType | group | attributeGroup))*"); } else { xmlSchemaPContentErr(pctxt, res, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?)"); } } @@ -10292,7 +11120,18 @@ xmlSchemaParseInclude(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, * @type: the "compositor" type * @particleNeeded: if a a model group with a particle * - * parse a XML schema Sequence definition + * parse a XML schema Sequence definition. + * Applies parts of: + * Schema Representation Constraint: + * Redefinition Constraints and Semantics (src-redefine) + * (6.1), (6.1.1), (6.1.2) + * + * Schema Component Constraint: + * All Group Limited (cos-all-limited) (2) + * TODO: Actually this should go to component-level checks, + * but is done here due to performance. Move it to an other layer + * is schema construction via an API is implemented. + * * *WARNING* this interface is highly subject to change * * Returns -1 in case of error, 0 if the declaration is improper and @@ -10307,7 +11146,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaParticlePtr particle = NULL; xmlNodePtr child = NULL; xmlAttrPtr attr; - int min = 0, max = 0; + int min = 1, max = 1, isElemRef, hasRefs = 0; if ((ctxt == NULL) || (schema == NULL) || (node == NULL)) return (NULL); @@ -10346,13 +11185,11 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, (!xmlStrEqual(attr->name, BAD_CAST "maxOccurs")) && (!xmlStrEqual(attr->name, BAD_CAST "minOccurs"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -10365,29 +11202,26 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (attr->ns == NULL) { if (!xmlStrEqual(attr->name, BAD_CAST "id")) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - } /* * Extract and validate attributes. */ - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - item->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + item->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } if (type == XML_SCHEMA_TYPE_ALL) { @@ -10395,17 +11229,33 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, while (IS_SCHEMA(child, "element")) { part = (xmlSchemaParticlePtr) xmlSchemaParseElement(ctxt, - schema, child, 0); + schema, child, &isElemRef, 0); + /* + * SPEC cos-all-limited (2) + * "The {max occurs} of all the particles in the {particles} + * of the ('all') group must be 0 or 1. + */ if (part != NULL) { - if (part->minOccurs > 1) - xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INVALID_MINOCCURS, - NULL, NULL, child, - "Invalid value for minOccurs (must be 0 or 1)", NULL); - if (part->maxOccurs > 1) - xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INVALID_MAXOCCURS, - NULL, NULL, child, + if (isElemRef) + hasRefs++; + if (part->minOccurs > 1) { + xmlSchemaPCustomErr(ctxt, + XML_SCHEMAP_COS_ALL_LIMITED, + NULL, child, + "Invalid value for minOccurs (must be 0 or 1)", + NULL); + /* Reset to 1. */ + part->minOccurs = 1; + } + if (part->maxOccurs > 1) { + xmlSchemaPCustomErr(ctxt, + XML_SCHEMAP_COS_ALL_LIMITED, + NULL, child, "Invalid value for maxOccurs (must be 0 or 1)", NULL); + /* Reset to 1. */ + part->maxOccurs = 1; + } if (last == NULL) item->children = (xmlSchemaTreeItemPtr) part; else @@ -10417,7 +11267,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (annotation?, element*)"); } } else { @@ -10432,10 +11282,76 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (IS_SCHEMA(child, "element")) { part = (xmlSchemaTreeItemPtr) - xmlSchemaParseElement(ctxt, schema, child, 0); + xmlSchemaParseElement(ctxt, schema, child, &isElemRef, 0); + if (part && isElemRef) + hasRefs++; } else if (IS_SCHEMA(child, "group")) { part = xmlSchemaParseModelGroupDefRef(ctxt, schema, child); + if (part != NULL) + hasRefs++; + /* + * Handle redefinitions. + */ + if (ctxt->isRedefine && ctxt->redef && + (ctxt->redef->item->type == XML_SCHEMA_TYPE_GROUP) && + part && part->children) + { + if ((xmlSchemaGetQNameRefName(part->children) == + ctxt->redef->refName) && + (xmlSchemaGetQNameRefTargetNs(part->children) == + ctxt->redef->refTargetNs)) + { + /* + * SPEC src-redefine: + * (6.1) "If it has a among its contents at + * some level the ·actual value· of whose ref + * [attribute] is the same as the ·actual value· of + * its own name attribute plus target namespace, then + * all of the following must be true:" + * (6.1.1) "It must have exactly one such group." + */ + if (ctxt->redefCounter != 0) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_SRC_REDEFINE, child, NULL, + "The redefining model group definition " + "'%s' must not contain more than one " + "reference to the redefined definition", + xmlSchemaFormatQName(&str, + ctxt->redef->refTargetNs, + ctxt->redef->refName), + NULL); + FREE_AND_NULL(str) + part = NULL; + } else if (((WXS_PARTICLE(part))->minOccurs != 1) || + ((WXS_PARTICLE(part))->maxOccurs != 1)) + { + xmlChar *str = NULL; + /* + * SPEC src-redefine: + * (6.1.2) "The ·actual value· of both that + * group's minOccurs and maxOccurs [attribute] + * must be 1 (or ·absent·). + */ + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_SRC_REDEFINE, child, NULL, + "The redefining model group definition " + "'%s' must not contain a reference to the " + "redefined definition with a " + "maxOccurs/minOccurs other than 1", + xmlSchemaFormatQName(&str, + ctxt->redef->refTargetNs, + ctxt->redef->refName), + NULL); + FREE_AND_NULL(str) + part = NULL; + } + ctxt->redef->reference = WXS_BASIC_CAST part; + ctxt->redefCounter++; + } + } } else if (IS_SCHEMA(child, "any")) { part = (xmlSchemaTreeItemPtr) xmlSchemaParseAny(ctxt, schema, child); @@ -10458,16 +11374,21 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (element | group | choice | sequence | any)*)"); } } - if (withParticle) { - if ((min == 0) && (max == 0)) - return (NULL); - else - return ((xmlSchemaTreeItemPtr) particle); - } else + if ((max == 0) && (min == 0)) + return (NULL); + if (hasRefs) { + /* + * We need to resolve references. + */ + WXS_ADD_PENDING(ctxt, item); + } + if (withParticle) + return ((xmlSchemaTreeItemPtr) particle); + else return ((xmlSchemaTreeItemPtr) item); } @@ -10505,20 +11426,18 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "base"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } /* * Extract and validate attributes. */ - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Attribute */ @@ -10531,21 +11450,20 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * the {content type} of the type definition ·resolved· to by * the ·actual value· of the base [attribute]" */ - if (xmlSchemaPValAttrQName(ctxt, schema, - NULL, NULL, node, "base", + if (xmlSchemaPValAttrQName(ctxt, schema, NULL, node, "base", &(type->baseNs), &(type->base)) == 0) { if ((type->base == NULL) && (type->type == XML_SCHEMA_TYPE_COMPLEX)) { xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, - type, node, "base", NULL); + NULL, node, "base", NULL); } else if ((ctxt->isRedefine) && (type->flags & XML_SCHEMAS_TYPE_GLOBAL)) { if (type->base == NULL) { xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, - type, node, "base", NULL); + NULL, node, "base", NULL); } else if ((! xmlStrEqual(type->base, type->name)) || (! xmlStrEqual(type->baseNs, type->targetNamespace))) { @@ -10558,7 +11476,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * of its own name attribute plus target namespace;" */ xmlSchemaPCustomErrExt(ctxt, XML_SCHEMAP_SRC_REDEFINE, - NULL, NULL, node, "This is a redefinition, but the QName " + NULL, node, "This is a redefinition, but the QName " "value '%s' of the 'base' attribute does not match the " "type's designation '%s'", xmlSchemaFormatQName(&str1, type->baseNs, type->base), @@ -10566,6 +11484,9 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->name), NULL); FREE_AND_NULL(str1); FREE_AND_NULL(str2); + /* Avoid confusion and erase the values. */ + type->base = NULL; + type->baseNs = NULL; } } } @@ -10578,7 +11499,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Add the annotation to the simple type ancestor. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (parentType == XML_SCHEMA_TYPE_SIMPLE) { @@ -10594,7 +11515,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, - NULL, NULL, node, child, + NULL, node, child, "The attribute 'base' and the child are " "mutually exclusive", NULL); } else { @@ -10605,7 +11526,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else if (type->base == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, - NULL, NULL, node, child, + NULL, node, child, "Either the attribute 'base' or a child " "must be present", NULL); } @@ -10634,9 +11555,13 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Model group reference . */ - } else if (IS_SCHEMA(child, "group")) { + } else if (IS_SCHEMA(child, "group")) { type->subtypes = (xmlSchemaTypePtr) xmlSchemaParseModelGroupDefRef(ctxt, schema, child); + /* + * Note that the reference will be resolved in + * xmlSchemaResolveTypeReferences(); + */ child = child->next; } } else if (parentType == XML_SCHEMA_TYPE_SIMPLE_CONTENT) { @@ -10728,7 +11653,10 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Attribute uses/declarations. */ - child = xmlSchemaParseAttrDecls(ctxt, schema, child, type); + if (xmlSchemaParseLocalAttributes(ctxt, schema, &child, + (xmlSchemaItemListPtr *) &(type->attrUses), + XML_SCHEMA_TYPE_RESTRICTION, NULL) == -1) + return(NULL); /* * Attribute wildcard. */ @@ -10742,13 +11670,13 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (parentType == XML_SCHEMA_TYPE_COMPLEX_CONTENT) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "annotation?, (group | all | choice | sequence)?, " "((attribute | attributeGroup)*, anyAttribute?))"); } else if (parentType == XML_SCHEMA_TYPE_SIMPLE_CONTENT) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (simpleType?, (minExclusive | minInclusive | " "maxExclusive | maxInclusive | totalDigits | fractionDigits | " "length | minLength | maxLength | enumeration | whiteSpace | " @@ -10757,7 +11685,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* Simple type */ xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (simpleType?, (minExclusive | minInclusive | " "maxExclusive | maxInclusive | totalDigits | fractionDigits | " "length | minLength | maxLength | enumeration | whiteSpace | " @@ -10802,24 +11730,22 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if ((!xmlStrEqual(attr->name, BAD_CAST "id")) && (!xmlStrEqual(attr->name, BAD_CAST "base"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Attribute "base" - mandatory. */ - if ((xmlSchemaPValAttrQName(ctxt, schema, - NULL, NULL, node, "base", &(type->baseNs), &(type->base)) == 0) && + if ((xmlSchemaPValAttrQName(ctxt, schema, NULL, node, + "base", &(type->baseNs), &(type->base)) == 0) && (type->base == NULL)) { xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, @@ -10834,7 +11760,7 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Add the annotation to the type ancestor. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (parentType == XML_SCHEMA_TYPE_COMPLEX_CONTENT) { @@ -10861,6 +11787,10 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else if (IS_SCHEMA(child, "group")) { type->subtypes = (xmlSchemaTypePtr) xmlSchemaParseModelGroupDefRef(ctxt, schema, child); + /* + * Note that the reference will be resolved in + * xmlSchemaResolveTypeReferences(); + */ child = child->next; } } @@ -10868,7 +11798,10 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Attribute uses/declarations. */ - child = xmlSchemaParseAttrDecls(ctxt, schema, child, type); + if (xmlSchemaParseLocalAttributes(ctxt, schema, &child, + (xmlSchemaItemListPtr *) &(type->attrUses), + XML_SCHEMA_TYPE_EXTENSION, NULL) == -1) + return(NULL); /* * Attribute wildcard. */ @@ -10883,14 +11816,14 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* Complex content extension. */ xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, ((group | all | choice | sequence)?, " "((attribute | attributeGroup)*, anyAttribute?)))"); } else { /* Simple content extension. */ xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, ((attribute | attributeGroup)*, " "anyAttribute?))"); } @@ -10933,18 +11866,16 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, if (attr->ns == NULL) { if ((!xmlStrEqual(attr->name, BAD_CAST "id"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * And now for the children... @@ -10955,19 +11886,19 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, * Add the annotation to the complex type ancestor. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, NULL, node, NULL, NULL, + NULL, node, NULL, NULL, "(annotation?, (restriction | extension))"); } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, NULL, node, NULL, NULL, + NULL, node, NULL, NULL, "(annotation?, (restriction | extension))"); } if (IS_SCHEMA(child, "restriction")) { @@ -10984,7 +11915,7 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, NULL, + NULL, node, child, NULL, "(annotation?, (restriction | extension))"); } return (0); @@ -11026,23 +11957,21 @@ xmlSchemaParseComplexContent(xmlSchemaParserCtxtPtr ctxt, (!xmlStrEqual(attr->name, BAD_CAST "mixed"))) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } - xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* * Set the 'mixed' on the complex type ancestor. */ - if (xmlGetBooleanProp(ctxt, NULL, NULL, node, "mixed", 0)) { + if (xmlGetBooleanProp(ctxt, node, "mixed", 0)) { if ((type->flags & XML_SCHEMAS_TYPE_MIXED) == 0) type->flags |= XML_SCHEMAS_TYPE_MIXED; } @@ -11052,19 +11981,19 @@ xmlSchemaParseComplexContent(xmlSchemaParserCtxtPtr ctxt, * Add the annotation to the complex type ancestor. */ xmlSchemaAddAnnotation((xmlSchemaAnnotItemPtr) type, - xmlSchemaParseAnnotation(ctxt, schema, child)); + xmlSchemaParseAnnotation(ctxt, schema, child, 1)); child = child->next; } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, NULL, node, NULL, + NULL, node, NULL, NULL, "(annotation?, (restriction | extension))"); } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, - NULL, NULL, node, NULL, + NULL, node, NULL, NULL, "(annotation?, (restriction | extension))"); } if (IS_SCHEMA(child, "restriction")) { @@ -11081,7 +12010,7 @@ xmlSchemaParseComplexContent(xmlSchemaParserCtxtPtr ctxt, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, NULL, node, child, + NULL, node, child, NULL, "(annotation?, (restriction | extension))"); } return (0); @@ -11124,8 +12053,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, NULL, node, "name", NULL); return (NULL); - } else if (xmlSchemaPValAttrNode(ctxt, - NULL, NULL, attr, + } else if (xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); } @@ -11137,11 +12065,14 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ #ifdef ENABLE_NAMED_LOCALS snprintf(buf, 39, "#CT%d", ctxt->counter++ + 1); - type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf, + type = xmlSchemaAddType(ctxt, schema, + XML_SCHEMA_TYPE_COMPLEX, + xmlDictLookup(ctxt->dict, (const xmlChar *)buf, -1), ctxt->targetNamespace, node, 0); #else - type = xmlSchemaAddType(ctxt, schema, NULL, - ctxt->targetNamespace, node, 0); + type = xmlSchemaAddType(ctxt, schema, + XML_SCHEMA_TYPE_COMPLEX, + NULL, ctxt->targetNamespace, node, 0); #endif if (type == NULL) return (NULL); @@ -11155,8 +12086,9 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Parse as global complex type definition. */ - type = xmlSchemaAddType(ctxt, schema, name, ctxt->targetNamespace, - node, 1); + type = xmlSchemaAddType(ctxt, schema, + XML_SCHEMA_TYPE_COMPLEX, + name, ctxt->targetNamespace, node, 1); if (type == NULL) return (NULL); type->node = node; @@ -11174,14 +12106,13 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Attribute "id". */ - xmlSchemaPValAttrID(ctxt, NULL, type, node, - BAD_CAST "id"); + xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); } else if (xmlStrEqual(attr->name, BAD_CAST "mixed")) { /* * Attribute "mixed". */ - if (xmlSchemaPGetBoolNodeValue(ctxt, NULL, type, - (xmlNodePtr) attr)) + if (xmlSchemaPGetBoolNodeValue(ctxt, + NULL, (xmlNodePtr) attr)) type->flags |= XML_SCHEMAS_TYPE_MIXED; } else if (topLevel) { /* @@ -11193,8 +12124,8 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Attribute "abstract". */ - if (xmlSchemaPGetBoolNodeValue(ctxt, NULL, type, - (xmlNodePtr) attr)) + if (xmlSchemaPGetBoolNodeValue(ctxt, + NULL, (xmlNodePtr) attr)) type->flags |= XML_SCHEMAS_TYPE_ABSTRACT; } else if (xmlStrEqual(attr->name, BAD_CAST "final")) { /* @@ -11211,7 +12142,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, { xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - type, (xmlNodePtr) attr, NULL, + NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction))", attrValue, NULL, NULL, NULL); } else @@ -11229,25 +12160,22 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, -1, -1, -1) != 0) { xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, - type, (xmlNodePtr) attr, NULL, + NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction)) ", attrValue, NULL, NULL, NULL); } else block = 1; } else { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, - NULL, type, attr); + xmlSchemaPIllegalAttrErr(ctxt, + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; } @@ -11274,7 +12202,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ child = node->children; if (IS_SCHEMA(child, "annotation")) { - type->annot = xmlSchemaParseAnnotation(ctxt, schema, child); + type->annot = xmlSchemaParseAnnotation(ctxt, schema, child, 1); child = child->next; } ctxt->ctxtType = type; @@ -11331,12 +12259,19 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else if (IS_SCHEMA(child, "group")) { type->subtypes = (xmlSchemaTypePtr) xmlSchemaParseModelGroupDefRef(ctxt, schema, child); + /* + * Note that the reference will be resolved in + * xmlSchemaResolveTypeReferences(); + */ child = child->next; } /* * Parse attribute decls/refs. */ - child = xmlSchemaParseAttrDecls(ctxt, schema, child, type); + if (xmlSchemaParseLocalAttributes(ctxt, schema, &child, + (xmlSchemaItemListPtr *) &(type->attrUses), + XML_SCHEMA_TYPE_RESTRICTION, NULL) == -1) + return(NULL); /* * Parse attribute wildcard. */ @@ -11348,7 +12283,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (child != NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, - NULL, type, node, child, + NULL, node, child, NULL, "(annotation?, (simpleContent | complexContent | " "((group | all | choice | sequence)?, ((attribute | " "attributeGroup)*, anyAttribute?))))"); @@ -11358,7 +12293,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ if (topLevel && ctxt->isRedefine && (! hasRestrictionOrExtension)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_REDEFINE, - NULL, NULL, node, "This is a redefinition, thus the " + NULL, node, "This is a redefinition, thus the " " must have a or " "grand-child", NULL); } @@ -11527,6 +12462,8 @@ xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt) ctxt->constructor = NULL; ctxt->ownsConstructor = 0; } + if (ctxt->attrProhibs != NULL) + xmlSchemaItemListFree(ctxt->attrProhibs); xmlDictFree(ctxt->dict); xmlFree(ctxt); } @@ -11555,7 +12492,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, end = xmlAutomataNewState(pctxt->am); substGroup = xmlSchemaSubstGroupGet(pctxt, elemDecl); if (substGroup == NULL) { - xmlSchemaPErr(pctxt, GET_NODE(particle), + xmlSchemaPErr(pctxt, WXS_ITEM_NODE(particle), XML_SCHEMAP_INTERNAL, "Internal error: xmlSchemaBuildContentModelForSubstGroup, " "declaration is marked having a subst. group but none " @@ -11658,10 +12595,11 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, } else if ((particle->maxOccurs >= UNBOUNDED) && (particle->minOccurs < 2)) { /* Special case. */ - start = ctxt->state; + start = ctxt->state; ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, - elemDecl->name, elemDecl->targetNamespace, elemDecl); - xmlAutomataNewEpsilon(ctxt->am, ctxt->state, start); + elemDecl->name, elemDecl->targetNamespace, elemDecl); + ctxt->state = xmlAutomataNewTransition2(ctxt->am, ctxt->state, ctxt->state, + elemDecl->name, elemDecl->targetNamespace, elemDecl); } else { int counter; int maxOccurs = particle->maxOccurs == UNBOUNDED ? @@ -11688,7 +12626,8 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, * @particle: the particle component * @name: the complex type's name whose content is being built * - * Generate the automata sequence needed for that type + * Create the automaton for the {content type} of a complex type. + * */ static void xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, @@ -11699,7 +12638,10 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, return; } if (particle->children == NULL) { - PERROR_INT("xmlSchemaBuildAContentModel", "no term on particle"); + /* + * Just return in this case. A missing "term" of the particle + * might arise due to an invalid "term" component. + */ return; } @@ -12037,7 +12979,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, xmlSchemaInternalErr2(ACTXT_CAST pctxt, "xmlSchemaBuildAContentModel", "found unexpected term of type '%s' in content model", - xmlSchemaCompTypeToString(particle->children->type), NULL); + WXS_ITEM_TYPE_NAME(particle->children), NULL); return; } } @@ -12054,8 +12996,6 @@ static void xmlSchemaBuildContentModel(xmlSchemaTypePtr type, xmlSchemaParserCtxtPtr ctxt) { - xmlAutomataStatePtr start; - if ((type->type != XML_SCHEMA_TYPE_COMPLEX) || (type->contModel != NULL) || ((type->contentType != XML_SCHEMA_CONTENT_ELEMENTS) && @@ -12066,27 +13006,30 @@ xmlSchemaBuildContentModel(xmlSchemaTypePtr type, xmlGenericError(xmlGenericErrorContext, "Building content model for %s\n", name); #endif - + ctxt->am = NULL; ctxt->am = xmlNewAutomata(); if (ctxt->am == NULL) { xmlGenericError(xmlGenericErrorContext, "Cannot create automata for complex type %s\n", type->name); return; } - start = ctxt->state = xmlAutomataGetInitState(ctxt->am); - xmlSchemaBuildAContentModel(ctxt, (xmlSchemaParticlePtr) type->subtypes); + ctxt->state = xmlAutomataGetInitState(ctxt->am); + /* + * Build the automaton. + */ + xmlSchemaBuildAContentModel(ctxt, WXS_TYPE_PARTICLE(type)); xmlAutomataSetFinalState(ctxt->am, ctxt->state); type->contModel = xmlAutomataCompile(ctxt->am); if (type->contModel == NULL) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INTERNAL, - NULL, type, type->node, + WXS_BASIC_CAST type, type->node, "Failed to compile the content model", NULL); } else if (xmlRegexpIsDeterminist(type->contModel) != 1) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_NOT_DETERMINISTIC, /* XML_SCHEMAS_ERR_NOTDETERMINIST, */ - NULL, type, type->node, + WXS_BASIC_CAST type, type->node, "The content model is not determinist", NULL); } else { #ifdef DEBUG_CONTENT_REGEXP @@ -12130,7 +13073,7 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, if (type == NULL) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) elemDecl, elemDecl->node, + WXS_BASIC_CAST elemDecl, elemDecl->node, "type", elemDecl->namedType, elemDecl->namedTypeNs, XML_SCHEMA_TYPE_BASIC, "type definition"); } else @@ -12148,7 +13091,7 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, if (substHead == NULL) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) elemDecl, NULL, + WXS_BASIC_CAST elemDecl, NULL, "substitutionGroup", elemDecl->substGroup, elemDecl->substGroupNs, XML_SCHEMA_TYPE_ELEMENT, NULL); } else { @@ -12157,7 +13100,7 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, * Set the "substitution group affiliation". * NOTE that now we use the "refDecl" field for this. */ - SUBST_GROUP_AFF(elemDecl) = substHead; + WXS_SUBST_HEAD(elemDecl) = substHead; /* * The type definitions is set to: * SPEC "...the {type definition} of the element @@ -12216,9 +13159,9 @@ xmlSchemaResolveUnionMemberTypes(xmlSchemaParserCtxtPtr ctxt, nsName = ((xmlSchemaQNameRefPtr) link->type)->targetNamespace; memberType = xmlSchemaGetType(ctxt->schema, name, nsName); - if ((memberType == NULL) || (! IS_SIMPLE_TYPE(memberType))) { + if ((memberType == NULL) || (! WXS_IS_SIMPLE(memberType))) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - type, type->node, "memberTypes", + WXS_BASIC_CAST type, type->node, "memberTypes", name, nsName, XML_SCHEMA_TYPE_SIMPLE, NULL); /* * Remove the member type link. @@ -12273,7 +13216,7 @@ xmlSchemaIsDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType) { if (type == NULL) return (0); - if (IS_COMPLEX_TYPE(type)) + if (WXS_IS_COMPLEX(type)) return (0); if (type->type == XML_SCHEMA_TYPE_BASIC) { if (type->builtInType == valType) @@ -12282,10 +13225,8 @@ xmlSchemaIsDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType) (type->builtInType == XML_SCHEMAS_ANYTYPE)) return (0); return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType)); - } else - return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType)); - - return (0); + } + return(xmlSchemaIsDerivedFromBuiltInType(type->subtypes, valType)); } #if 0 @@ -12304,7 +13245,7 @@ xmlSchemaIsUserDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType) { if (type == NULL) return (0); - if (IS_COMPLEX_TYPE(type)) + if (WXS_IS_COMPLEX(type)) return (0); if (type->type == XML_SCHEMA_TYPE_BASIC) { if (type->builtInType == valType) @@ -12322,14 +13263,11 @@ xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type) { if (type == NULL) return (NULL); - if (IS_COMPLEX_TYPE(type)) + if (WXS_IS_COMPLEX(type)) return (NULL); if (type->type == XML_SCHEMA_TYPE_BASIC) - return(type); - else - return(xmlSchemaQueryBuiltInType(type->subtypes)); - - return (NULL); + return(type); + return(xmlSchemaQueryBuiltInType(type->subtypes)); } /** @@ -12368,7 +13306,7 @@ xmlSchemaGetPrimitiveType(xmlSchemaTypePtr type) static xmlSchemaTypePtr xmlSchemaGetBuiltInTypeAncestor(xmlSchemaTypePtr type) { - if (VARIETY_LIST(type) || VARIETY_UNION(type)) + if (WXS_IS_LIST(type) || WXS_IS_UNION(type)) return (0); while (type != NULL) { if (type->type == XML_SCHEMA_TYPE_BASIC) @@ -12380,73 +13318,6 @@ xmlSchemaGetBuiltInTypeAncestor(xmlSchemaTypePtr type) } #endif -/** - * xmlSchemaBuildAttributeUsesOwned: - * @ctxt: the schema parser context - * @type: the complex type definition - * @cur: the attribute declaration list - * @lastUse: the top of the attribute use list - * - * Builds the attribute uses list on the given complex type. - * This one is supposed to be called by - * xmlSchemaBuildAttributeValidation only. - */ -static int -xmlSchemaBuildAttributeUsesOwned(xmlSchemaParserCtxtPtr ctxt, - int isRestriction, - xmlSchemaAttributePtr cur, - xmlSchemaAttributeLinkPtr *uses, - xmlSchemaAttributeLinkPtr *lastUse, - int *hasProhibitions) -{ - xmlSchemaAttributeLinkPtr tmp; - while (cur != NULL) { - if (cur->type == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { - /* - * W3C: "2 The {attribute uses} of the attribute groups ·resolved· - * to by the ·actual value·s of the ref [attribute] of the - * [children], if any." - */ - if (xmlSchemaBuildAttributeUsesOwned(ctxt, isRestriction, - ((xmlSchemaAttributeGroupPtr) cur)->attributes, uses, - lastUse, hasProhibitions) == -1) { - return (-1); - } - } else if ((! isRestriction) && - (cur->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED)) { - /* - * Warn about pointless prohibitions when extending. - */ - xmlSchemaCustomWarning(ACTXT_CAST ctxt, - XML_SCHEMAP_WARN_ATTR_REDECL_PROH, - cur->node, NULL, - "Attribute use prohibitions are pointless when " - "extending a type", NULL, NULL, NULL); - } else { - /* W3C: "1 The set of attribute uses corresponding to the - * [children], if any." - */ - tmp = (xmlSchemaAttributeLinkPtr) - xmlMalloc(sizeof(xmlSchemaAttributeLink)); - if (tmp == NULL) { - xmlSchemaPErrMemory(ctxt, "building attribute uses", NULL); - return (-1); - } - tmp->attr = cur; - tmp->next = NULL; - if (*uses == NULL) - *uses = tmp; - else - (*lastUse)->next = tmp; - *lastUse = tmp; - if (cur->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) - (*hasProhibitions)++; - } - cur = cur->next; - } - return (0); -} - /** * xmlSchemaCloneWildcardNsConstraints: * @ctxt: the schema parser context @@ -12459,14 +13330,14 @@ xmlSchemaBuildAttributeUsesOwned(xmlSchemaParserCtxtPtr ctxt, */ static int xmlSchemaCloneWildcardNsConstraints(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaWildcardPtr *dest, + xmlSchemaWildcardPtr dest, xmlSchemaWildcardPtr source) { xmlSchemaWildcardNsPtr cur, tmp, last; - if ((source == NULL) || (*dest == NULL)) + if ((source == NULL) || (dest == NULL)) return(-1); - (*dest)->any = source->any; + dest->any = source->any; cur = source->nsSet; last = NULL; while (cur != NULL) { @@ -12475,21 +13346,21 @@ xmlSchemaCloneWildcardNsConstraints(xmlSchemaParserCtxtPtr ctxt, return(-1); tmp->value = cur->value; if (last == NULL) - (*dest)->nsSet = tmp; + dest->nsSet = tmp; else last->next = tmp; last = tmp; cur = cur->next; } - if ((*dest)->negNsSet != NULL) - xmlSchemaFreeWildcardNsSet((*dest)->negNsSet); + if (dest->negNsSet != NULL) + xmlSchemaFreeWildcardNsSet(dest->negNsSet); if (source->negNsSet != NULL) { - (*dest)->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); - if ((*dest)->negNsSet == NULL) + dest->negNsSet = xmlSchemaNewWildcardNsConstraint(ctxt); + if (dest->negNsSet == NULL) return(-1); - (*dest)->negNsSet->value = source->negNsSet->value; + dest->negNsSet->value = source->negNsSet->value; } else - (*dest)->negNsSet = NULL; + dest->negNsSet = NULL; return(0); } @@ -12813,7 +13684,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, * 2 If either O1 or O2 is any, then the other must be the value. */ if ((completeWild->any != curWild->any) && (completeWild->any)) { - if (xmlSchemaCloneWildcardNsConstraints(ctxt, &completeWild, curWild) == -1) + if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) return(-1); return(0); } @@ -12829,7 +13700,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, if (completeWild->nsSet == NULL) { neg = completeWild->negNsSet->value; - if (xmlSchemaCloneWildcardNsConstraints(ctxt, &completeWild, curWild) == -1) + if (xmlSchemaCloneWildcardNsConstraints(ctxt, completeWild, curWild) == -1) return(-1); } else neg = curWild->negNsSet->value; @@ -13005,85 +13876,8 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, return (1); } -/** - * xmlSchemaBuildCompleteAttributeWildcard: - * @ctxt: the schema parser context - * @attrs: the attribute list - * @completeWild: the resulting complete wildcard - * - * Returns -1 in case of an internal error, 0 otherwise. - */ static int -xmlSchemaBuildCompleteAttributeWildcard(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaAttributePtr attrs, - xmlSchemaWildcardPtr *completeWild) -{ - while (attrs != NULL) { - if (attrs->type == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { - xmlSchemaAttributeGroupPtr group; - - group = (xmlSchemaAttributeGroupPtr) attrs; - /* - * Handle attribute group references. - */ - if (group->ref != NULL) { - if (group->refItem == NULL) { - /* - * TODO: Should we raise a warning here? - */ - /* - * The referenced attribute group definition could not - * be resolved beforehand, so skip. - */ - attrs = attrs->next; - continue; - } else - group = group->refItem; - } - /* - * For every attribute group definition, an intersected wildcard - * will be created (assumed that a wildcard exists on the - * particular attr. gr. def. or on any contained attr. gr. def - * at all). - * The flag XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED ensures - * that the intersection will be performed only once. - */ - if ((group->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED) == 0) { - if (group->attributes != NULL) { - if (xmlSchemaBuildCompleteAttributeWildcard(ctxt, - group->attributes, &group->attributeWildcard) == -1) - return (-1); - } - group->flags |= XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; - } - if (group->attributeWildcard != NULL) { - if (*completeWild == NULL) { - /* - * Copy the first encountered wildcard as context, except for the annotation. - * - * Although the complete wildcard might not correspond to any - * node in the schema, we will save this context node. - */ - *completeWild = xmlSchemaAddWildcard(ctxt, ctxt->schema, - XML_SCHEMA_TYPE_ANY_ATTRIBUTE, - group->attributeWildcard->node); - if (xmlSchemaCloneWildcardNsConstraints(ctxt, - completeWild, group->attributeWildcard) == -1) - return (-1); - (*completeWild)->processContents = group->attributeWildcard->processContents; - (*completeWild)->node = group->attributeWildcard->node; - } else if (xmlSchemaIntersectWildcards(ctxt, *completeWild, group->attributeWildcard) == -1) - return (-1); - } - } - attrs = attrs->next; - } - - return (0); -} - -static int -xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributePtr item, +xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributeUsePtr attruse, int *fixed, const xmlChar **value, xmlSchemaValPtr *val) @@ -13093,21 +13887,23 @@ xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributePtr item, if (val != 0) *val = NULL; - if (item->defValue == NULL) - item = item->refDecl; - - if (item == NULL) - return (0); - - if (item->defValue != NULL) { - *value = item->defValue; - if (val != 0) - *val = item->defVal; - if (item->flags & XML_SCHEMAS_ATTR_FIXED) + if (attruse->defValue != NULL) { + *value = attruse->defValue; + if (val != NULL) + *val = attruse->defVal; + if (attruse->flags & XML_SCHEMA_ATTR_USE_FIXED) *fixed = 1; - return (1); + return(1); + } else if ((attruse->attrDecl != NULL) && + (attruse->attrDecl->defValue != NULL)) { + *value = attruse->attrDecl->defValue; + if (val != NULL) + *val = attruse->attrDecl->defVal; + if (attruse->attrDecl->flags & XML_SCHEMAS_ATTR_FIXED) + *fixed = 1; + return(1); } - return (0); + return(0); } /** * xmlSchemaCheckCVCWildcardNamespace: @@ -13117,9 +13913,8 @@ xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributePtr item, * Validation Rule: Wildcard allows Namespace Name * (cvc-wildcard-namespace) * - * - * Returns 1 if the given namespace matches the wildcard, - * 0 otherwise. + * Returns 0 if the given namespace matches the wildcard, + * 1 otherwise and -1 on API errors. */ static int xmlSchemaCheckCVCWildcardNamespace(xmlSchemaWildcardPtr wild, @@ -13129,659 +13924,527 @@ xmlSchemaCheckCVCWildcardNamespace(xmlSchemaWildcardPtr wild, return(-1); if (wild->any) - return(1); + return(0); else if (wild->nsSet != NULL) { xmlSchemaWildcardNsPtr cur; cur = wild->nsSet; while (cur != NULL) { if (xmlStrEqual(cur->value, ns)) - return(1); + return(0); cur = cur->next; } } else if ((wild->negNsSet != NULL) && (ns != NULL) && (!xmlStrEqual(wild->negNsSet->value, ns))) - return(1); + return(0); - return(0); + return(1); } -/** - * xmlSchemaBuildAttributeValidation: - * @ctxt: the schema parser context - * @type: the complex type definition - * - * - * Builds the wildcard and the attribute uses on the given complex type. - * Returns -1 if an internal error occurs, 0 otherwise. - */ -static int -xmlSchemaBuildAttributeValidation(xmlSchemaParserCtxtPtr pctxt, - xmlSchemaTypePtr type) -{ - xmlSchemaTypePtr baseType = NULL; - xmlSchemaAttributeLinkPtr cur, base, tmp, id = NULL, - prev = NULL, localUses = NULL, lastUse = NULL, lastBaseUse = NULL; - xmlSchemaAttributePtr attrs; - xmlSchemaTypePtr anyType; - xmlChar *str = NULL; - int err = 0, hasProhibitions = 0; +#define XML_SCHEMA_ACTION_DERIVE 0 +#define XML_SCHEMA_ACTION_REDEFINE 1 - anyType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); - /* - * Complex Type Definition with complex content Schema Component. - * - * Attribute uses. - * TODO: Add checks for absent referenced attribute declarations and - * simple types. - */ - if (type->attributeUses != NULL) { - PERROR_INT("xmlSchemaBuildAttributeValidation", - "attribute uses already builded"); - return (-1); - } - if (type->baseType == NULL) { - PERROR_INT("xmlSchemaBuildAttributeValidation", - "no base type"); - return (-1); - } - baseType = type->baseType; - /* - * Gather attribute uses defined by this type. - */ - attrs = type->attributes; - if (attrs != NULL) { - if (xmlSchemaBuildAttributeUsesOwned(pctxt, - WXS_IS_RESTRICTION(type) ? 1 : 0, - attrs, - &localUses, &lastUse, &hasProhibitions) == -1) { - return (-1); - } - /* - * Handle attribute wildcards. - */ - err = xmlSchemaBuildCompleteAttributeWildcard(pctxt, - attrs, &type->attributeWildcard); - /* - * NOTE: During the parse time, the wildcard is created - * on the complexType directly, if encountered in a - * or element. - */ - if (err == -1) { - PERROR_INT("xmlSchemaBuildAttributeValidation", - "failed to build an intersected attribute wildcard"); - return (-1); - } - } - - if (hasProhibitions) { - xmlSchemaAttributeLinkPtr tmpPrev = NULL; - /* - * Handle annoying pointless prohibitions. - * Note that this will be done for restrictions only, since - * prohibitions are not gathered for extensions. - */ - cur = localUses; +#define WXS_ACTION_STR(a) \ +((a) == XML_SCHEMA_ACTION_DERIVE) ? (const xmlChar *) "base" : (const xmlChar *) "redefined" -pointless_prohib_next: - while (cur != NULL) { - tmp = cur->next; - tmpPrev = cur; - while (tmp != NULL) { - if ( ((cur->attr->occurs != XML_SCHEMAS_ATTR_USE_PROHIBITED) && - (tmp->attr->occurs != XML_SCHEMAS_ATTR_USE_PROHIBITED)) || - (xmlSchemaGetAttrName(cur->attr) != - xmlSchemaGetAttrName(tmp->attr)) || - (xmlSchemaGetAttrTargetNsURI(cur->attr) != - xmlSchemaGetAttrTargetNsURI(tmp->attr))) +/* +* Schema Component Constraint: +* Derivation Valid (Restriction, Complex) +* derivation-ok-restriction (2) - (4) +* +* ATTENTION: +* In XML Schema 1.1 this will be: +* Validation Rule: +* Checking complex type subsumption (practicalSubsumption) (1, 2 and 3) +* +*/ +static int +xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, + int action, + xmlSchemaBasicItemPtr item, + xmlSchemaBasicItemPtr baseItem, + xmlSchemaItemListPtr uses, + xmlSchemaItemListPtr baseUses, + xmlSchemaWildcardPtr wild, + xmlSchemaWildcardPtr baseWild) +{ + xmlSchemaAttributeUsePtr cur = NULL, bcur; + int i, j, found; /* err = 0; */ + const xmlChar *bEffValue; + int effFixed; + + if (uses != NULL) { + for (i = 0; i < uses->nbItems; i++) { + cur = uses->items[i]; + found = 0; + if (baseUses == NULL) + goto not_found; + for (j = 0; j < baseUses->nbItems; j++) { + bcur = baseUses->items[j]; + if ((WXS_ATTRUSE_DECL_NAME(cur) == + WXS_ATTRUSE_DECL_NAME(bcur)) && + (WXS_ATTRUSE_DECL_TNS(cur) == + WXS_ATTRUSE_DECL_TNS(bcur))) { - tmpPrev = tmp; - tmp = tmp->next; - continue; - } - if (cur->attr->occurs == tmp->attr->occurs) { - xmlSchemaAttributeLinkPtr tmpFree; - /* - * Warn about duplicate prohibitions. - */ - xmlSchemaCustomWarning(ACTXT_CAST pctxt, - XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, - tmp->attr->node, NULL, - "Skipping duplicate prohibition " - "of attribute use '%s'", - xmlSchemaFormatQName(&str, - xmlSchemaGetAttrTargetNsURI(tmp->attr), - xmlSchemaGetAttrName(tmp->attr)), - NULL, NULL); - FREE_AND_NULL(str) - /* - * Remove the duplicate prohibition. - */ - tmpFree = tmp; - tmpPrev->next = tmp->next; - tmp = tmp->next; - xmlFree(tmpFree); - hasProhibitions--; - continue; - } else { - xmlSchemaAttributeLinkPtr tmpFree; - xmlSchemaAttributePtr reattr; - /* - * Annoying case: - * This is the case when we prohibited - * the base attribute decl in the previous - * step; i.e. when we prohibit and declare the - * same attribute in the same . - */ - if (cur->attr->occurs == - XML_SCHEMAS_ATTR_USE_PROHIBITED) - reattr = cur->attr; - else - reattr = tmp->attr; - xmlSchemaCustomWarning(ACTXT_CAST pctxt, - XML_SCHEMAP_WARN_ATTR_REDECL_PROH, - reattr->node, NULL, - "Skipping pointless prohibition of " - "attribute use '%s', since a corresponding " - "attribute was explicitely declared as well", - xmlSchemaFormatQName(&str, - xmlSchemaGetAttrTargetNsURI(reattr), - xmlSchemaGetAttrName(reattr)), - NULL, NULL); - FREE_AND_NULL(str); /* - * Remove the prohibition. + * (2.1) "If there is an attribute use in the {attribute + * uses} of the {base type definition} (call this B) whose + * {attribute declaration} has the same {name} and {target + * namespace}, then all of the following must be true:" */ - if (reattr == cur->attr) { - tmpFree = cur; - if (prev != NULL) - prev->next = cur->next; - else - localUses = cur->next; - cur = cur->next; - xmlFree(tmpFree); - hasProhibitions--; - goto pointless_prohib_next; + found = 1; + + if ((cur->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && + (bcur->occurs == XML_SCHEMAS_ATTR_USE_REQUIRED)) + { + xmlChar *str = NULL; + /* + * (2.1.1) "one of the following must be true:" + * (2.1.1.1) "B's {required} is false." + * (2.1.1.2) "R's {required} is true." + */ + xmlSchemaPAttrUseErr4(pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, + WXS_ITEM_NODE(item), item, cur, + "The 'optional' attribute use is inconsistent " + "with the corresponding 'required' attribute use of " + "the %s %s", + WXS_ACTION_STR(action), + xmlSchemaGetComponentDesignation(&str, baseItem), + NULL, NULL); + FREE_AND_NULL(str); + /* err = pctxt->err; */ + } else if (xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST pctxt, + WXS_ATTRUSE_TYPEDEF(cur), + WXS_ATTRUSE_TYPEDEF(bcur), 0) != 0) + { + xmlChar *strA = NULL, *strB = NULL, *strC = NULL; + + /* + * SPEC (2.1.2) "R's {attribute declaration}'s + * {type definition} must be validly derived from + * B's {type definition} given the empty set as + * defined in Type Derivation OK (Simple) (§3.14.6)." + */ + xmlSchemaPAttrUseErr4(pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, + WXS_ITEM_NODE(item), item, cur, + "The attribute declaration's %s " + "is not validly derived from " + "the corresponding %s of the " + "attribute declaration in the %s %s", + xmlSchemaGetComponentDesignation(&strA, + WXS_ATTRUSE_TYPEDEF(cur)), + xmlSchemaGetComponentDesignation(&strB, + WXS_ATTRUSE_TYPEDEF(bcur)), + WXS_ACTION_STR(action), + xmlSchemaGetComponentDesignation(&strC, baseItem)); + /* xmlSchemaGetComponentDesignation(&str, baseItem), */ + FREE_AND_NULL(strA); + FREE_AND_NULL(strB); + FREE_AND_NULL(strC); + /* err = pctxt->err; */ } else { - tmpFree = tmp; - tmpPrev->next = tmp->next; - tmp = tmp->next; - xmlFree(tmpFree); - hasProhibitions--; - continue; + /* + * 2.1.3 [Definition:] Let the effective value + * constraint of an attribute use be its {value + * constraint}, if present, otherwise its {attribute + * declaration}'s {value constraint} . + */ + xmlSchemaGetEffectiveValueConstraint(bcur, + &effFixed, &bEffValue, NULL); + /* + * 2.1.3 ... one of the following must be true + * + * 2.1.3.1 B's ·effective value constraint· is + * ·absent· or default. + */ + if ((bEffValue != NULL) && + (effFixed == 1)) { + const xmlChar *rEffValue = NULL; + + xmlSchemaGetEffectiveValueConstraint(bcur, + &effFixed, &rEffValue, NULL); + /* + * 2.1.3.2 R's ·effective value constraint· is + * fixed with the same string as B's. + * MAYBE TODO: Compare the computed values. + * Hmm, it says "same string" so + * string-equality might really be sufficient. + */ + if ((effFixed == 0) || + (! WXS_ARE_DEFAULT_STR_EQUAL(rEffValue, bEffValue))) + { + xmlChar *str = NULL; + + xmlSchemaPAttrUseErr4(pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, + WXS_ITEM_NODE(item), item, cur, + "The effective value constraint of the " + "attribute use is inconsistent with " + "its correspondent in the %s %s", + WXS_ACTION_STR(action), + xmlSchemaGetComponentDesignation(&str, + baseItem), + NULL, NULL); + FREE_AND_NULL(str); + /* err = pctxt->err; */ + } + } } + break; + } + } +not_found: + if (!found) { + /* + * (2.2) "otherwise the {base type definition} must have an + * {attribute wildcard} and the {target namespace} of the + * R's {attribute declaration} must be ·valid· with respect + * to that wildcard, as defined in Wildcard allows Namespace + * Name (§3.10.4)." + */ + if ((baseWild == NULL) || + (xmlSchemaCheckCVCWildcardNamespace(baseWild, + (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0)) + { + xmlChar *str = NULL; + + xmlSchemaPAttrUseErr4(pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, + WXS_ITEM_NODE(item), item, cur, + "Neither a matching attribute use, " + "nor a matching wildcard exists in the %s %s", + WXS_ACTION_STR(action), + xmlSchemaGetComponentDesignation(&str, baseItem), + NULL, NULL); + FREE_AND_NULL(str); + /* err = pctxt->err; */ } - tmpPrev = tmp; - tmp = tmp->next; } - prev = cur; - cur = cur->next; } } - - /* 3.4.6 -> Complex Type Definition Properties Correct 4. - * "Two distinct attribute declarations in the {attribute uses} must - * not have identical {name}s and {target namespace}s." - * - * This is done here for s. We will compare only the - * attr uses of the current type. - * For s this is done further down. + /* + * SPEC derivation-ok-restriction (3): + * (3) "For each attribute use in the {attribute uses} of the {base type + * definition} whose {required} is true, there must be an attribute + * use with an {attribute declaration} with the same {name} and + * {target namespace} as its {attribute declaration} in the {attribute + * uses} of the complex type definition itself whose {required} is true. */ - if ((localUses != NULL) && (localUses->next != NULL) && - (WXS_IS_RESTRICTION(type))) { - cur = localUses; - while (cur != NULL) { - if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - cur = cur->next; + if (baseUses != NULL) { + for (j = 0; j < baseUses->nbItems; j++) { + bcur = baseUses->items[j]; + if (bcur->occurs != XML_SCHEMAS_ATTR_USE_REQUIRED) continue; - } - tmp = cur->next; - while (tmp != NULL) { - if (tmp->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - tmp = tmp->next; - continue; - } - if ((xmlStrEqual(xmlSchemaGetAttrName(cur->attr), - xmlSchemaGetAttrName(tmp->attr))) && - (xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr), - xmlSchemaGetAttrTargetNsURI(tmp->attr)))) { - /* - * Duplicate attr uses. - */ - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_CT_PROPS_CORRECT_4, - type, cur->attr, - "Duplicate attribute use '%s' specified", - xmlSchemaFormatQName(&str, - xmlSchemaGetAttrTargetNsURI(tmp->attr), - xmlSchemaGetAttrName(tmp->attr))); - FREE_AND_NULL(str) - break; + found = 0; + if (uses != NULL) { + for (i = 0; i < uses->nbItems; i++) { + cur = uses->items[i]; + if ((WXS_ATTRUSE_DECL_NAME(cur) == + WXS_ATTRUSE_DECL_NAME(bcur)) && + (WXS_ATTRUSE_DECL_TNS(cur) == + WXS_ATTRUSE_DECL_TNS(bcur))) { + found = 1; + break; + } } - tmp = tmp->next; } - cur = cur->next; + if (!found) { + xmlChar *strA = NULL, *strB = NULL; + + xmlSchemaCustomErr4(ACTXT_CAST pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, + NULL, item, + "A matching attribute use for the " + "'required' %s of the %s %s is missing", + xmlSchemaGetComponentDesignation(&strA, bcur), + WXS_ACTION_STR(action), + xmlSchemaGetComponentDesignation(&strB, baseItem), + NULL); + FREE_AND_NULL(strA); + FREE_AND_NULL(strB); + } } } - /* - * Inherit the attribute uses of the base type, but leave out - * prohibited ones. - * NOTE: It is allowed to "extend" the anyType complex type. - */ - if (baseType->attributeUses != NULL) { - base = baseType->attributeUses; -inherit_start: - while (base != NULL) { - /* - * Check if prohibited. - */ - if (hasProhibitions) { - cur = localUses; - while (cur != NULL) { - if ((cur->attr->occurs == - XML_SCHEMAS_ATTR_USE_PROHIBITED) && - xmlStrEqual(xmlSchemaGetAttrName(cur->attr), - xmlSchemaGetAttrName(base->attr)) && - xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr), - xmlSchemaGetAttrTargetNsURI(base->attr))) - { - /* - * Don't inherit prohibited attr uses. - */ - if (base->attr->occurs == - XML_SCHEMAS_ATTR_USE_REQUIRED) { - /* - * derivation-ok-restriction 3 - * There won't be an attr use left if - * prohibiting the inherited one, so this - * will automatically violate required - * attr uses. - */ - xmlSchemaPCustomErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, - NULL, type, NULL, - "A matching attribute use for the " - "'required' attribute use '%s' of the " - "base type is missing", - xmlSchemaFormatQName(&str, - xmlSchemaGetAttrTargetNsURI(base->attr), - xmlSchemaGetAttrName(base->attr))); - FREE_AND_NULL(str) - } - base = base->next; - goto inherit_start; - } - cur = cur->next; - } - } - tmp = (xmlSchemaAttributeLinkPtr) - xmlMalloc(sizeof(xmlSchemaAttributeLink)); - if (tmp == NULL) { - xmlSchemaPErrMemory(pctxt, - "allocating attribute uses", NULL); - return (-1); - } - tmp->attr = base->attr; - tmp->next = NULL; - if (type->attributeUses == NULL) { - type->attributeUses = tmp; - } else - lastBaseUse->next = tmp; - lastBaseUse = tmp; - /* next */ - base = base->next; - } - } + * derivation-ok-restriction (4) + */ + if (wild != NULL) { + /* + * (4) "If there is an {attribute wildcard}, all of the + * following must be true:" + */ + if (baseWild == NULL) { + xmlChar *str = NULL; - if ((WXS_IS_EXTENSION(type)) && - ((IS_ANYTYPE(baseType)) || - ((baseType != NULL) && - (baseType->type == XML_SCHEMA_TYPE_COMPLEX) && - (baseType->attributeWildcard != NULL)))) { - if (type->attributeWildcard != NULL) { /* - * Union the complete wildcard with the base wildcard. - */ - if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, - baseType->attributeWildcard) == -1) - return (-1); - } else { + * (4.1) "The {base type definition} must also have one." + */ + xmlSchemaCustomErr4(ACTXT_CAST pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, + NULL, item, + "The %s has an attribute wildcard, " + "but the %s %s '%s' does not have one", + WXS_ITEM_TYPE_NAME(item), + WXS_ACTION_STR(action), + WXS_ITEM_TYPE_NAME(baseItem), + xmlSchemaGetComponentQName(&str, baseItem)); + FREE_AND_NULL(str); + return(pctxt->err); + } else if ((baseWild->any == 0) && + xmlSchemaCheckCOSNSSubset(wild, baseWild)) + { + xmlChar *str = NULL; /* - * Just inherit the wildcard. + * (4.2) "The complex type definition's {attribute wildcard}'s + * {namespace constraint} must be a subset of the {base type + * definition}'s {attribute wildcard}'s {namespace constraint}, + * as defined by Wildcard Subset (§3.10.6)." */ - /* - * NOTE: This is the only case where an attribute - * wildcard is shared. - */ - type->attributeWildcard = baseType->attributeWildcard; + xmlSchemaCustomErr4(ACTXT_CAST pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, + NULL, item, + "The attribute wildcard is not a valid " + "subset of the wildcard in the %s %s '%s'", + WXS_ACTION_STR(action), + WXS_ITEM_TYPE_NAME(baseItem), + xmlSchemaGetComponentQName(&str, baseItem), + NULL); + FREE_AND_NULL(str); + return(pctxt->err); + } + /* 4.3 Unless the {base type definition} is the ·ur-type + * definition·, the complex type definition's {attribute + * wildcard}'s {process contents} must be identical to or + * stronger than the {base type definition}'s {attribute + * wildcard}'s {process contents}, where strict is stronger + * than lax is stronger than skip. + */ + if ((! WXS_IS_ANYTYPE(baseItem)) && + (wild->processContents < baseWild->processContents)) { + xmlChar *str = NULL; + xmlSchemaCustomErr4(ACTXT_CAST pctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, + NULL, baseItem, + "The {process contents} of the attribute wildcard is " + "weaker than the one in the %s %s '%s'", + WXS_ACTION_STR(action), + WXS_ITEM_TYPE_NAME(baseItem), + xmlSchemaGetComponentQName(&str, baseItem), + NULL); + FREE_AND_NULL(str) + return(pctxt->err); } } + return(0); +} - if (WXS_IS_RESTRICTION(type)) { - if (type->attributeWildcard != NULL) { + +static int +xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaBasicItemPtr item, + xmlSchemaWildcardPtr *completeWild, + xmlSchemaItemListPtr list, + xmlSchemaItemListPtr prohibs); +/** + * xmlSchemaFixupTypeAttributeUses: + * @ctxt: the schema parser context + * @type: the complex type definition + * + * + * Builds the wildcard and the attribute uses on the given complex type. + * Returns -1 if an internal error occurs, 0 otherwise. + * + * ATTENTION TODO: Experimantally this uses pointer comparisons for + * strings, so recheck this if we start to hardcode some schemata, since + * they might not be in the same dict. + * NOTE: It is allowed to "extend" the xs:anyType type. + */ +static int +xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaTypePtr type) +{ + xmlSchemaTypePtr baseType = NULL; + xmlSchemaAttributeUsePtr use; + xmlSchemaItemListPtr uses, baseUses, prohibs = NULL; + + if (type->baseType == NULL) { + PERROR_INT("xmlSchemaFixupTypeAttributeUses", + "no base type"); + return (-1); + } + baseType = type->baseType; + if (WXS_IS_TYPE_NOT_FIXED(baseType)) + if (xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt) == -1) + return(-1); + + uses = type->attrUses; + baseUses = baseType->attrUses; + /* + * Expand attribute group references. And build the 'complete' + * wildcard, i.e. intersect multiple wildcards. + * Move attribute prohibitions into a separate list. + */ + if (uses != NULL) { + if (WXS_IS_RESTRICTION(type)) { /* - * Derivation Valid (Restriction, Complex) - * 4.1 The {base type definition} must also have one. + * This one will transfer all attr. prohibitions + * into pctxt->attrProhibs. */ - if (baseType->attributeWildcard == NULL) { - xmlSchemaPCustomErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, - NULL, type, NULL, - "The type has an attribute wildcard, " - "but the base type %s does not have one", - xmlSchemaFormatItemForReport(&str, NULL, baseType, NULL)); - FREE_AND_NULL(str) - return (1); - } else if (xmlSchemaCheckCOSNSSubset( - type->attributeWildcard, baseType->attributeWildcard)) { - /* 4.2 */ - xmlSchemaPCustomErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, - NULL, type, NULL, - "The attribute wildcard is not a valid " - "subset of the wildcard in the base type %s", - xmlSchemaFormatItemForReport(&str, NULL, baseType, NULL)); - FREE_AND_NULL(str) - return (1); - } - /* 4.3 Unless the {base type definition} is the ·ur-type - * definition·, the complex type definition's {attribute - * wildcard}'s {process contents} must be identical to or - * stronger than the {base type definition}'s {attribute - * wildcard}'s {process contents}, where strict is stronger - * than lax is stronger than skip. - */ - if ((! IS_ANYTYPE(baseType)) && - (type->attributeWildcard->processContents < - baseType->attributeWildcard->processContents)) { - xmlSchemaPCustomErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, - NULL, type, NULL, - "The 'process contents' of the attribute wildcard is " - "weaker than the one in the base type %s", - xmlSchemaFormatItemForReport(&str, NULL, baseType, NULL)); - FREE_AND_NULL(str) - return (1); + if (xmlSchemaExpandAttributeGroupRefs(pctxt, + WXS_BASIC_CAST type, &(type->attributeWildcard), uses, + pctxt->attrProhibs) == -1) + { + PERROR_INT("xmlSchemaFixupTypeAttributeUses", + "failed to expand attributes"); } - } - } else if (WXS_IS_EXTENSION(type)) { - /* - * Derivation Valid (Extension) - * At this point the type and the base have both, either - * no wildcard or a wildcard. - */ - if ((baseType->attributeWildcard != NULL) && - (baseType->attributeWildcard != type->attributeWildcard)) { - /* 1.3 */ - if (xmlSchemaCheckCOSNSSubset( - baseType->attributeWildcard, type->attributeWildcard)) { - xmlSchemaPCustomErr(pctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_3, - NULL, type, NULL, - "The attribute wildcard is not a valid " - "superset of the one in the base type %s", - xmlSchemaFormatItemForReport(&str, NULL, baseType, NULL)); - FREE_AND_NULL(str) - return (1); + if (pctxt->attrProhibs->nbItems != 0) + prohibs = pctxt->attrProhibs; + } else { + if (xmlSchemaExpandAttributeGroupRefs(pctxt, + WXS_BASIC_CAST type, &(type->attributeWildcard), uses, + NULL) == -1) + { + PERROR_INT("xmlSchemaFixupTypeAttributeUses", + "failed to expand attributes"); } } } - - if (localUses == NULL) { - /* PASS */ - } else if (WXS_IS_RESTRICTION(type)) { - /* - * Derive by restriction. At this point prohibited uses are already - * filtered out. - */ - if (IS_ANYTYPE(baseType)) { - type->attributeUses = localUses; - } else { - int found, valid; - const xmlChar *bEffValue; - int effFixed; + /* + * Inherit the attribute uses of the base type. + */ + if (baseUses != NULL) { + int i, j; + xmlSchemaAttributeUseProhibPtr pro; - cur = localUses; - while (cur != NULL) { - if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - prev = cur; - cur = cur->next; - continue; - } - found = 0; - valid = 1; - base = type->attributeUses; - while (base != NULL) { - if (xmlStrEqual(xmlSchemaGetAttrName(cur->attr), - xmlSchemaGetAttrName(base->attr)) && - xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr), - xmlSchemaGetAttrTargetNsURI(base->attr))) { + if (WXS_IS_RESTRICTION(type)) { + int usesCount; + xmlSchemaAttributeUsePtr tmp; - found = 1; - - if ((cur->attr->occurs == - XML_SCHEMAS_ATTR_USE_OPTIONAL) && - (base->attr->occurs == - XML_SCHEMAS_ATTR_USE_REQUIRED)) { - /* - * derivation-ok-restriction 2.1.1 - */ - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, - type, cur->attr, - "The 'optional' use is inconsistent with a " - "matching 'required' use of the base type", - NULL); - } else if (xmlSchemaCheckCOSSTDerivedOK( - cur->attr->subtypes, base->attr->subtypes, 0) != 0) { - - /* - * SPEC (2.1.2) "R's {attribute declaration}'s - * {type definition} must be validly derived from - * B's {type definition} given the empty set as - * defined in Type Derivation OK (Simple) (§3.14.6)." - */ - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, - type, cur->attr, - "The attribute declaration's type " - "definition is not validly derived from " - "the corresponding definition in the " - "base type", NULL); - } else { - /* - * 2.1.3 [Definition:] Let the effective value - * constraint of an attribute use be its {value - * constraint}, if present, otherwise its {attribute - * declaration}'s {value constraint} . - */ - xmlSchemaGetEffectiveValueConstraint(base->attr, - &effFixed, &bEffValue, NULL); - /* - * 2.1.3 ... one of the following must be true - * - * 2.1.3.1 B's ·effective value constraint· is - * ·absent· or default. - */ - if ((bEffValue != NULL) && - (effFixed == 1)) { - const xmlChar *rEffValue = NULL; - - xmlSchemaGetEffectiveValueConstraint(base->attr, - &effFixed, &rEffValue, NULL); - /* - * 2.1.3.2 R's ·effective value constraint· is - * fixed with the same string as B's. - * TODO: Compare the computed values. - */ - if ((effFixed == 0) || - (! xmlStrEqual(rEffValue, bEffValue))) { - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, - type, cur->attr, - "The effective value constraint of the " - "attribute use is inconsistent with " - "its correspondent of the base type", - NULL); - } else { - /* - * Override the attribute use. - */ - base->attr = cur->attr; - } - } else - base->attr = cur->attr; - } + if (uses != NULL) + usesCount = uses->nbItems; + else + usesCount = 0; - break; + /* Restriction. */ + for (i = 0; i < baseUses->nbItems; i++) { + use = baseUses->items[i]; + if (prohibs) { + /* + * Filter out prohibited uses. + */ + for (j = 0; j < prohibs->nbItems; j++) { + pro = prohibs->items[j]; + if ((WXS_ATTRUSE_DECL_NAME(use) == pro->name) && + (WXS_ATTRUSE_DECL_TNS(use) == + pro->targetNamespace)) + { + goto inherit_next; + } } - base = base->next; } - - if (!found) { + if (usesCount) { /* - * derivation-ok-restriction 2.2 + * Filter out existing uses. */ - if ((baseType->attributeWildcard == NULL) || - (xmlSchemaCheckCVCWildcardNamespace( - baseType->attributeWildcard, - cur->attr->targetNamespace) != 1)) { - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, - type, cur->attr, - "Neither a matching attribute use, " - "nor a matching wildcard in the base type does exist", - NULL); - } else { - /* - * Add the attribute use. - * - * Note that this may lead to funny derivation error reports, if - * multiple equal attribute uses exist; but this is not - * allowed anyway, and it will be reported beforehand. - */ - tmp = cur; - if (prev != NULL) - prev->next = cur->next; - else - localUses = cur->next; - cur = cur->next; - tmp->next = NULL; - if (type->attributeUses == NULL) { - type->attributeUses = tmp; - } else - lastBaseUse->next = tmp; - lastBaseUse = tmp; - - continue; + for (j = 0; j < usesCount; j++) { + tmp = uses->items[j]; + if ((WXS_ATTRUSE_DECL_NAME(use) == + WXS_ATTRUSE_DECL_NAME(tmp)) && + (WXS_ATTRUSE_DECL_TNS(use) == + WXS_ATTRUSE_DECL_TNS(tmp))) + { + goto inherit_next; + } } } - prev = cur; - cur = cur->next; + if (uses == NULL) { + type->attrUses = xmlSchemaItemListCreate(); + if (type->attrUses == NULL) + goto exit_failure; + uses = type->attrUses; + } + xmlSchemaItemListAddSize(uses, 2, use); +inherit_next: {} + } + } else { + /* Extension. */ + for (i = 0; i < baseUses->nbItems; i++) { + use = baseUses->items[i]; + if (uses == NULL) { + type->attrUses = xmlSchemaItemListCreate(); + if (type->attrUses == NULL) + goto exit_failure; + uses = type->attrUses; + } + xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); } - if (localUses != NULL) - xmlSchemaFreeAttributeUseList(localUses); - } - } else if (WXS_IS_EXTENSION(type)) { - /* - * The spec allows only appending, and not other kinds of extensions. - * - * This ensures: Schema Component Constraint: Derivation Valid (Extension) : 1.2 - */ - if (localUses != NULL) { - if (type->attributeUses == NULL) { - type->attributeUses = localUses; - } else - lastBaseUse->next = localUses; } - } else { - PERROR_INT("xmlSchemaBuildAttributeValidation", - "no derivation method"); - return (-1); } /* - * 3.4.6 -> Complex Type Definition Properties Correct - */ - if (type->attributeUses != NULL) { - cur = type->attributeUses; - prev = NULL; - while (cur != NULL) { - if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - /* - * Remove "prohibited" attribute uses. The reason this is - * done at this late stage is to be able to catch - * dublicate attribute uses. So we had to keep prohibited - * uses in the list as well. - */ - tmp = cur; - if (prev == NULL) - type->attributeUses = cur->next; - else - prev->next = cur->next; - cur = cur->next; - xmlFree(tmp); - continue; - } + * Shrink attr. uses. + */ + if (uses) { + if (uses->nbItems == 0) { + xmlSchemaItemListFree(uses); + type->attrUses = NULL; + } + /* + * TODO: We could shrink the size of the array + * to fit the actual number of items. + */ + } + /* + * Compute the complete wildcard. + */ + if (WXS_IS_EXTENSION(type)) { + if (baseType->attributeWildcard != NULL) { /* - * 4. Two distinct attribute declarations in the {attribute uses} must - * not have identical {name}s and {target namespace}s. - * - * Note that this was already done for "restriction" and types derived from - * the ur-type. + * (3.2.2.1) "If the ·base wildcard· is non-·absent·, then + * the appropriate case among the following:" */ - if (WXS_IS_EXTENSION(type)) { - tmp = cur->next; - while (tmp != NULL) { - if ((xmlStrEqual(xmlSchemaGetAttrName(cur->attr), - xmlSchemaGetAttrName(tmp->attr))) && - (xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr ), - xmlSchemaGetAttrTargetNsURI(tmp->attr)))) { - - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_CT_PROPS_CORRECT_4, - type, tmp->attr, - "Duplicate attribute use specified", NULL); - break; - } - tmp = tmp->next; - } - } - + if (type->attributeWildcard != NULL) { + /* + * Union the complete wildcard with the base wildcard. + * SPEC {attribute wildcard} + * (3.2.2.1.2) "otherwise a wildcard whose {process contents} + * and {annotation} are those of the ·complete wildcard·, + * and whose {namespace constraint} is the intensional union + * of the {namespace constraint} of the ·complete wildcard· + * and of the ·base wildcard·, as defined in Attribute + * Wildcard Union (§3.10.6)." + */ + if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, + baseType->attributeWildcard) == -1) + goto exit_failure; + } else { + /* + * (3.2.2.1.1) "If the ·complete wildcard· is ·absent·, + * then the ·base wildcard·." + */ + type->attributeWildcard = baseType->attributeWildcard; + } + } else { /* - * 5. Two distinct attribute declarations in the - * {attribute uses} must not have {type definition}s which - * are or are derived from ID. + * (3.2.2.2) "otherwise (the ·base wildcard· is ·absent·) the + * ·complete wildcard" + * NOOP */ - if ((cur->attr->subtypes != NULL) && - (xmlSchemaIsDerivedFromBuiltInType(cur->attr->subtypes, - XML_SCHEMAS_ID))) { - if (id != NULL) { - xmlSchemaPAttrUseErr(pctxt, - XML_SCHEMAP_CT_PROPS_CORRECT_5, - type, cur->attr, - "There must not exist more than one attribute " - "use, declared of type 'ID' or derived from it", - NULL); - FREE_AND_NULL(str) - } - id = cur; - } - prev = cur; - cur = cur->next; } + } else { + /* + * SPEC {attribute wildcard} + * (3.1) "If the alternative is chosen, then the + * ·complete wildcard·;" + * NOOP + */ } - /* - * TODO: This check should be removed if we are 100% sure of - * the base type attribute uses already being built. - */ - if ((baseType != NULL) && (! IS_ANYTYPE(baseType)) && - (baseType->type == XML_SCHEMA_TYPE_COMPLEX) && - (IS_NOT_TYPEFIXED(baseType))) { - PERROR_INT("xmlSchemaBuildAttributeValidation", - "attribute uses not builded on base type"); - } + return (0); + +exit_failure: + return(-1); } /** @@ -13963,7 +14626,7 @@ xmlSchemaIsParticleEmptiable(xmlSchemaParticlePtr particle) * SPEC (2) "Its {term} is a group and the minimum part of the * effective total range of that group, [...] is 0." */ - if (IS_MODEL_GROUP(particle->children)) { + if (WXS_IS_MODEL_GROUP(particle->children)) { if (xmlSchemaGetParticleTotalRangeMin(particle) == 0) return (1); } @@ -13972,8 +14635,10 @@ xmlSchemaIsParticleEmptiable(xmlSchemaParticlePtr particle) /** * xmlSchemaCheckCOSSTDerivedOK: + * @actxt: a context * @type: the derived simple type definition * @baseType: the base type definition + * @subset: the subset of ('restriction', ect.) * * Schema Component Constraint: * Type Derivation OK (Simple) (cos-st-derived-OK) @@ -13984,7 +14649,8 @@ xmlSchemaIsParticleEmptiable(xmlSchemaParticlePtr particle) * Returns 0 on success, an positive error code otherwise. */ static int -xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, +xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, + xmlSchemaTypePtr type, xmlSchemaTypePtr baseType, int subset) { @@ -13997,7 +14663,18 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, /* * 2.1 restriction is not in the subset, or in the {final} * of its own {base type definition}; + * + * NOTE that this will be used also via "xsi:type". + * + * TODO: Revise this, it looks strange. How can the "type" + * not be fixed or *in* fixing? */ + if (WXS_IS_TYPE_NOT_FIXED(type)) + if (xmlSchemaTypeFixup(type, actxt) == -1) + return(-1); + if (WXS_IS_TYPE_NOT_FIXED(baseType)) + if (xmlSchemaTypeFixup(baseType, actxt) == -1) + return(-1); if ((subset & SUBSET_RESTRICTION) || (xmlSchemaTypeFinalContains(type->baseType, XML_SCHEMAS_TYPE_FINAL_RESTRICTION))) { @@ -14015,8 +14692,8 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, * and is validly derived from B given the subset, as defined by this * constraint. */ - if ((! IS_ANYTYPE(type->baseType)) && - (xmlSchemaCheckCOSSTDerivedOK(type->baseType, + if ((! WXS_IS_ANYTYPE(type->baseType)) && + (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, baseType, subset) == 0)) { return (0); } @@ -14024,8 +14701,8 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, * 2.2.3 D's {variety} is list or union and B is the ·simple ur-type * definition·. */ - if (IS_ANY_SIMPLE_TYPE(baseType) && - (VARIETY_LIST(type) || VARIETY_UNION(type))) { + if (WXS_IS_ANY_SIMPLE_TYPE(baseType) && + (WXS_IS_LIST(type) || WXS_IS_UNION(type))) { return (0); } /* @@ -14036,17 +14713,26 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaTypePtr type, * NOTE: This seems not to involve built-in types, since there is no * built-in Union Simple Type. */ - if (VARIETY_UNION(baseType)) { + if (WXS_IS_UNION(baseType)) { xmlSchemaTypeLinkPtr cur; cur = baseType->memberTypes; while (cur != NULL) { - if (xmlSchemaCheckCOSSTDerivedOK(type, cur->type, subset) == 0) + if (WXS_IS_TYPE_NOT_FIXED(cur->type)) + if (xmlSchemaTypeFixup(cur->type, actxt) == -1) + return(-1); + if (xmlSchemaCheckCOSSTDerivedOK(actxt, + type, cur->type, subset) == 0) + { + /* + * It just has to be validly derived from at least one + * member-type. + */ return (0); + } cur = cur->next; } } - return (XML_SCHEMAP_COS_ST_DERIVED_OK_2_2); } @@ -14075,7 +14761,7 @@ xmlSchemaCheckTypeDefCircularInternal(xmlSchemaParserCtxtPtr pctxt, if (ctxtType == ancestor) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_ST_PROPS_CORRECT_2, - NULL, ctxtType, GET_NODE(ctxtType), + WXS_BASIC_CAST ctxtType, WXS_ITEM_NODE(ctxtType), "The definition is circular", NULL); return (XML_SCHEMAP_ST_PROPS_CORRECT_2); } @@ -14105,17 +14791,11 @@ xmlSchemaCheckTypeDefCircular(xmlSchemaTypePtr item, xmlSchemaParserCtxtPtr ctxt) { if ((item == NULL) || - ((item->type != XML_SCHEMA_TYPE_COMPLEX) && - (item->type != XML_SCHEMA_TYPE_SIMPLE))) + (item->type == XML_SCHEMA_TYPE_BASIC) || + (item->baseType == NULL)) return; - if (item->redef != NULL) { - xmlSchemaTypePtr cur = item; - do { - xmlSchemaCheckTypeDefCircularInternal(ctxt, cur, cur->baseType); - cur = cur->redef; - } while (cur != NULL); - } else - xmlSchemaCheckTypeDefCircularInternal(ctxt, item, item->baseType); + xmlSchemaCheckTypeDefCircularInternal(ctxt, item, + item->baseType); } /* @@ -14147,11 +14827,11 @@ xmlSchemaCheckUnionTypeDefCircularRecur(xmlSchemaParserCtxtPtr pctxt, if (memberType == ctxType) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_SIMPLE_TYPE_4, - NULL, ctxType, NULL, + WXS_BASIC_CAST ctxType, NULL, "The union type definition is circular", NULL); return (XML_SCHEMAP_SRC_SIMPLE_TYPE_4); } - if ((VARIETY_UNION(memberType)) && + if ((WXS_IS_UNION(memberType)) && ((memberType->flags & XML_SCHEMAS_TYPE_MARKED) == 0)) { int res; @@ -14174,7 +14854,7 @@ static int xmlSchemaCheckUnionTypeDefCircular(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr type) { - if (! VARIETY_UNION(type)) + if (! WXS_IS_UNION(type)) return(0); return(xmlSchemaCheckUnionTypeDefCircularRecur(pctxt, type, type->memberTypes)); @@ -14190,8 +14870,7 @@ xmlSchemaCheckUnionTypeDefCircular(xmlSchemaParserCtxtPtr pctxt, */ static void xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar * name ATTRIBUTE_UNUSED) + xmlSchemaParserCtxtPtr ctxt) { if (typeDef == NULL) return; @@ -14205,38 +14884,103 @@ xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, if (typeDef->baseType == NULL) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - typeDef, typeDef->node, + WXS_BASIC_CAST typeDef, typeDef->node, "base", typeDef->base, typeDef->baseNs, XML_SCHEMA_TYPE_SIMPLE, NULL); return; } } - if (IS_SIMPLE_TYPE(typeDef)) { - if (VARIETY_UNION(typeDef)) { + if (WXS_IS_SIMPLE(typeDef)) { + if (WXS_IS_UNION(typeDef)) { /* * Resolve the memberTypes. */ xmlSchemaResolveUnionMemberTypes(ctxt, typeDef); return; - } else if (VARIETY_LIST(typeDef)) { + } else if (WXS_IS_LIST(typeDef)) { /* * Resolve the itemType. */ - if ((typeDef->subtypes == NULL) && (typeDef->ref != NULL)) { + if ((typeDef->subtypes == NULL) && (typeDef->base != NULL)) { + typeDef->subtypes = xmlSchemaGetType(ctxt->schema, - typeDef->ref, typeDef->refNs); + typeDef->base, typeDef->baseNs); + if ((typeDef->subtypes == NULL) || - (! IS_SIMPLE_TYPE(typeDef->subtypes))) { + (! WXS_IS_SIMPLE(typeDef->subtypes))) + { typeDef->subtypes = NULL; xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - typeDef, typeDef->node, - "itemType", typeDef->ref, typeDef->refNs, + WXS_BASIC_CAST typeDef, typeDef->node, + "itemType", typeDef->base, typeDef->baseNs, XML_SCHEMA_TYPE_SIMPLE, NULL); } } return; } + } + /* + * The ball of letters below means, that if we have a particle + * which has a QName-helper component as its {term}, we want + * to resolve it... + */ + else if ((WXS_TYPE_CONTENTTYPE(typeDef) != NULL) && + ((WXS_TYPE_CONTENTTYPE(typeDef))->type == + XML_SCHEMA_TYPE_PARTICLE) && + (WXS_TYPE_PARTICLE_TERM(typeDef) != NULL) && + ((WXS_TYPE_PARTICLE_TERM(typeDef))->type == + XML_SCHEMA_EXTRA_QNAMEREF)) + { + xmlSchemaQNameRefPtr ref = + WXS_QNAME_CAST WXS_TYPE_PARTICLE_TERM(typeDef); + xmlSchemaModelGroupDefPtr groupDef; + + /* + * URGENT TODO: Test this. + */ + WXS_TYPE_PARTICLE_TERM(typeDef) = NULL; + /* + * Resolve the MG definition reference. + */ + groupDef = + WXS_MODEL_GROUPDEF_CAST xmlSchemaGetNamedComponent(ctxt->schema, + ref->itemType, ref->name, ref->targetNamespace); + if (groupDef == NULL) { + xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, + NULL, WXS_ITEM_NODE(WXS_TYPE_PARTICLE(typeDef)), + "ref", ref->name, ref->targetNamespace, ref->itemType, + NULL); + /* Remove the particle. */ + WXS_TYPE_CONTENTTYPE(typeDef) = NULL; + } else if (WXS_MODELGROUPDEF_MODEL(groupDef) == NULL) + /* Remove the particle. */ + WXS_TYPE_CONTENTTYPE(typeDef) = NULL; + else { + /* + * Assign the MG definition's {model group} to the + * particle's {term}. + */ + WXS_TYPE_PARTICLE_TERM(typeDef) = WXS_MODELGROUPDEF_MODEL(groupDef); + + if (WXS_MODELGROUPDEF_MODEL(groupDef)->type == XML_SCHEMA_TYPE_ALL) { + /* + * SPEC cos-all-limited (1.2) + * "1.2 the {term} property of a particle with + * {max occurs}=1 which is part of a pair which constitutes + * the {content type} of a complex type definition." + */ + if ((WXS_TYPE_PARTICLE(typeDef))->maxOccurs != 1) { + xmlSchemaCustomErr(ACTXT_CAST ctxt, + /* TODO: error code */ + XML_SCHEMAP_COS_ALL_LIMITED, + WXS_ITEM_NODE(WXS_TYPE_PARTICLE(typeDef)), NULL, + "The particle's {max occurs} must be 1, since the " + "reference resolves to an 'all' model group", + NULL, NULL); + } + } + } } } @@ -14278,26 +15022,26 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "No base type existent", NULL); return (XML_SCHEMAP_ST_PROPS_CORRECT_1); } - if (! IS_SIMPLE_TYPE(baseType)) { + if (! WXS_IS_SIMPLE(baseType)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The base type '%s' is not a simple type", xmlSchemaGetComponentQName(&str, baseType)); FREE_AND_NULL(str) return (XML_SCHEMAP_ST_PROPS_CORRECT_1); } - if ( (VARIETY_LIST(type) || VARIETY_UNION(type)) && + if ( (WXS_IS_LIST(type) || WXS_IS_UNION(type)) && (WXS_IS_RESTRICTION(type) == 0) && - (! IS_ANY_SIMPLE_TYPE(baseType))) { + (! WXS_IS_ANY_SIMPLE_TYPE(baseType))) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "A type, derived by list or union, must have" "the simple ur-type definition as base type, not '%s'", xmlSchemaGetComponentQName(&str, baseType)); @@ -14307,11 +15051,11 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, /* * Variety: One of {atomic, list, union}. */ - if ((! VARIETY_ATOMIC(type)) && (! VARIETY_UNION(type)) && - (! VARIETY_LIST(type))) { + if ((! WXS_IS_ATOMIC(type)) && (! WXS_IS_UNION(type)) && + (! WXS_IS_LIST(type))) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The variety is absent", NULL); return (XML_SCHEMAP_ST_PROPS_CORRECT_1); } @@ -14324,7 +15068,7 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, XML_SCHEMAS_TYPE_FINAL_RESTRICTION)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_3, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of its base type '%s' must not contain " "'restriction'", xmlSchemaGetComponentQName(&str, baseType)); @@ -14369,16 +15113,16 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, return (-1); } - if (VARIETY_ATOMIC(type)) { + if (WXS_IS_ATOMIC(type)) { xmlSchemaTypePtr primitive; /* * 1.1 The {base type definition} must be an atomic simple * type definition or a built-in primitive datatype. */ - if (! VARIETY_ATOMIC(type->baseType)) { + if (! WXS_IS_ATOMIC(type->baseType)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The base type '%s' is not an atomic simple type", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14392,7 +15136,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAS_TYPE_FINAL_RESTRICTION)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_1_2, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The final of its base type '%s' must not contain 'restriction'", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14420,7 +15164,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, ok = 0; xmlSchemaPIllegalFacetAtomicErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, - NULL, type, primitive, facet); + type, primitive, facet); } facet = facet->next; } while (facet != NULL); @@ -14436,40 +15180,40 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * NOTE (1.3.2) Facet derivation constraints are currently handled in * xmlSchemaDeriveAndValidateFacets() */ - } else if (VARIETY_LIST(type)) { + } else if (WXS_IS_LIST(type)) { xmlSchemaTypePtr itemType = NULL; itemType = type->subtypes; - if ((itemType == NULL) || (! IS_SIMPLE_TYPE(itemType))) { + if ((itemType == NULL) || (! WXS_IS_SIMPLE(itemType))) { PERROR_INT("xmlSchemaCheckCOSSTRestricts", "failed to evaluate the item type"); return (-1); } - if (IS_NOT_TYPEFIXED(itemType)) - xmlSchemaTypeFixup(itemType, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(itemType)) + xmlSchemaTypeFixup(itemType, ACTXT_CAST pctxt); /* * 2.1 The {item type definition} must have a {variety} of atomic or * union (in which case all the {member type definitions} * must be atomic). */ - if ((! VARIETY_ATOMIC(itemType)) && - (! VARIETY_UNION(itemType))) { + if ((! WXS_IS_ATOMIC(itemType)) && + (! WXS_IS_UNION(itemType))) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The item type '%s' does not have a variety of atomic or union", xmlSchemaGetComponentQName(&str, itemType)); FREE_AND_NULL(str) return (XML_SCHEMAP_COS_ST_RESTRICTS_2_1); - } else if (VARIETY_UNION(itemType)) { + } else if (WXS_IS_UNION(itemType)) { xmlSchemaTypeLinkPtr member; member = itemType->memberTypes; while (member != NULL) { - if (! VARIETY_ATOMIC(member->type)) { + if (! WXS_IS_ATOMIC(member->type)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The item type is a union type, but the " "member type '%s' of this item type is not atomic", xmlSchemaGetComponentQName(&str, member->type)); @@ -14480,7 +15224,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, } } - if (IS_ANY_SIMPLE_TYPE(type->baseType)) { + if (WXS_IS_ANY_SIMPLE_TYPE(type->baseType)) { xmlSchemaFacetPtr facet; /* * This is the case if we have: type != XML_SCHEMA_FACET_WHITESPACE) { xmlSchemaPIllegalFacetListUnionErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, - NULL, type, facet); + type, facet); return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2); } facet = facet->next; @@ -14534,10 +15278,10 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * 2.3.2 * 2.3.2.1 The {base type definition} must have a {variety} of list. */ - if (! VARIETY_LIST(type->baseType)) { + if (! WXS_IS_LIST(type->baseType)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The base type '%s' must be a list type", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14551,7 +15295,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAS_TYPE_FINAL_RESTRICTION)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of the base type '%s' must not contain 'restriction'", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14566,18 +15310,18 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr baseItemType; baseItemType = type->baseType->subtypes; - if ((baseItemType == NULL) || (! IS_SIMPLE_TYPE(baseItemType))) { + if ((baseItemType == NULL) || (! WXS_IS_SIMPLE(baseItemType))) { PERROR_INT("xmlSchemaCheckCOSSTRestricts", "failed to eval the item type of a base type"); return (-1); } if ((itemType != baseItemType) && - (xmlSchemaCheckCOSSTDerivedOK(itemType, + (xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST pctxt, itemType, baseItemType, 0) != 0)) { xmlChar *strBIT = NULL, *strBT = NULL; xmlSchemaPCustomErrExt(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The item type '%s' is not validly derived from " "the item type '%s' of the base type '%s'", xmlSchemaGetComponentQName(&str, itemType), @@ -14615,7 +15359,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, default: { xmlSchemaPIllegalFacetListUnionErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, - NULL, type, facet); + type, facet); /* * We could return, but it's nicer to report all * invalid facets. @@ -14635,7 +15379,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, */ } } - } else if (VARIETY_UNION(type)) { + } else if (WXS_IS_UNION(type)) { /* * 3.1 The {member type definitions} must all have {variety} of * atomic or list. @@ -14644,14 +15388,14 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, member = type->memberTypes; while (member != NULL) { - if (IS_NOT_TYPEFIXED(member->type)) - xmlSchemaTypeFixup(member->type, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(member->type)) + xmlSchemaTypeFixup(member->type, ACTXT_CAST pctxt); - if ((! VARIETY_ATOMIC(member->type)) && - (! VARIETY_LIST(member->type))) { + if ((! WXS_IS_ATOMIC(member->type)) && + (! WXS_IS_LIST(member->type))) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The member type '%s' is neither an atomic, nor a list type", xmlSchemaGetComponentQName(&str, member->type)); FREE_AND_NULL(str) @@ -14674,7 +15418,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAS_TYPE_FINAL_UNION)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of member type '%s' contains 'union'", xmlSchemaGetComponentQName(&str, member->type)); FREE_AND_NULL(str) @@ -14688,7 +15432,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, if (type->facetSet != NULL) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "No facets allowed", NULL); return (XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2); } @@ -14697,10 +15441,10 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * 3.3.2.1 The {base type definition} must have a {variety} of union. * I.e. the variety of "list" is inherited. */ - if (! VARIETY_UNION(type->baseType)) { + if (! WXS_IS_UNION(type->baseType)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The base type '%s' is not a union type", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14713,7 +15457,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAS_TYPE_FINAL_RESTRICTION)) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of its base type '%s' must not contain 'restriction'", xmlSchemaGetComponentQName(&str, type->baseType)); FREE_AND_NULL(str) @@ -14753,13 +15497,13 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, "different number of member types in base"); } if ((member->type != baseMember->type) && - (xmlSchemaCheckCOSSTDerivedOK( + (xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST pctxt, member->type, baseMember->type, 0) != 0)) { xmlChar *strBMT = NULL, *strBT = NULL; xmlSchemaPCustomErrExt(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The member type %s is not validly " "derived from its corresponding member " "type %s of the base type %s", @@ -14790,7 +15534,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, (facet->type != XML_SCHEMA_FACET_ENUMERATION)) { xmlSchemaPIllegalFacetListUnionErr(pctxt, XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, - NULL, type, facet); + type, facet); ok = 0; } facet = facet->next; @@ -14842,14 +15586,14 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, /* * */ - } else if (VARIETY_LIST(type)) { + } else if (WXS_IS_LIST(type)) { /* src-simple-type.3 "If the alternative is chosen, either it must have * an itemType [attribute] or a among its [children], * but not both." * * NOTE: This is checked in the parse function of . */ - } else if (VARIETY_UNION(type)) { + } else if (WXS_IS_UNION(type)) { /* * src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular(). */ @@ -14873,7 +15617,9 @@ xmlSchemaCreateVCtxtOnPCtxt(xmlSchemaParserCtxtPtr ctxt) } /* TODO: Pass user data. */ xmlSchemaSetValidErrors(ctxt->vctxt, - ctxt->error, ctxt->warning, ctxt->userData); + ctxt->error, ctxt->warning, ctxt->errCtxt); + xmlSchemaSetValidStructuredErrors(ctxt->vctxt, + ctxt->serror, ctxt->errCtxt); } return (0); } @@ -14919,7 +15665,7 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, * For a string to be a valid default with respect to a type * definition the appropriate case among the following must be true: */ - if IS_COMPLEX_TYPE(type) { + if WXS_IS_COMPLEX(type) { /* * Complex type. * @@ -14929,12 +15675,12 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, * type}'s particle must be ·emptiable· as defined by * Particle Emptiable (§3.9.6)." */ - if ((! HAS_SIMPLE_CONTENT(type)) && - ((! HAS_MIXED_CONTENT(type)) || (! IS_PARTICLE_EMPTIABLE(type)))) { + if ((! WXS_HAS_SIMPLE_CONTENT(type)) && + ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) { /* NOTE that this covers (2.2.2) as well. */ xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_COS_VALID_DEFAULT_2_1, - NULL, type, type->node, + WXS_BASIC_CAST type, type->node, "For a string to be a valid default, the type definition " "must be a simple type or a complex type with mixed content " "and a particle emptiable", NULL); @@ -14952,10 +15698,10 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, * string must be ·valid· with respect to that simple type definition * as defined by String Valid (§3.14.4). */ - if (IS_SIMPLE_TYPE(type)) + if (WXS_IS_SIMPLE(type)) ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, type, value, val, 1, 1, 0); - else if (HAS_SIMPLE_CONTENT(type)) + else if (WXS_HAS_SIMPLE_CONTENT(type)) ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, type->contentTypeDef, value, val, 1, 1, 0); else @@ -14995,17 +15741,17 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * Sub-components (§5.3)." */ if ((type->baseType != NULL) && - (IS_SIMPLE_TYPE(type->baseType)) && + (WXS_IS_SIMPLE(type->baseType)) && (WXS_IS_EXTENSION(type) == 0)) { /* * SPEC (2) "If the {base type definition} is a simple type definition, * the {derivation method} must be extension." */ - xmlSchemaPCustomErr(pctxt, + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, NULL, + NULL, WXS_BASIC_CAST type, "If the base type is a simple type, the derivation method must be " - "'extension'", NULL); + "'extension'", NULL, NULL); return (XML_SCHEMAP_SRC_CT_1); } /* @@ -15014,15 +15760,91 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * definition by repeatedly following the {base type definition}." * * NOTE (3) is done in xmlSchemaCheckTypeDefCircular(). - * - * SPEC (4) "Two distinct attribute declarations in the {attribute uses} - * must not have identical {name}s and {target namespace}s." - * SPEC (5) "Two distinct attribute declarations in the {attribute uses} - * must not have {type definition}s which are or are derived from ID." - * - * NOTE (4) and (5) are done in xmlSchemaBuildAttributeValidation(). */ + /* + * NOTE that (4) and (5) need the following: + * - attribute uses need to be already inherited (apply attr. prohibitions) + * - attribute group references need to be expanded already + * - simple types need to be typefixed already + */ + if (type->attrUses && + (((xmlSchemaItemListPtr) type->attrUses)->nbItems > 1)) + { + xmlSchemaItemListPtr uses = (xmlSchemaItemListPtr) type->attrUses; + xmlSchemaAttributeUsePtr use, tmp; + int i, j, hasId = 0; + + for (i = uses->nbItems -1; i >= 0; i--) { + use = uses->items[i]; + + /* + * SPEC ct-props-correct + * (4) "Two distinct attribute declarations in the + * {attribute uses} must not have identical {name}s and + * {target namespace}s." + */ + if (i > 0) { + for (j = i -1; j >= 0; j--) { + tmp = uses->items[j]; + if ((WXS_ATTRUSE_DECL_NAME(use) == + WXS_ATTRUSE_DECL_NAME(tmp)) && + (WXS_ATTRUSE_DECL_TNS(use) == + WXS_ATTRUSE_DECL_TNS(tmp))) + { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_AG_PROPS_CORRECT, + NULL, WXS_BASIC_CAST type, + "Duplicate %s", + xmlSchemaGetComponentDesignation(&str, use), + NULL); + FREE_AND_NULL(str); + /* + * Remove the duplicate. + */ + if (xmlSchemaItemListRemove(uses, i) == -1) + goto exit_failure; + goto next_use; + } + } + } + /* + * SPEC ct-props-correct + * (5) "Two distinct attribute declarations in the + * {attribute uses} must not have {type definition}s which + * are or are derived from ID." + */ + if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { + if (xmlSchemaIsDerivedFromBuiltInType( + WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) + { + if (hasId) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_AG_PROPS_CORRECT, + NULL, WXS_BASIC_CAST type, + "There must not exist more than one attribute " + "declaration of type 'xs:ID' " + "(or derived from 'xs:ID'). The %s violates this " + "constraint", + xmlSchemaGetComponentDesignation(&str, use), + NULL); + FREE_AND_NULL(str); + if (xmlSchemaItemListRemove(uses, i) == -1) + goto exit_failure; + } + + hasId = 1; + } + } +next_use: {} + } + } return (0); +exit_failure: + return(-1); } static int @@ -15054,7 +15876,8 @@ xmlSchemaAreEqualTypes(xmlSchemaTypePtr typeA, * if not. */ static int -xmlSchemaCheckCOSCTDerivedOK(xmlSchemaTypePtr type, +xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, + xmlSchemaTypePtr type, xmlSchemaTypePtr baseType, int set) { @@ -15089,16 +15912,16 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaTypePtr type, * SPEC (2.3.1) "D's {base type definition} must not be the ·ur-type * definition·." */ - if (IS_ANYTYPE(type->baseType)) + if (WXS_IS_ANYTYPE(type->baseType)) return (1); - if (IS_COMPLEX_TYPE(type->baseType)) { + if (WXS_IS_COMPLEX(type->baseType)) { /* * SPEC (2.3.2.1) "If D's {base type definition} is complex, then it * must be validly derived from B given the subset as defined by this * constraint." */ - return (xmlSchemaCheckCOSCTDerivedOK(type->baseType, + return (xmlSchemaCheckCOSCTDerivedOK(actxt, type->baseType, baseType, set)); } else { /* @@ -15106,7 +15929,8 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaTypePtr type, * must be validly derived from B given the subset as defined in Type * Derivation OK (Simple) (§3.14.6). */ - return (xmlSchemaCheckCOSSTDerivedOK(type->baseType, baseType, set)); + return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, + baseType, set)); } } @@ -15123,14 +15947,15 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaTypePtr type, * Returns 0 on success, an positive error code otherwise. */ static int -xmlSchemaCheckCOSDerivedOK(xmlSchemaTypePtr type, +xmlSchemaCheckCOSDerivedOK(xmlSchemaAbstractCtxtPtr actxt, + xmlSchemaTypePtr type, xmlSchemaTypePtr baseType, int set) { - if (IS_SIMPLE_TYPE(type)) - return (xmlSchemaCheckCOSSTDerivedOK(type, baseType, set)); + if (WXS_IS_SIMPLE(type)) + return (xmlSchemaCheckCOSSTDerivedOK(actxt, type, baseType, set)); else - return (xmlSchemaCheckCOSCTDerivedOK(type, baseType, set)); + return (xmlSchemaCheckCOSCTDerivedOK(actxt, type, baseType, set)); } /** @@ -15145,7 +15970,7 @@ xmlSchemaCheckCOSDerivedOK(xmlSchemaTypePtr type, * STATUS: * missing: * (1.5) - * (1.4.3.2.2.2) "Particle Valid (Extension)", which is not really needed. + * (1.4.3.2.2.2) "Particle Valid (Extension)" * * Returns 0 if the constraints are satisfied, a positive * error code if not and -1 if an internal error occured. @@ -15163,7 +15988,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * SPEC (1) "If the {base type definition} is a complex type definition, * then all of the following must be true:" */ - if (IS_COMPLEX_TYPE(base)) { + if (WXS_IS_COMPLEX(base)) { /* * SPEC (1.1) "The {final} of the {base type definition} must not * contain extension." @@ -15171,11 +15996,20 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, if (base->flags & XML_SCHEMAS_TYPE_FINAL_EXTENSION) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of the base type definition " "contains 'extension'", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } + + /* + * ATTENTION: The constrains (1.2) and (1.3) are not applied, + * since they are automatically satisfied through the + * inheriting mechanism. + * Note that even if redefining components, the inheriting mechanism + * is used. + */ +#if 0 /* * SPEC (1.2) "Its {attribute uses} must be a subset of the {attribute * uses} @@ -15185,22 +16019,89 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * type definition itself whose {attribute declaration} has the same * {name}, {target namespace} and {type definition} as its attribute * declaration" - * - * NOTE (1.2): This will be already satisfied by the way the attribute - * uses are extended in xmlSchemaBuildAttributeValidation(); thus this - * check is not needed. */ + if (base->attrUses != NULL) { + int i, j, found; + xmlSchemaAttributeUsePtr use, buse; + for (i = 0; i < (WXS_LIST_CAST base->attrUses)->nbItems; i ++) { + buse = (WXS_LIST_CAST base->attrUses)->items[i]; + found = 0; + if (type->attrUses != NULL) { + use = (WXS_LIST_CAST type->attrUses)->items[j]; + for (j = 0; j < (WXS_LIST_CAST type->attrUses)->nbItems; j ++) + { + if ((WXS_ATTRUSE_DECL_NAME(use) == + WXS_ATTRUSE_DECL_NAME(buse)) && + (WXS_ATTRUSE_DECL_TNS(use) == + WXS_ATTRUSE_DECL_TNS(buse)) && + (WXS_ATTRUSE_TYPEDEF(use) == + WXS_ATTRUSE_TYPEDEF(buse)) + { + found = 1; + break; + } + } + } + if (! found) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_COS_CT_EXTENDS_1_2, + NULL, WXS_BASIC_CAST type, + /* + * TODO: The report does not indicate that also the + * type needs to be the same. + */ + "This type is missing a matching correspondent " + "for its {base type}'s %s in its {attribute uses}", + xmlSchemaGetComponentDesignation(&str, + buse->children), + NULL); + FREE_AND_NULL(str) + } + } + } /* * SPEC (1.3) "If it has an {attribute wildcard}, the complex type * definition must also have one, and the base type definition's * {attribute wildcard}'s {namespace constraint} must be a subset * of the complex type definition's {attribute wildcard}'s {namespace * constraint}, as defined by Wildcard Subset (§3.10.6)." - * - * NOTE (1.3) This is already checked in - * xmlSchemaBuildAttributeValidation; thus this check is not needed. - * + */ + + /* + * MAYBE TODO: Enable if ever needed. But this will be needed only + * if created the type via a schema construction API. + */ + if (base->attributeWildcard != NULL) { + if (type->attributeWilcard == NULL) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_COS_CT_EXTENDS_1_3, + NULL, type, + "The base %s has an attribute wildcard, " + "but this type is missing an attribute wildcard", + xmlSchemaGetComponentDesignation(&str, base)); + FREE_AND_NULL(str) + + } else if (xmlSchemaCheckCOSNSSubset( + base->attributeWildcard, type->attributeWildcard)) + { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_COS_CT_EXTENDS_1_3, + NULL, type, + "The attribute wildcard is not a valid " + "superset of the one in the base %s", + xmlSchemaGetComponentDesignation(&str, base)); + FREE_AND_NULL(str) + } + } +#endif + /* * SPEC (1.4) "One of the following must be true:" */ if ((type->contentTypeDef != NULL) && @@ -15230,7 +16131,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The content type must specify a particle", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } @@ -15256,13 +16157,13 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The content type of both, the type and its base " "type, must either 'mixed' or 'element-only'", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } /* - * FUTURE TODO SPEC (1.4.3.2.2.2) "The particle of the + * URGENT TODO SPEC (1.4.3.2.2.2) "The particle of the * complex type definition must be a ·valid extension· * of the {base type definition}'s particle, as defined * in Particle Valid (Extension) (§3.9.6)." @@ -15271,10 +16172,11 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * since it is ensured by the derivation process in * xmlSchemaTypeFixup(). We need to implement this when heading * for a construction API + * TODO: !! This is needed to be checked if redefining a type !! */ } /* - * TODO (1.5) + * URGENT TODO (1.5) */ } } else { @@ -15289,7 +16191,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The content type must be the simple base type", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } @@ -15301,7 +16203,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "The 'final' of the base type definition " "contains 'extension'", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); @@ -15321,7 +16223,11 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * * STATUS: * missing: - * (5.4.2), (5.2.2.1) + * (5.4.2) ??? + * + * ATTENTION: + * In XML Schema 1.1 this will be: + * Validation Rule: Checking complex type subsumption * * Returns 0 if the constraints are satisfied, a positive * error code if not and -1 if an internal error occured. @@ -15333,25 +16239,45 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaTypePtr base; /* - * TODO: Correct the error code; XML_SCHEMAP_COS_CT_EXTENDS_1_1 is used + * TODO: Correct the error code; XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1 is used * temporarily only. */ base = type->baseType; + if (! WXS_IS_COMPLEX(base)) { + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + type->node, WXS_BASIC_CAST type, + "The base type must be a complex type", NULL, NULL); + return(ctxt->err); + } if (base->flags & XML_SCHEMAS_TYPE_FINAL_RESTRICTION) { /* * SPEC (1) "The {base type definition} must be a complex type * definition whose {final} does not contain restriction." */ - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + type->node, WXS_BASIC_CAST type, "The 'final' of the base type definition " - "contains 'restriction'", NULL); - return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); + "contains 'restriction'", NULL, NULL); + return (ctxt->err); + } + /* + * SPEC (2), (3) and (4) + * Those are handled in a separate function, since the + * same constraints are needed for redefinition of + * attribute groups as well. + */ + if (xmlSchemaCheckDerivationOKRestriction2to4(ctxt, + XML_SCHEMA_ACTION_DERIVE, + WXS_BASIC_CAST type, WXS_BASIC_CAST base, + type->attrUses, base->attrUses, + type->attributeWildcard, + base->attributeWildcard) == -1) + { + return(-1); } /* - * NOTE (3) and (4) are done in xmlSchemaBuildAttributeValidation(). - * * SPEC (5) "One of the following must be true:" */ if (base->builtInType == XML_SCHEMAS_ANYTYPE) { @@ -15369,14 +16295,39 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, * SPEC (5.2.2) "One of the following must be true:" */ if ((base->contentType == XML_SCHEMA_CONTENT_SIMPLE) || - (base->contentType == XML_SCHEMA_CONTENT_BASIC)) { + (base->contentType == XML_SCHEMA_CONTENT_BASIC)) + { + int err; /* * SPEC (5.2.2.1) "The {content type} of the {base type * definition} must be a simple type definition from which * the {content type} is validly derived given the empty * set as defined in Type Derivation OK (Simple) (§3.14.6)." - * URGENT TODO + * + * ATTENTION TODO: This seems not needed if the type implicitely + * derived from the base type. + * */ + err = xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST ctxt, + type->contentTypeDef, base->contentTypeDef, 0); + if (err != 0) { + xmlChar *strA = NULL, *strB = NULL; + + if (err == -1) + return(-1); + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + NULL, WXS_BASIC_CAST type, + "The {content type} %s is not validly derived from the " + "base type's {content type} %s", + xmlSchemaGetComponentDesignation(&strA, + type->contentTypeDef), + xmlSchemaGetComponentDesignation(&strB, + base->contentTypeDef)); + FREE_AND_NULL(strA); + FREE_AND_NULL(strB); + return(ctxt->err); + } } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) && (xmlSchemaIsParticleEmptiable( (xmlSchemaParticlePtr) base->subtypes))) { @@ -15388,11 +16339,11 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, */ } else { xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + WXS_BASIC_CAST type, NULL, "The content type of the base type must be either " "a simple type or 'mixed' and an emptiable particle", NULL); - return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); + return (ctxt->err); } } else if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { /* @@ -15417,31 +16368,31 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, */ } else { xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + WXS_BASIC_CAST type, NULL, "The content type of the base type must be either " "empty or 'mixed' (or 'elements-only') and an emptiable " "particle", NULL); - return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); + return (ctxt->err); } } else if ((type->contentType == XML_SCHEMA_CONTENT_ELEMENTS) || - HAS_MIXED_CONTENT(type)) { + WXS_HAS_MIXED_CONTENT(type)) { /* * SPEC (5.4.1.1) "The {content type} of the complex type definition * itself must be element-only" */ - if (HAS_MIXED_CONTENT(type) && (! HAS_MIXED_CONTENT(base))) { + if (WXS_HAS_MIXED_CONTENT(type) && (! WXS_HAS_MIXED_CONTENT(base))) { /* * SPEC (5.4.1.2) "The {content type} of the complex type * definition itself and of the {base type definition} must be * mixed" */ xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + WXS_BASIC_CAST type, NULL, "If the content type is 'mixed', then the content type of the " "base type must also be 'mixed'", NULL); - return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); + return (ctxt->err); } /* * SPEC (5.4.2) "The particle of the complex type definition itself @@ -15453,10 +16404,10 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, */ } else { xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_COS_CT_EXTENDS_1_1, - NULL, type, NULL, + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, + WXS_BASIC_CAST type, NULL, "The type is not a valid restriction of its base type", NULL); - return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); + return (ctxt->err); } return (0); } @@ -15513,17 +16464,17 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, * XML_SCHEMAP_SRC_CT_1 only yet. */ base = type->baseType; - if (! HAS_SIMPLE_CONTENT(type)) { + if (! WXS_HAS_SIMPLE_CONTENT(type)) { /* * 1 If the alternative is chosen, the type definition * ·resolved· to by the ·actual value· of the base [attribute] * must be a complex type definition; */ - if (! IS_COMPLEX_TYPE(base)) { + if (! WXS_IS_COMPLEX(base)) { xmlChar *str = NULL; xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, type->node, + WXS_BASIC_CAST type, type->node, "If using , the base type is expected to be " "a complex type. The base type '%s' is a simple type", xmlSchemaFormatQName(&str, base->targetNamespace, @@ -15539,7 +16490,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, * 2.1 The type definition ·resolved· to by the ·actual value· of the * base [attribute] must be one of the following: */ - if (IS_SIMPLE_TYPE(base)) { + if (WXS_IS_SIMPLE(base)) { if (WXS_IS_EXTENSION(type) == 0) { xmlChar *str = NULL; /* @@ -15549,7 +16500,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, /* TODO: Change error code to ..._SRC_CT_2_1_3. */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "If using and , the base " "type must be a complex type. The base type '%s' is " "a simple type", @@ -15569,7 +16520,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, */ if (base->contentTypeDef == NULL) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INTERNAL, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "Internal error: xmlSchemaCheckSRCCT, " "'%s', base type has no content type", type->name); @@ -15601,7 +16552,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, /* TODO: Change error code to ..._SRC_CT_2_2. */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "A is expected among the children " "of , if is used and " "the base type '%s' is a complex type", @@ -15619,7 +16570,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, if (WXS_IS_RESTRICTION(type)) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "If and is used, the " "base type must be a simple type or a complex type with " "mixed content and particle emptiable. The base type " @@ -15629,7 +16580,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, } else { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_CT_1, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "If and is used, the " "base type must be a simple type. The base type '%s' " "is a complex type", @@ -15650,7 +16601,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, * above for {attribute wildcard} is satisfied, the intensional * intersection must be expressible, as defined in Attribute Wildcard * Intersection (§3.10.6). - * NOTE (4) is done in xmlSchemaBuildAttributeValidation(). + * NOTE (4) is done in xmlSchemaFixupTypeAttributeUses(). */ return (ret); } @@ -15782,7 +16733,7 @@ xmlSchemaCheckRCaseNameAndTypeOK(xmlSchemaParserCtxtPtr ctxt, set |= SUBSET_EXTENSION; set |= SUBSET_LIST; set |= SUBSET_UNION; - if (xmlSchemaCheckCOSDerivedOK(elemR->subtypes, + if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST ctxt, elemR->subtypes, elemB->subtypes, set) != 0) return (1); } @@ -15932,8 +16883,8 @@ xmlSchemaCheckCOSParticleRestrict(xmlSchemaParserCtxtPtr ctxt, { int ret = 0; - /*part = GET_PARTICLE(type); - basePart = GET_PARTICLE(base); + /*part = WXS_TYPE_PARTICLE(type); + basePart = WXS_TYPE_PARTICLE(base); */ TODO @@ -16049,7 +17000,7 @@ xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt, #define FACET_RESTR_MUTUAL_ERR(fac1, fac2) \ xmlSchemaPCustomErrExt(pctxt, \ XML_SCHEMAP_INVALID_FACET_VALUE, \ - NULL, (xmlSchemaTypePtr) fac1, fac1->node, \ + WXS_BASIC_CAST fac1, fac1->node, \ "It is an error for both '%s' and '%s' to be specified on the "\ "same type definition", \ BAD_CAST xmlSchemaFacetTypeToString(fac1->type), \ @@ -16058,13 +17009,13 @@ xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt, #define FACET_RESTR_ERR(fac1, msg) \ xmlSchemaPCustomErr(pctxt, \ XML_SCHEMAP_INVALID_FACET_VALUE, \ - NULL, (xmlSchemaTypePtr) fac1, fac1->node, \ + WXS_BASIC_CAST fac1, fac1->node, \ msg, NULL); #define FACET_RESTR_FIXED_ERR(fac) \ xmlSchemaPCustomErr(pctxt, \ XML_SCHEMAP_INVALID_FACET_VALUE, \ - NULL, (xmlSchemaTypePtr) fac, fac->node, \ + WXS_BASIC_CAST fac, fac->node, \ "The base type's facet is 'fixed', thus the value must not " \ "differ", NULL); @@ -16099,7 +17050,7 @@ xmlSchemaDeriveFacetErr(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_INVALID_FACET_VALUE, - NULL, (xmlSchemaTypePtr) facet1, facet1->node, + WXS_BASIC_CAST facet1, NULL, (const char *) msg, NULL); if (msg != NULL) @@ -16127,7 +17078,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, bfmaxlen = NULL, bfminlen = NULL, /* facets of the base type */ bfmininc = NULL, bfmaxinc = NULL, bfminexc = NULL, bfmaxexc = NULL; - int res, err = 0, fixedErr; + int res; /* err = 0, fixedErr; */ /* * SPEC st-restrict-facets 1: @@ -16211,7 +17162,6 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, break; } } - err = 0; /* * length and minLength or maxLength (2.2) + (3.2) */ @@ -16593,8 +17543,8 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, * Search for a duplicate facet in the current type. */ link = type->facetSet; - err = 0; - fixedErr = 0; + /* err = 0; */ + /* fixedErr = 0; */ while (link != NULL) { facet = link->facet; if (facet->type == bfacet->type) { @@ -16661,14 +17611,18 @@ xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, * The actual value is then formed by replacing any union type * definition in the ·explicit members· with the members of their * {member type definitions}, in order. + * + * TODO: There's a bug entry at + * "http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0287.html" + * which indicates that we'll keep the union types the future. */ link = type->memberTypes; while (link != NULL) { - if (IS_NOT_TYPEFIXED(link->type)) - xmlSchemaTypeFixup(link->type, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(link->type)) + xmlSchemaTypeFixup(link->type, ACTXT_CAST pctxt); - if (VARIETY_UNION(link->type)) { + if (WXS_IS_UNION(link->type)) { subLink = xmlSchemaGetUnionSimpleTypeMemberTypes(link->type); if (subLink != NULL) { link->type = subLink->type; @@ -16740,7 +17694,7 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) if (has) type->flags |= XML_SCHEMAS_TYPE_HAS_FACETS; - if (has && (! needVal) && VARIETY_ATOMIC(type)) { + if (has && (! needVal) && WXS_IS_ATOMIC(type)) { xmlSchemaTypePtr prim = xmlSchemaGetPrimitiveType(type); /* * OPTIMIZE VAL TODO: Some facets need a computed value. @@ -16760,10 +17714,10 @@ xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) /* * Evaluate the whitespace-facet value. */ - if (VARIETY_LIST(type)) { + if (WXS_IS_LIST(type)) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; return (0); - } else if (VARIETY_UNION(type)) + } else if (WXS_IS_UNION(type)) return (0); if (type->facetSet != NULL) { @@ -16813,7 +17767,6 @@ xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) break; } } - return (0); } return (0); } @@ -16824,11 +17777,11 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, { if (type->type != XML_SCHEMA_TYPE_SIMPLE) return(0); - if (! TYPE_IS_NOT_FIXEDUP_1(type)) + if (! WXS_IS_TYPE_NOT_FIXED_1(type)) return(0); type->flags |= XML_SCHEMAS_TYPE_FIXUP_1; - if (VARIETY_LIST(type)) { + if (WXS_IS_LIST(type)) { /* * Corresponds to ... */ @@ -16840,7 +17793,7 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, "list type has no item-type assigned"); return(-1); } - } else if (VARIETY_UNION(type)) { + } else if (WXS_IS_UNION(type)) { /* * Corresponds to ... */ @@ -16861,7 +17814,7 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, "type has no base-type assigned"); return(-1); } - if (TYPE_IS_NOT_FIXEDUP_1(type->baseType)) + if (WXS_IS_TYPE_NOT_FIXED_1(type->baseType)) if (xmlSchemaFixupSimpleTypeStageOne(pctxt, type->baseType) == -1) return(-1); /* @@ -16869,15 +17822,15 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, * If the alternative is chosen, then the * {variety} of the {base type definition}. */ - if (VARIETY_ATOMIC(type->baseType)) + if (WXS_IS_ATOMIC(type->baseType)) type->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC; - else if (VARIETY_LIST(type->baseType)) { + else if (WXS_IS_LIST(type->baseType)) { type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; /* * Inherit the itemType. */ type->subtypes = type->baseType->subtypes; - } else if (VARIETY_UNION(type->baseType)) { + } else if (WXS_IS_UNION(type->baseType)) { type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; /* * NOTE that we won't assign the memberTypes of the base, @@ -16902,7 +17855,7 @@ xmlSchemaDebugFixedType(xmlSchemaParserCtxtPtr pctxt, } else { xmlGenericError(xmlGenericErrorContext, "Type of %s :", name); } - if ((IS_SIMPLE_TYPE(type)) || (IS_COMPLEX_TYPE(type))) { + if ((WXS_IS_SIMPLE(type)) || (WXS_IS_COMPLEX(type))) { switch (type->contentType) { case XML_SCHEMA_CONTENT_SIMPLE: xmlGenericError(xmlGenericErrorContext, "simple\n"); @@ -16954,7 +17907,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, if (type->type != XML_SCHEMA_TYPE_SIMPLE) return(-1); - if (! IS_NOT_TYPEFIXED(type)) + if (! WXS_IS_TYPE_NOT_FIXED(type)) return(0); type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; @@ -16965,11 +17918,13 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, "missing baseType"); goto exit_failure; } - if (IS_NOT_TYPEFIXED(type->baseType)) - xmlSchemaTypeFixup(type->baseType, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(type->baseType)) + xmlSchemaTypeFixup(type->baseType, ACTXT_CAST pctxt); /* * If a member type of a union is a union itself, we need to substitute * that member type for its member types. + * NOTE that this might change in WXS 1.1; i.e. we will keep the union + * types in WXS 1.1. */ if ((type->memberTypes != NULL) && (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)) @@ -17043,19 +17998,19 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, int res = 0, olderrs = pctxt->nberrors; xmlSchemaTypePtr baseType = type->baseType; - if (! IS_NOT_TYPEFIXED(type)) + if (! WXS_IS_TYPE_NOT_FIXED(type)) return(0); type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; if (baseType == NULL) { - PERROR_INT("xmlSchemaFixupSimpleTypeStageTwo", + PERROR_INT("xmlSchemaFixupComplexType", "missing baseType"); goto exit_failure; } /* * Fixup the base type. */ - if (IS_NOT_TYPEFIXED(baseType)) - xmlSchemaTypeFixup(baseType, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(baseType)) + xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt); if (baseType->flags & XML_SCHEMAS_TYPE_INTERNAL_INVALID) { /* * Skip fixup if the base type is invalid. @@ -17075,7 +18030,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, /* * Corresponds to ... */ - if ((IS_COMPLEX_TYPE(baseType)) && + if ((WXS_IS_COMPLEX(baseType)) && (baseType->contentTypeDef != NULL) && (WXS_IS_RESTRICTION(type))) { xmlSchemaTypePtr contentBase, content; @@ -17117,12 +18072,12 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, #ifdef ENABLE_NAMED_LOCALS snprintf(buf, 29, "#scST%d", ++(pctxt->counter)); tmpname = xmlDictLookup(pctxt->dict, BAD_CAST buf, -1); - content = xmlSchemaAddType(pctxt, - pctxt->schema, tmpname, type->targetNamespace, + content = xmlSchemaAddType(pctxt, pctxt->schema, + XML_SCHEMA_TYPE_SIMPLE, tmpname, type->targetNamespace, type->node, 0); #else - content = xmlSchemaAddType(pctxt, - pctxt->schema, NULL, type->targetNamespace, + content = xmlSchemaAddType(pctxt, pctxt->schema, + XML_SCHEMA_TYPE_SIMPLE, NULL, type->targetNamespace, type->node, 0); #endif if (content == NULL) @@ -17143,8 +18098,8 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, type->facetSet = NULL; type->contentTypeDef = content; - if (IS_NOT_TYPEFIXED(contentBase)) - xmlSchemaTypeFixup(contentBase, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(contentBase)) + xmlSchemaTypeFixup(contentBase, ACTXT_CAST pctxt); /* * Fixup the newly created type. We don't need to check * for circularity here. @@ -17154,7 +18109,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, res = xmlSchemaFixupSimpleTypeStageTwo(pctxt, content); HFAILURE HERROR - } else if ((IS_COMPLEX_TYPE(baseType)) && + } else if ((WXS_IS_COMPLEX(baseType)) && (baseType->contentType == XML_SCHEMA_CONTENT_MIXED) && (WXS_IS_RESTRICTION(type))) { /* @@ -17169,14 +18124,14 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, */ xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_INTERNAL, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "Internal error: xmlSchemaTypeFixup, " "complex type '%s': the " "is missing a child, but was not catched " "by xmlSchemaCheckSRCCT()", type->name); goto exit_failure; } - } else if ((IS_COMPLEX_TYPE(baseType)) && WXS_IS_EXTENSION(type)) { + } else if ((WXS_IS_COMPLEX(baseType)) && WXS_IS_EXTENSION(type)) { /* * SPEC (3) If + base is with * content, "...then the {content type} of that @@ -17189,7 +18144,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, */ xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_INTERNAL, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "Internal error: xmlSchemaTypeFixup, " "complex type '%s': the ed base type is " "a complex type with no simple content type", @@ -17197,7 +18152,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, goto exit_failure; } type->contentTypeDef = baseType->contentTypeDef; - } else if ((IS_SIMPLE_TYPE(baseType)) && WXS_IS_EXTENSION(type)) { + } else if ((WXS_IS_SIMPLE(baseType)) && WXS_IS_EXTENSION(type)) { /* * SPEC (4) + base is * "... then that simple type definition" @@ -17209,7 +18164,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, */ xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_INTERNAL, - NULL, type, NULL, + WXS_BASIC_CAST type, NULL, "Internal error: xmlSchemaTypeFixup, " "complex type '%s' with : unhandled " "derivation case", type->name); @@ -17257,7 +18212,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, goto exit_failure; /* * Create the model group. - */ + */ /* URGENT TODO: avoid adding to pending items. */ particle->children = (xmlSchemaTreeItemPtr) xmlSchemaAddModelGroup(pctxt, pctxt->schema, XML_SCHEMA_TYPE_SEQUENCE, type->node); @@ -17322,7 +18277,47 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * "A model group whose {compositor} is sequence and whose * {particles} are..." */ - if (! dummySequence) { + if ((WXS_TYPE_PARTICLE(type) != NULL) && + (WXS_TYPE_PARTICLE_TERM(type) != NULL) && + ((WXS_TYPE_PARTICLE_TERM(type))->type == + XML_SCHEMA_TYPE_ALL)) + { + /* + * SPEC cos-all-limited (1) + */ + xmlSchemaCustomErr(ACTXT_CAST pctxt, + /* TODO: error code */ + XML_SCHEMAP_COS_ALL_LIMITED, + WXS_ITEM_NODE(type), NULL, + "The type has an 'all' model group in its " + "{content type} and thus cannot be derived from " + "a non-empty type, since this would produce a " + "'sequence' model group containing the 'all' " + "model group; 'all' model groups are not " + "allowed to appear inside other model groups", + NULL, NULL); + + } else if ((WXS_TYPE_PARTICLE(baseType) != NULL) && + (WXS_TYPE_PARTICLE_TERM(baseType) != NULL) && + ((WXS_TYPE_PARTICLE_TERM(baseType))->type == + XML_SCHEMA_TYPE_ALL)) + { + /* + * SPEC cos-all-limited (1) + */ + xmlSchemaCustomErr(ACTXT_CAST pctxt, + /* TODO: error code */ + XML_SCHEMAP_COS_ALL_LIMITED, + WXS_ITEM_NODE(type), NULL, + "A type cannot be derived by extension from a type " + "which has an 'all' model group in its " + "{content type}, since this would produce a " + "'sequence' model group containing the 'all' " + "model group; 'all' model groups are not " + "allowed to appear inside other model groups", + NULL, NULL); + + } else if (! dummySequence) { xmlSchemaTreeItemPtr effectiveContent = (xmlSchemaTreeItemPtr) type->subtypes; /* @@ -17340,7 +18335,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMA_TYPE_SEQUENCE, type->node); if (particle->children == NULL) goto exit_failure; - type->subtypes = (xmlSchemaTypePtr) particle; + WXS_TYPE_CONTENTTYPE(type) = (xmlSchemaTypePtr) particle; /* * SPEC "the particle of the {content type} of * the ... base ..." @@ -17362,6 +18357,16 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * SPEC "followed by the ·effective content·." */ particle->next = effectiveContent; + /* + * This all will result in: + * new-particle + * --> new-sequence( + * new-particle + * --> base-model, + * this-particle + * --> this-model + * ) + */ } else { /* * This is the case when there is already an empty @@ -17379,16 +18384,21 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, } } /* - * Apply the complex type component constraints; this will not - * check attributes, since this is done in - * xmlSchemaBuildAttributeValidation(). + * Now fixup attribute uses: + * - expand attr. group references + * - intersect attribute wildcards + * - inherit attribute uses of the base type + * - inherit or union attr. wildcards if extending + * - apply attr. use prohibitions if restricting */ - res = xmlSchemaCheckCTComponent(pctxt, type); + res = xmlSchemaFixupTypeAttributeUses(pctxt, type); HFAILURE HERROR /* - * Inherit & check constraints for attributes. + * Apply the complex type component constraints; this will not + * check attributes, since this is done in + * xmlSchemaFixupTypeAttributeUses(). */ - res = xmlSchemaBuildAttributeValidation(pctxt, type); + res = xmlSchemaCheckCTComponent(pctxt, type); HFAILURE HERROR #ifdef DEBUG_TYPE @@ -17425,16 +18435,21 @@ exit_failure: */ static int xmlSchemaTypeFixup(xmlSchemaTypePtr type, - xmlSchemaParserCtxtPtr pctxt) + xmlSchemaAbstractCtxtPtr actxt) { if (type == NULL) return(0); - if (! IS_NOT_TYPEFIXED(type)) + if (actxt->type != XML_SCHEMA_CTXT_PARSER) { + AERROR_INT("xmlSchemaTypeFixup", + "this function needs a parser context"); + return(-1); + } + if (! WXS_IS_TYPE_NOT_FIXED(type)) return(0); if (type->type == XML_SCHEMA_TYPE_COMPLEX) - return(xmlSchemaFixupComplexType(pctxt, type)); + return(xmlSchemaFixupComplexType(PCTXT_CAST actxt, type)); else if (type->type == XML_SCHEMA_TYPE_SIMPLE) - return(xmlSchemaFixupSimpleTypeStageTwo(pctxt, type)); + return(xmlSchemaFixupSimpleTypeStageTwo(PCTXT_CAST actxt, type)); return(0); } @@ -17546,7 +18561,7 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, xmlChar *str = NULL; xmlSchemaCustomErr(ACTXT_CAST pctxt, - ret, facet->node, (xmlSchemaTypePtr) facet, + ret, facet->node, WXS_BASIC_CAST facet, "The value '%s' of the facet does not validate " "against the base type '%s'", facet->value, @@ -17571,7 +18586,7 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, /* No error message for RelaxNG. */ if (ctxtGiven) { xmlSchemaCustomErr(ACTXT_CAST pctxt, - ret, facet->node, typeDecl, + ret, facet->node, WXS_BASIC_CAST typeDecl, "The value '%s' of the facet 'pattern' is not a " "valid regular expression", facet->value, NULL); @@ -17582,33 +18597,43 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, case XML_SCHEMA_FACET_FRACTIONDIGITS: case XML_SCHEMA_FACET_LENGTH: case XML_SCHEMA_FACET_MAXLENGTH: - case XML_SCHEMA_FACET_MINLENGTH:{ + case XML_SCHEMA_FACET_MINLENGTH: + + if (facet->type == XML_SCHEMA_FACET_TOTALDIGITS) { + ret = xmlSchemaValidatePredefinedType( + xmlSchemaGetBuiltInType(XML_SCHEMAS_PINTEGER), + facet->value, &(facet->val)); + } else { ret = xmlSchemaValidatePredefinedType( xmlSchemaGetBuiltInType(XML_SCHEMAS_NNINTEGER), facet->value, &(facet->val)); - if (ret != 0) { - if (ret < 0) { - /* No error message for RelaxNG. */ - if (ctxtGiven) { - PERROR_INT("xmlSchemaCheckFacet", - "validating facet value"); - } - goto internal_error; - } - ret = XML_SCHEMAP_INVALID_FACET_VALUE; + } + if (ret != 0) { + if (ret < 0) { /* No error message for RelaxNG. */ if (ctxtGiven) { - /* error code */ - xmlSchemaCustomErr(ACTXT_CAST pctxt, - ret, facet->node, typeDecl, - "The value '%s' of the facet '%s' is not a valid " - "'nonNegativeInteger'", - facet->value, - xmlSchemaFacetTypeToString(facet->type)); - } - } - break; - } + PERROR_INT("xmlSchemaCheckFacet", + "validating facet value"); + } + goto internal_error; + } + ret = XML_SCHEMAP_INVALID_FACET_VALUE; + /* No error message for RelaxNG. */ + if (ctxtGiven) { + /* error code */ + xmlSchemaCustomErr4(ACTXT_CAST pctxt, + ret, facet->node, WXS_BASIC_CAST typeDecl, + "The value '%s' of the facet '%s' is not a valid '%s'", + facet->value, + xmlSchemaFacetTypeToString(facet->type), + (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? + BAD_CAST "nonNegativeInteger" : + BAD_CAST "positiveInteger", + NULL); + } + } + break; + case XML_SCHEMA_FACET_WHITESPACE:{ if (xmlStrEqual(facet->value, BAD_CAST "preserve")) { facet->whitespace = XML_SCHEMAS_FACET_PRESERVE; @@ -17622,7 +18647,7 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, if (ctxtGiven) { /* error was previously: XML_SCHEMAP_INVALID_WHITE_SPACE */ xmlSchemaCustomErr(ACTXT_CAST pctxt, - ret, facet->node, typeDecl, + ret, facet->node, WXS_BASIC_CAST typeDecl, "The value '%s' of the facet 'whitespace' is not " "valid", facet->value, NULL); } @@ -17779,7 +18804,7 @@ xmlSchemaCheckGroupDefCircular(xmlSchemaModelGroupDefPtr item, */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_MG_PROPS_CORRECT_2, - NULL, NULL, GET_NODE(circ), + NULL, WXS_ITEM_NODE(circ), "Circular reference to the model group definition '%s' " "defined", xmlSchemaFormatQName(&str, item->targetNamespace, item->name)); @@ -17794,114 +18819,115 @@ xmlSchemaCheckGroupDefCircular(xmlSchemaModelGroupDefPtr item, } /** - * xmlSchemaGroupDefReferenceTermFixup: - * @item: the particle with a model group definition as term + * xmlSchemaModelGroupToModelGroupDefFixup: * @ctxt: the parser context - * @name: the name - * - * Checks cos-all-limited. + * @mg: the model group * * Assigns the model group of model group definitions to the "term" * of the referencing particle. - * In xmlSchemaResolveParticleReferences the model group definitions was assigned - * to the "term", since needed for the circularity check. + * In xmlSchemaResolveModelGroupParticleReferences the model group + * definitions were assigned to the "term", since needed for the + * circularity check. + * + * Schema Component Constraint: + * All Group Limited (cos-all-limited) (1.2) */ static void -xmlSchemaGroupDefReferenceTermFixup(xmlSchemaParticlePtr item, - xmlSchemaParserCtxtPtr ctxt ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED) +xmlSchemaModelGroupToModelGroupDefFixup( + xmlSchemaParserCtxtPtr ctxt ATTRIBUTE_UNUSED, + xmlSchemaModelGroupPtr mg) { - if ((item == NULL) || - (item->type != XML_SCHEMA_TYPE_PARTICLE) || - (item->children == NULL) || - (item->children->type != XML_SCHEMA_TYPE_GROUP) || - (item->children->children == NULL)) - return; - item->children = item->children->children; - /* - * TODO: Not nice, but we will anchor cos-all-limited here. - */ - if ((item->children->type == XML_SCHEMA_TYPE_ALL) && - (item->maxOccurs != 1)) { + xmlSchemaParticlePtr particle = WXS_MODELGROUP_PARTICLE(mg); + + while (particle != NULL) { + if ((WXS_PARTICLE_TERM(particle) == NULL) || + ((WXS_PARTICLE_TERM(particle))->type != + XML_SCHEMA_TYPE_GROUP)) + { + particle = WXS_PTC_CAST particle->next; + continue; + } + if (WXS_MODELGROUPDEF_MODEL(WXS_PARTICLE_TERM(particle)) == NULL) { + /* + * TODO: Remove the particle. + */ + WXS_PARTICLE_TERM(particle) = NULL; + particle = WXS_PTC_CAST particle->next; + continue; + } /* - * SPEC (1.2) "the {term} property of a particle with - * {max occurs}=1which is part of a pair which constitutes the - * {content type} of a complex type definition." + * Assign the model group to the {term} of the particle. */ - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, - NULL, (xmlSchemaTypePtr) item, item->node, - "The particle's 'maxOccurs' must be 1, since an xs:all model " - "group is its term", NULL); + WXS_PARTICLE_TERM(particle) = + WXS_TREE_CAST WXS_MODELGROUPDEF_MODEL(WXS_PARTICLE_TERM(particle)); + + particle = WXS_PTC_CAST particle->next; } } /** - * xmlSchemaGetCircAttrGrRef: + * xmlSchemaCheckAttrGroupCircularRecur: * @ctxtGr: the searched attribute group * @attr: the current attribute list to be processed * * This one is intended to be used by - * xmlSchemaCheckSRCAttributeGroupCircular only. + * xmlSchemaCheckAttrGroupCircular only. * * Returns the circular attribute grou reference, otherwise NULL. */ -static xmlSchemaAttributeGroupPtr -xmlSchemaGetCircAttrGrRef(xmlSchemaAttributeGroupPtr ctxtGr, - xmlSchemaAttributePtr attr) +static xmlSchemaQNameRefPtr +xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, + xmlSchemaItemListPtr list) { - xmlSchemaAttributeGroupPtr circ = NULL, gr; - int marked; + xmlSchemaAttributeGroupPtr gr; + xmlSchemaQNameRefPtr ref, circ; + int i; /* * We will search for an attribute group reference which * references the context attribute group. */ - while (attr != NULL) { - marked = 0; - if (attr->type == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { - gr = (xmlSchemaAttributeGroupPtr) attr; - if (gr->refItem != NULL) { - if (gr->refItem == ctxtGr) - return (gr); - else if (gr->refItem->flags & - XML_SCHEMAS_ATTRGROUP_MARKED) { - attr = attr->next; - continue; - } else { - /* - * Mark as visited to avoid infinite recursion on - * circular references not yet examined. - */ - gr->refItem->flags |= XML_SCHEMAS_ATTRGROUP_MARKED; - marked = 1; - } - } - if (gr->attributes != NULL) - circ = xmlSchemaGetCircAttrGrRef(ctxtGr, gr->attributes); + for (i = 0; i < list->nbItems; i++) { + ref = list->items[i]; + if ((ref->type == XML_SCHEMA_EXTRA_QNAMEREF) && + (ref->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) && + (ref->item != NULL)) + { + gr = WXS_ATTR_GROUP_CAST ref->item; + if (gr == ctxtGr) + return(ref); + if (gr->flags & XML_SCHEMAS_ATTRGROUP_MARKED) + continue; /* - * Unmark the visited group's attributes. + * Mark as visited to avoid infinite recursion on + * circular references not yet examined. */ - if (marked) - gr->refItem->flags ^= XML_SCHEMAS_ATTRGROUP_MARKED; - if (circ != NULL) - return (circ); + if ((gr->attrUses) && + (gr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS)) + { + gr->flags |= XML_SCHEMAS_ATTRGROUP_MARKED; + circ = xmlSchemaCheckAttrGroupCircularRecur(ctxtGr, + (xmlSchemaItemListPtr) gr->attrUses); + gr->flags ^= XML_SCHEMAS_ATTRGROUP_MARKED; + if (circ != NULL) + return (circ); + } + } - attr = attr->next; } return (NULL); } /** - * xmlSchemaCheckSRCAttributeGroupCircular: + * xmlSchemaCheckAttrGroupCircular: * attrGr: the attribute group definition * @ctxt: the parser context * @name: the name * * Checks for circular references of attribute groups. */ -static void +static int xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, - xmlSchemaParserCtxtPtr ctxt) + xmlSchemaParserCtxtPtr ctxt) { /* * Schema Representation Constraint: @@ -17917,34 +18943,341 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, * it must not be the case that a ·QName· is encountered at any depth * which resolves to the component corresponding to this . */ - /* - * Only global components can be referenced. - */ - if (((attrGr->flags & XML_SCHEMAS_ATTRGROUP_GLOBAL) == 0) || - (attrGr->attributes == NULL)) - return; + if (attrGr->attrUses == NULL) + return(0); + else if ((attrGr->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS) == 0) + return(0); else { - xmlSchemaAttributeGroupPtr circ; - - circ = xmlSchemaGetCircAttrGrRef(attrGr, attrGr->attributes); + xmlSchemaQNameRefPtr circ; + + circ = xmlSchemaCheckAttrGroupCircularRecur(attrGr, + (xmlSchemaItemListPtr) attrGr->attrUses); if (circ != NULL) { + xmlChar *str = NULL; /* * TODO: Report the referenced attr group as QName. */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, - NULL, NULL, circ->node, + NULL, WXS_ITEM_NODE(WXS_BASIC_CAST circ), "Circular reference to the attribute group '%s' " - "defined", attrGr->name); + "defined", xmlSchemaGetComponentQName(&str, attrGr)); + FREE_AND_NULL(str); /* * NOTE: We will cut the reference to avoid further * confusion of the processor. - * BADSPEC: The spec should define how to process in this case. + * BADSPEC TODO: The spec should define how to process in this case. + */ + circ->item = NULL; + return(ctxt->err); + } + } + return(0); +} + +static int +xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaAttributeGroupPtr attrGr); + +/** + * xmlSchemaExpandAttributeGroupRefs: + * @pctxt: the parser context + * @node: the node of the component holding the attribute uses + * @completeWild: the intersected wildcard to be returned + * @list: the attribute uses + * + * Substitutes contained attribute group references + * for their attribute uses. Wilcards are intersected. + * Attribute use prohibitions are removed from the list + * and returned via the @prohibs list. + * Pointlessness of attr. prohibs, if a matching attr. decl + * is existent a well, are checked. + */ +static int +xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaBasicItemPtr item, + xmlSchemaWildcardPtr *completeWild, + xmlSchemaItemListPtr list, + xmlSchemaItemListPtr prohibs) +{ + xmlSchemaAttributeGroupPtr gr; + xmlSchemaAttributeUsePtr use; + xmlSchemaItemListPtr sublist; + int i, j; + int created = (*completeWild == NULL) ? 0 : 1; + + if (prohibs) + prohibs->nbItems = 0; + + for (i = 0; i < list->nbItems; i++) { + use = list->items[i]; + + if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { + if (prohibs == NULL) { + PERROR_INT("xmlSchemaExpandAttributeGroupRefs", + "unexpected attr prohibition found"); + return(-1); + } + /* + * Remove from attribute uses. + */ + if (xmlSchemaItemListRemove(list, i) == -1) + return(-1); + i--; + /* + * Note that duplicate prohibitions were already + * handled at parsing time. + */ + /* + * Add to list of prohibitions. + */ + xmlSchemaItemListAddSize(prohibs, 2, use); + continue; + } + if ((use->type == XML_SCHEMA_EXTRA_QNAMEREF) && + ((WXS_QNAME_CAST use)->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP)) + { + if ((WXS_QNAME_CAST use)->item == NULL) + return(-1); + gr = WXS_ATTR_GROUP_CAST (WXS_QNAME_CAST use)->item; + /* + * Expand the referenced attr. group. + * TODO: remove this, this is done in a previous step, so + * already done here. + */ + if ((gr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED) == 0) { + if (xmlSchemaAttributeGroupExpandRefs(pctxt, gr) == -1) + return(-1); + } + /* + * Build the 'complete' wildcard; i.e. intersect multiple + * wildcards. + */ + if (gr->attributeWildcard != NULL) { + if (*completeWild == NULL) { + *completeWild = gr->attributeWildcard; + } else { + if (! created) { + xmlSchemaWildcardPtr tmpWild; + + /* + * Copy the first encountered wildcard as context, + * except for the annotation. + * + * Although the complete wildcard might not correspond + * to any node in the schema, we will anchor it on + * the node of the owner component. + */ + tmpWild = xmlSchemaAddWildcard(pctxt, pctxt->schema, + XML_SCHEMA_TYPE_ANY_ATTRIBUTE, + WXS_ITEM_NODE(item)); + if (tmpWild == NULL) + return(-1); + if (xmlSchemaCloneWildcardNsConstraints(pctxt, + tmpWild, *completeWild) == -1) + return (-1); + tmpWild->processContents = (*completeWild)->processContents; + *completeWild = tmpWild; + created = 1; + } + + if (xmlSchemaIntersectWildcards(pctxt, *completeWild, + gr->attributeWildcard) == -1) + return(-1); + } + } + /* + * Just remove the reference if the referenced group does not + * contain any attribute uses. + */ + if (gr->attrUses == NULL) { + if (xmlSchemaItemListRemove(list, i) == -1) + return(-1); + i--; + continue; + } + /* + * Add the attribute uses. + */ + sublist = ((xmlSchemaItemListPtr) gr->attrUses); + if (sublist->nbItems != 0) { + list->items[i] = sublist->items[0]; + if (sublist->nbItems != 1) { + for (j = 1; j < sublist->nbItems; j++) { + i++; + if (xmlSchemaItemListInsert(list, + sublist->items[j], i) == -1) + return(-1); + } + } + } + } + + } + /* + * Handle pointless prohibitions of declared attributes. + */ + if (prohibs && (prohibs->nbItems != 0) && (list->nbItems != 0)) { + xmlSchemaAttributeUseProhibPtr prohib; + + for (i = prohibs->nbItems -1; i >= 0; i--) { + prohib = prohibs->items[i]; + for (j = 0; j < list->nbItems; j++) { + use = list->items[j]; + + if ((prohib->name == WXS_ATTRUSE_DECL_NAME(use)) && + (prohib->targetNamespace == WXS_ATTRUSE_DECL_TNS(use))) + { + xmlChar *str = NULL; + + xmlSchemaCustomWarning(ACTXT_CAST pctxt, + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, + prohib->node, NULL, + "Skipping pointless attribute use prohibition " + "'%s', since a corresponding attribute use " + "exists already in the type definition", + xmlSchemaFormatQName(&str, + prohib->targetNamespace, prohib->name), + NULL, NULL); + FREE_AND_NULL(str); + /* + * Remove the prohibition. + */ + if (xmlSchemaItemListRemove(prohibs, i) == -1) + return(-1); + break; + } + } + } + } + return(0); +} + +/** + * xmlSchemaAttributeGroupExpandRefs: + * @pctxt: the parser context + * @attrGr: the attribute group definition + * + * Computation of: + * {attribute uses} property + * {attribute wildcard} property + * + * Substitutes contained attribute group references + * for their attribute uses. Wilcards are intersected. + */ +static int +xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaAttributeGroupPtr attrGr) +{ + if ((attrGr->attrUses == NULL) || + (attrGr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED)) + return(0); + + attrGr->flags |= XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; + if (xmlSchemaExpandAttributeGroupRefs(pctxt, WXS_BASIC_CAST attrGr, + &(attrGr->attributeWildcard), attrGr->attrUses, NULL) == -1) + return(-1); + return(0); +} + +/** + * xmlSchemaAttributeGroupExpandRefs: + * @pctxt: the parser context + * @attrGr: the attribute group definition + * + * Substitutes contained attribute group references + * for their attribute uses. Wilcards are intersected. + * + * Schema Component Constraint: + * Attribute Group Definition Properties Correct (ag-props-correct) + */ +static int +xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaAttributeGroupPtr attrGr) +{ + /* + * SPEC ag-props-correct + * (1) "The values of the properties of an attribute group definition + * must be as described in the property tableau in The Attribute + * Group Definition Schema Component (§3.6.1), modulo the impact of + * Missing Sub-components (§5.3);" + */ + + if ((attrGr->attrUses != NULL) && + (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) + { + xmlSchemaItemListPtr uses = WXS_LIST_CAST attrGr->attrUses; + xmlSchemaAttributeUsePtr use, tmp; + int i, j, hasId = 0; + + for (i = uses->nbItems -1; i >= 0; i--) { + use = uses->items[i]; + /* + * SPEC ag-props-correct + * (2) "Two distinct members of the {attribute uses} must not have + * {attribute declaration}s both of whose {name}s match and whose + * {target namespace}s are identical." + */ + if (i > 0) { + for (j = i -1; j >= 0; j--) { + tmp = uses->items[j]; + if ((WXS_ATTRUSE_DECL_NAME(use) == + WXS_ATTRUSE_DECL_NAME(tmp)) && + (WXS_ATTRUSE_DECL_TNS(use) == + WXS_ATTRUSE_DECL_TNS(tmp))) + { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_AG_PROPS_CORRECT, + attrGr->node, WXS_BASIC_CAST attrGr, + "Duplicate %s", + xmlSchemaGetComponentDesignation(&str, use), + NULL); + FREE_AND_NULL(str); + /* + * Remove the duplicate. + */ + if (xmlSchemaItemListRemove(uses, i) == -1) + return(-1); + goto next_use; + } + } + } + /* + * SPEC ag-props-correct + * (3) "Two distinct members of the {attribute uses} must not have + * {attribute declaration}s both of whose {type definition}s are or + * are derived from ID." + * TODO: Does 'derived' include member-types of unions? */ - circ->attributes = NULL; - circ->refItem = NULL; + if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { + if (xmlSchemaIsDerivedFromBuiltInType( + WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) + { + if (hasId) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_AG_PROPS_CORRECT, + attrGr->node, WXS_BASIC_CAST attrGr, + "There must not exist more than one attribute " + "declaration of type 'xs:ID' " + "(or derived from 'xs:ID'). The %s violates this " + "constraint", + xmlSchemaGetComponentDesignation(&str, use), + NULL); + FREE_AND_NULL(str); + if (xmlSchemaItemListRemove(uses, i) == -1) + return(-1); + } + hasId = 1; + } + } +next_use: {} } } + return(0); } /** @@ -17953,88 +19286,108 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, * @ctxt: the schema parser context * @name: the attribute name * - * Fixes finish doing the computations on the attributes definitions + * Resolves references to attribute group definitions. */ -static void -xmlSchemaResolveAttrGroupReferences(xmlSchemaAttributeGroupPtr attrgrp, - xmlSchemaParserCtxtPtr ctxt, const xmlChar * name) +static int +xmlSchemaResolveAttrGroupReferences(xmlSchemaQNameRefPtr ref, + xmlSchemaParserCtxtPtr ctxt) { - if (name == NULL) - name = attrgrp->name; - if (attrgrp->attributes != NULL) - return; - if (attrgrp->ref != NULL) { - xmlSchemaAttributeGroupPtr ref; + xmlSchemaAttributeGroupPtr group; - ref = xmlSchemaGetAttributeGroup(ctxt->schema, attrgrp->ref, - attrgrp->refNs); - if (ref == NULL) { - xmlSchemaPResCompAttrErr(ctxt, - XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) attrgrp, attrgrp->node, - "ref", attrgrp->ref, attrgrp->refNs, - XML_SCHEMA_TYPE_ATTRIBUTEGROUP, NULL); - return; - } - attrgrp->refItem = ref; - /* - * URGENT TODO: Do we need to resolve refs of the - * referenced attr. group itself first? I don't think so. - * If we need this, then check for circularity first! - * REMOVED: xmlSchemaResolveAttrGroupReferences(ref, ctxt, NULL); - */ - attrgrp->attributes = ref->attributes; - attrgrp->attributeWildcard = ref->attributeWildcard; - } + if (ref->item != NULL) + return(0); + group = xmlSchemaGetAttributeGroup(ctxt->schema, + ref->name, + ref->targetNamespace); + if (group == NULL) { + xmlSchemaPResCompAttrErr(ctxt, + XML_SCHEMAP_SRC_RESOLVE, + NULL, ref->node, + "ref", ref->name, ref->targetNamespace, + ref->itemType, NULL); + return(ctxt->err); + } + ref->item = WXS_BASIC_CAST group; + return(0); } /** - * xmlSchemaAttrCheckValConstr: + * xmlSchemaCheckAttrPropsCorrect: * @item: an schema attribute declaration/use * @ctxt: a schema parser context * @name: the name of the attribute * * - * Schema Component Constraint: Attribute Declaration Properties Correct - * (a-props-correct) - * Validates the value constraints of an attribute declaration/use. + * Schema Component Constraint: + * Attribute Declaration Properties Correct (a-props-correct) * - * Fixes finish doing the computations on the attributes definitions + * Validates the value constraints of an attribute declaration/use. + * NOTE that this needs the simle type definitions to be already + * builded and checked. */ -static void -xmlSchemaCheckAttrValConstr(xmlSchemaAttributePtr item, - xmlSchemaParserCtxtPtr pctxt) +static int +xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaAttributePtr attr) { /* - * 2 if there is a {value constraint}, the canonical lexical - * representation of its value must be ·valid· with respect - * to the {type definition} as defined in String Valid (§3.14.4). + * SPEC a-props-correct (1) + * "The values of the properties of an attribute declaration must + * be as described in the property tableau in The Attribute + * Declaration Schema Component (§3.2.1), modulo the impact of + * Missing Sub-components (§5.3)." */ - if (item->defValue != NULL) { + + if (WXS_ATTR_TYPEDEF(attr) == NULL) + return(0); + + if (attr->defValue != NULL) { int ret; - if (item->subtypes == NULL) { - PERROR_INT("xmlSchemaCheckAttrValConstr", - "type is missing"); - return; + /* + * SPEC a-props-correct (3) + * "If the {type definition} is or is derived from ID then there + * must not be a {value constraint}." + */ + if (xmlSchemaIsDerivedFromBuiltInType( + WXS_ATTR_TYPEDEF(attr), XML_SCHEMAS_ID)) + { + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_A_PROPS_CORRECT_3, + NULL, WXS_BASIC_CAST attr, + "Value constraints are not allowed if the type definition " + "is or is derived from xs:ID", + NULL, NULL); + return(pctxt->err); } + /* + * SPEC a-props-correct (2) + * "if there is a {value constraint}, the canonical lexical + * representation of its value must be ·valid· with respect + * to the {type definition} as defined in String Valid (§3.14.4)." + * TODO: Don't care about the *cononical* stuff here, this requirement + * will be removed in WXS 1.1 anyway. + */ ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, - item->node, item->subtypes, item->defValue, &(item->defVal), + attr->node, WXS_ATTR_TYPEDEF(attr), + attr->defValue, &(attr->defVal), 1, 1, 0); if (ret != 0) { if (ret < 0) { - PERROR_INT("xmlSchemaAttrCheckValConstr", + PERROR_INT("xmlSchemaCheckAttrPropsCorrect", "calling xmlSchemaVCheckCVCSimpleType()"); - return; + return(-1); } - ret = XML_SCHEMAP_A_PROPS_CORRECT_2; xmlSchemaCustomErr(ACTXT_CAST pctxt, - ret, item->node, (xmlSchemaTypePtr) item, - "The value of the value constraint is not valid", NULL, NULL); - return; + XML_SCHEMAP_A_PROPS_CORRECT_2, + NULL, WXS_BASIC_CAST attr, + "The value of the value constraint is not valid", + NULL, NULL); + return(pctxt->err); } } + + return(0); } static xmlSchemaElementPtr @@ -18043,17 +19396,17 @@ xmlSchemaCheckSubstGroupCircular(xmlSchemaElementPtr elemDecl, { xmlSchemaElementPtr ret; - if (SUBST_GROUP_AFF(ancestor) == NULL) + if (WXS_SUBST_HEAD(ancestor) == NULL) return (NULL); - if (SUBST_GROUP_AFF(ancestor) == elemDecl) + if (WXS_SUBST_HEAD(ancestor) == elemDecl) return (ancestor); - if (SUBST_GROUP_AFF(ancestor)->flags & XML_SCHEMAS_ELEM_CIRCULAR) + if (WXS_SUBST_HEAD(ancestor)->flags & XML_SCHEMAS_ELEM_CIRCULAR) return (NULL); - SUBST_GROUP_AFF(ancestor)->flags |= XML_SCHEMAS_ELEM_CIRCULAR; + WXS_SUBST_HEAD(ancestor)->flags |= XML_SCHEMAS_ELEM_CIRCULAR; ret = xmlSchemaCheckSubstGroupCircular(elemDecl, - SUBST_GROUP_AFF(ancestor)); - SUBST_GROUP_AFF(ancestor)->flags ^= XML_SCHEMAS_ELEM_CIRCULAR; + WXS_SUBST_HEAD(ancestor)); + WXS_SUBST_HEAD(ancestor)->flags ^= XML_SCHEMAS_ELEM_CIRCULAR; return (ret); } @@ -18075,15 +19428,15 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, xmlSchemaElementPtr elemDecl) { int ret = 0; - xmlSchemaTypePtr typeDef = ELEM_TYPE(elemDecl); + xmlSchemaTypePtr typeDef = WXS_ELEM_TYPEDEF(elemDecl); /* * SPEC (1) "The values of the properties of an element declaration * must be as described in the property tableau in The Element * Declaration Schema Component (§3.3.1), modulo the impact of Missing * Sub-components (§5.3)." */ - if (SUBST_GROUP_AFF(elemDecl) != NULL) { - xmlSchemaElementPtr head = SUBST_GROUP_AFF(elemDecl), circ; + if (WXS_SUBST_HEAD(elemDecl) != NULL) { + xmlSchemaElementPtr head = WXS_SUBST_HEAD(elemDecl), circ; xmlSchemaCheckElementDeclComponent(head, pctxt); /* @@ -18093,7 +19446,7 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_E_PROPS_CORRECT_3, - NULL, (xmlSchemaTypePtr) elemDecl, elemDecl->node, + WXS_BASIC_CAST elemDecl, NULL, "Only global element declarations can have a " "substitution group affiliation", NULL); ret = XML_SCHEMAP_E_PROPS_CORRECT_3; @@ -18106,7 +19459,7 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, */ if (head == elemDecl) circ = head; - else if (SUBST_GROUP_AFF(head) != NULL) + else if (WXS_SUBST_HEAD(head) != NULL) circ = xmlSchemaCheckSubstGroupCircular(head, head); else circ = NULL; @@ -18115,7 +19468,7 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPCustomErrExt(pctxt, XML_SCHEMAP_E_PROPS_CORRECT_6, - NULL, (xmlSchemaTypePtr) circ, circ->node, + WXS_BASIC_CAST circ, NULL, "The element declaration '%s' defines a circular " "substitution group to element declaration '%s'", xmlSchemaGetComponentQName(&strA, circ), @@ -18140,7 +19493,7 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * attribute "final". */ - if (typeDef != ELEM_TYPE(SUBST_GROUP_AFF(elemDecl))) { + if (typeDef != WXS_ELEM_TYPEDEF(WXS_SUBST_HEAD(elemDecl))) { int set = 0; if (head->flags & XML_SCHEMAS_ELEM_FINAL_EXTENSION) @@ -18148,21 +19501,21 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if (head->flags & XML_SCHEMAS_ELEM_FINAL_RESTRICTION) set |= SUBSET_RESTRICTION; - if (xmlSchemaCheckCOSDerivedOK(typeDef, - ELEM_TYPE(head), set) != 0) { + if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST pctxt, typeDef, + WXS_ELEM_TYPEDEF(head), set) != 0) { xmlChar *strA = NULL, *strB = NULL, *strC = NULL; ret = XML_SCHEMAP_E_PROPS_CORRECT_4; xmlSchemaPCustomErrExt(pctxt, XML_SCHEMAP_E_PROPS_CORRECT_4, - NULL, (xmlSchemaTypePtr) elemDecl, elemDecl->node, + WXS_BASIC_CAST elemDecl, NULL, "The type definition '%s' was " "either rejected by the substitution group " "affiliation '%s', or not validly derived from its type " "definition '%s'", xmlSchemaGetComponentQName(&strA, typeDef), xmlSchemaGetComponentQName(&strB, head), - xmlSchemaGetComponentQName(&strC, ELEM_TYPE(head))); + xmlSchemaGetComponentQName(&strC, WXS_ELEM_TYPEDEF(head))); FREE_AND_NULL(strA) FREE_AND_NULL(strB) FREE_AND_NULL(strC) @@ -18177,17 +19530,17 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * XML 1.0, and should be avoided if backwards compatibility is desired" */ if ((elemDecl->value != NULL) && - ((IS_SIMPLE_TYPE(typeDef) && + ((WXS_IS_SIMPLE(typeDef) && xmlSchemaIsDerivedFromBuiltInType(typeDef, XML_SCHEMAS_ID)) || - (IS_COMPLEX_TYPE(typeDef) && - HAS_SIMPLE_CONTENT(typeDef) && + (WXS_IS_COMPLEX(typeDef) && + WXS_HAS_SIMPLE_CONTENT(typeDef) && xmlSchemaIsDerivedFromBuiltInType(typeDef->contentTypeDef, XML_SCHEMAS_ID)))) { ret = XML_SCHEMAP_E_PROPS_CORRECT_5; xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_E_PROPS_CORRECT_5, - NULL, (xmlSchemaTypePtr) elemDecl, elemDecl->node, + WXS_BASIC_CAST elemDecl, NULL, "The type definition (or type definition's content type) is or " "is derived from ID; value constraints are not allowed in " "conjunction with such a type definition", NULL); @@ -18256,7 +19609,7 @@ static void xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaElementPtr elemDecl) { - if ((SUBST_GROUP_AFF(elemDecl) == NULL) || + if ((WXS_SUBST_HEAD(elemDecl) == NULL) || /* SPEC (1) "Its {abstract} is false." */ (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT)) return; @@ -18269,8 +19622,8 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt, * {disallowed substitutions} as the blocking constraint, as defined in * Substitution Group OK (Transitive) (§3.3.6)." */ - for (head = SUBST_GROUP_AFF(elemDecl); head != NULL; - head = SUBST_GROUP_AFF(head)) { + for (head = WXS_SUBST_HEAD(elemDecl); head != NULL; + head = WXS_SUBST_HEAD(head)) { set = 0; methSet = 0; /* @@ -18321,7 +19674,7 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt, */ type = elemDecl->subtypes->baseType; while (type != NULL) { - if (IS_COMPLEX_TYPE(type)) { + if (WXS_IS_COMPLEX(type)) { if ((type->flags & XML_SCHEMAS_TYPE_BLOCK_EXTENSION) && ((set & XML_SCHEMAS_TYPE_BLOCK_EXTENSION) == 0)) @@ -18375,47 +19728,92 @@ xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, } /** - * xmlSchemaResolveParticleReferences: - * @item: an schema component - * @ctxt: a schema parser context - * @name: the internal name of the component + * xmlSchemaResolveModelGroupParticleReferences: + * @particle: a particle component + * @ctxt: a parser context * - * Resolves references of misc. schema components. + * Resolves references of a model group's {particles} to + * model group definitions and to element declarations. */ static void -xmlSchemaResolveParticleReferences(xmlSchemaTreeItemPtr item, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar * name ATTRIBUTE_UNUSED) +xmlSchemaResolveModelGroupParticleReferences( + xmlSchemaParserCtxtPtr ctxt, + xmlSchemaModelGroupPtr mg) { - if (item->type != XML_SCHEMA_TYPE_PARTICLE) - return; - if ((item->children != NULL) && - (item->children->type == XML_SCHEMA_EXTRA_QNAMEREF)) { - xmlSchemaQNameRefPtr ref = (xmlSchemaQNameRefPtr) item->children; - xmlSchemaBasicItemPtr refItem; + xmlSchemaParticlePtr particle = WXS_MODELGROUP_PARTICLE(mg); + xmlSchemaQNameRefPtr ref; + xmlSchemaBasicItemPtr refItem; + + /* + * URGENT TODO: Test this. + */ + while (particle != NULL) { + if ((WXS_PARTICLE_TERM(particle) == NULL) || + ((WXS_PARTICLE_TERM(particle))->type != + XML_SCHEMA_EXTRA_QNAMEREF)) + { + goto next_particle; + } + ref = WXS_QNAME_CAST WXS_PARTICLE_TERM(particle); /* * Resolve the reference. + * NULL the {term} by default. */ - item->children = NULL; + particle->children = NULL; + refItem = xmlSchemaGetNamedComponent(ctxt->schema, ref->itemType, ref->name, ref->targetNamespace); if (refItem == NULL) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - NULL, GET_NODE(item), "ref", ref->name, + NULL, WXS_ITEM_NODE(particle), "ref", ref->name, ref->targetNamespace, ref->itemType, NULL); - } else { - if (refItem->type == XML_SCHEMA_TYPE_GROUP) { + /* TODO: remove the particle. */ + goto next_particle; + } + if (refItem->type == XML_SCHEMA_TYPE_GROUP) { + if (WXS_MODELGROUPDEF_MODEL(refItem) == NULL) + /* TODO: remove the particle. */ + goto next_particle; + /* + * NOTE that we will assign the model group definition + * itself to the "term" of the particle. This will ease + * the check for circular model group definitions. After + * that the "term" will be assigned the model group of the + * model group definition. + */ + if ((WXS_MODELGROUPDEF_MODEL(refItem))->type == + XML_SCHEMA_TYPE_ALL) { /* - * NOTE that we will assign the model group definition - * itself to the "term" of the particle. This will ease - * the check for circular model group definitions. After - * that the "term" will be assigned the model group of the - * model group definition. + * SPEC cos-all-limited (1) + * SPEC cos-all-limited (1.2) + * "It appears only as the value of one or both of the + * following properties:" + * (1.1) "the {model group} property of a model group + * definition." + * (1.2) "the {term} property of a particle [... of] the " + * {content type} of a complex type definition." */ - item->children = (xmlSchemaTreeItemPtr) refItem; - } else - item->children = (xmlSchemaTreeItemPtr) refItem; + xmlSchemaCustomErr(ACTXT_CAST ctxt, + /* TODO: error code */ + XML_SCHEMAP_COS_ALL_LIMITED, + WXS_ITEM_NODE(particle), NULL, + "A model group definition is referenced, but " + "it contains an 'all' model group, which " + "cannot be contained by model groups", + NULL, NULL); + /* TODO: remove the particle. */ + goto next_particle; + } + particle->children = (xmlSchemaTreeItemPtr) refItem; + } else { + /* + * TODO: Are referenced element declarations the only + * other components we expect here? + */ + particle->children = (xmlSchemaTreeItemPtr) refItem; } +next_particle: + particle = WXS_PTC_CAST particle->next; } } @@ -18448,7 +19846,7 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, * string comparison for string based types. */ if ((ptx->builtInType == XML_SCHEMAS_STRING) || - IS_ANY_SIMPLE_TYPE(ptx)) { + WXS_IS_ANY_SIMPLE_TYPE(ptx)) { if (! xmlStrEqual( xmlSchemaValueGetAsString(x), xmlSchemaValueGetAsString(y))) @@ -18463,38 +19861,181 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, return(0); } /* - * Lists. + * Lists. + */ + x = xmlSchemaValueGetNext(x); + if (x != NULL) { + y = xmlSchemaValueGetNext(y); + if (y == NULL) + return (0); + } else if (xmlSchemaValueGetNext(y) != NULL) + return (0); + else + return (1); + } + return (0); +} + +/** + * xmlSchemaResolveAttrUseReferences: + * @item: an attribute use + * @ctxt: a parser context + * + * Resolves the referenced attribute declaration. + */ +static int +xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUsePtr ause, + xmlSchemaParserCtxtPtr ctxt) +{ + if ((ctxt == NULL) || (ause == NULL)) + return(-1); + if ((ause->attrDecl == NULL) || + (ause->attrDecl->type != XML_SCHEMA_EXTRA_QNAMEREF)) + return(0); + + { + xmlSchemaQNameRefPtr ref = WXS_QNAME_CAST ause->attrDecl; + + /* + * TODO: Evaluate, what errors could occur if the declaration is not + * found. + */ + ause->attrDecl = xmlSchemaGetAttributeDecl(ctxt->schema, + ref->name, ref->targetNamespace); + if (ause->attrDecl == NULL) { + xmlSchemaPResCompAttrErr(ctxt, + XML_SCHEMAP_SRC_RESOLVE, + WXS_BASIC_CAST ause, ause->node, + "ref", ref->name, ref->targetNamespace, + XML_SCHEMA_TYPE_ATTRIBUTE, NULL); + return(ctxt->err);; + } + } + return(0); +} + +/** + * xmlSchemaCheckAttrUsePropsCorrect: + * @ctxt: a parser context + * @use: an attribute use + * + * Schema Component Constraint: + * Attribute Use Correct (au-props-correct) + * + */ +static int +xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, + xmlSchemaAttributeUsePtr use) +{ + if ((ctxt == NULL) || (use == NULL)) + return(-1); + if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) || + ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE)) + return(0); + + /* + * SPEC au-props-correct (1) + * "The values of the properties of an attribute use must be as + * described in the property tableau in The Attribute Use Schema + * Component (§3.5.1), modulo the impact of Missing + * Sub-components (§5.3)." + */ + + if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) && + ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) && + ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) + { + xmlSchemaPCustomErr(ctxt, + XML_SCHEMAP_AU_PROPS_CORRECT_2, + WXS_BASIC_CAST use, NULL, + "The attribute declaration has a 'fixed' value constraint " + ", thus the attribute use must also have a 'fixed' value " + "constraint", + NULL); + return(ctxt->err); + } + /* + * Compute and check the value constraint's value. + */ + if ((use->defVal != NULL) && (WXS_ATTRUSE_TYPEDEF(use) != NULL)) { + int ret; + /* + * TODO: The spec seems to be missing a check of the + * value constraint of the attribute use. We will do it here. */ - x = xmlSchemaValueGetNext(x); - if (x != NULL) { - y = xmlSchemaValueGetNext(y); - if (y == NULL) - return (0); - } else if (xmlSchemaValueGetNext(y) != NULL) - return (0); - else - return (1); + /* + * SPEC a-props-correct (3) + */ + if (xmlSchemaIsDerivedFromBuiltInType( + WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) + { + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_AU_PROPS_CORRECT, + NULL, WXS_BASIC_CAST use, + "Value constraints are not allowed if the type definition " + "is or is derived from xs:ID", + NULL, NULL); + return(ctxt->err); + } + + ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST ctxt, + use->node, WXS_ATTRUSE_TYPEDEF(use), + use->defValue, &(use->defVal), + 1, 1, 0); + if (ret != 0) { + if (ret < 0) { + PERROR_INT2("xmlSchemaCheckAttrUsePropsCorrect", + "calling xmlSchemaVCheckCVCSimpleType()"); + return(-1); + } + xmlSchemaCustomErr(ACTXT_CAST ctxt, + XML_SCHEMAP_AU_PROPS_CORRECT, + NULL, WXS_BASIC_CAST use, + "The value of the value constraint is not valid", + NULL, NULL); + return(ctxt->err); + } } - return (0); + /* + * SPEC au-props-correct (2) + * "If the {attribute declaration} has a fixed + * {value constraint}, then if the attribute use itself has a + * {value constraint}, it must also be fixed and its value must match + * that of the {attribute declaration}'s {value constraint}." + */ + if (((WXS_ATTRUSE_DECL(use))->defVal != NULL) && + (((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) + { + if (! xmlSchemaAreValuesEqual(use->defVal, + (WXS_ATTRUSE_DECL(use))->defVal)) + { + xmlSchemaPCustomErr(ctxt, + XML_SCHEMAP_AU_PROPS_CORRECT_2, + WXS_BASIC_CAST use, NULL, + "The 'fixed' value constraint of the attribute use " + "must match the attribute declaration's value " + "constraint '%s'", + (WXS_ATTRUSE_DECL(use))->defValue); + } + return(ctxt->err); + } + return(0); } + + + /** - * xmlSchemaResolveAttrReferences: - * @item: an schema attribute declaration/use. - * @ctxt: a schema parser context - * @name: the name of the attribute + * xmlSchemaResolveAttrTypeReferences: + * @item: an attribute declaration + * @ctxt: a parser context * - * Fixes finish doing the computations on attribute declarations/uses. + * Resolves the referenced type definition component. */ -static void -xmlSchemaResolveAttrReferences(xmlSchemaAttributePtr item, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar * name ATTRIBUTE_UNUSED) +static int +xmlSchemaResolveAttrTypeReferences(xmlSchemaAttributePtr item, + xmlSchemaParserCtxtPtr ctxt) { - /* - * TODO: If including this is done twice (!) for every attribute. - * -> Hmm, check if this is still done. - */ /* * The simple type definition corresponding to the element * information item in the [children], if present, otherwise the simple @@ -18502,85 +20043,32 @@ xmlSchemaResolveAttrReferences(xmlSchemaAttributePtr item, * [attribute], if present, otherwise the ·simple ur-type definition·. */ if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED) - return; + return(0); item->flags |= XML_SCHEMAS_ATTR_INTERNAL_RESOLVED; if (item->subtypes != NULL) - return; + return(0); if (item->typeName != NULL) { xmlSchemaTypePtr type; type = xmlSchemaGetType(ctxt->schema, item->typeName, item->typeNs); - if ((type == NULL) || (! IS_SIMPLE_TYPE(type))) { + if ((type == NULL) || (! WXS_IS_SIMPLE(type))) { xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) item, item->node, + WXS_BASIC_CAST item, item->node, "type", item->typeName, item->typeNs, XML_SCHEMA_TYPE_SIMPLE, NULL); + return(ctxt->err); } else item->subtypes = type; - } else if (item->ref != NULL) { - xmlSchemaAttributePtr decl; - - /* - * We have an attribute use here; assign the referenced - * attribute declaration. - */ + } else { /* - * TODO: Evaluate, what errors could occur if the declaration is not - * found. It might be possible that the "typefixup" might crash if - * no ref declaration was found. + * The type defaults to the xs:anySimpleType. */ - decl = xmlSchemaGetAttributeDecl(ctxt->schema, item->ref, item->refNs); - if (decl == NULL) { - xmlSchemaPResCompAttrErr(ctxt, - XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) item, item->node, - "ref", item->ref, item->refNs, - XML_SCHEMA_TYPE_ATTRIBUTE, NULL); - return; - } - item->refDecl = decl; - xmlSchemaResolveAttrReferences(decl, ctxt, NULL); - item->subtypes = decl->subtypes; - /* - * Attribute Use Correct - * au-props-correct.2: If the {attribute declaration} has a fixed - * {value constraint}, then if the attribute use itself has a - * {value constraint}, it must also be fixed and its value must match - * that of the {attribute declaration}'s {value constraint}. - */ - if ((decl->flags & XML_SCHEMAS_ATTR_FIXED) && - (item->defValue != NULL)) { - if ((item->flags & XML_SCHEMAS_ATTR_FIXED) == 0) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_AU_PROPS_CORRECT_2, - NULL, NULL, item->node, - "The attribute declaration has a 'fixed' value constraint " - ", thus it must be 'fixed' in attribute use as well", - NULL); - } else { - if (! xmlSchemaAreValuesEqual(item->defVal, decl->defVal)) { - xmlSchemaPCustomErr(ctxt, - XML_SCHEMAP_AU_PROPS_CORRECT_2, - NULL, NULL, item->node, - "The 'fixed' value constraint of the attribute use " - "must match the attribute declaration's value " - "constraint '%s'", - decl->defValue); - } - } - /* - * FUTURE: One should change the values of the attr. use - * if ever validation should be attempted even if the - * schema itself was not fully valid. - */ - } - } else { - /* The type of this attribute is the xs:anySimpleType. */ item->subtypes = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); } + return(0); } /** @@ -18590,14 +20078,15 @@ xmlSchemaResolveAttrReferences(xmlSchemaAttributePtr item, * @name: the attribute name * * Resolve keyRef references to key/unique IDCs. + * Schema Component Constraint: + * Identity-constraint Definition Properties Correct (c-props-correct) */ -static void +static int xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc, - xmlSchemaParserCtxtPtr pctxt, - const xmlChar * name ATTRIBUTE_UNUSED) + xmlSchemaParserCtxtPtr pctxt) { if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) - return; + return(0); if (idc->ref->name != NULL) { idc->ref->item = (xmlSchemaBasicItemPtr) xmlSchemaGetIDC(pctxt->schema, idc->ref->name, @@ -18609,11 +20098,22 @@ xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc, */ xmlSchemaPResCompAttrErr(pctxt, XML_SCHEMAP_SRC_RESOLVE, - (xmlSchemaTypePtr) idc, idc->node, + WXS_BASIC_CAST idc, idc->node, "refer", idc->ref->name, idc->ref->targetNamespace, XML_SCHEMA_TYPE_IDC_KEY, NULL); - return; + return(pctxt->err); + } else if (idc->ref->item->type == XML_SCHEMA_TYPE_IDC_KEYREF) { + /* + * SPEC c-props-correct (1) + */ + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_C_PROPS_CORRECT, + NULL, WXS_BASIC_CAST idc, + "The keyref references a keyref", + NULL, NULL); + idc->ref->item = NULL; + return(pctxt->err); } else { if (idc->nbFields != ((xmlSchemaIDCPtr) idc->ref->item)->nbFields) { @@ -18627,20 +20127,417 @@ xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc, * the cardinality of the {fields} must equal that of * the {fields} of the {referenced key}. */ - xmlSchemaPCustomErr(pctxt, + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_C_PROPS_CORRECT, - NULL, (xmlSchemaTypePtr) idc, idc->node, + NULL, WXS_BASIC_CAST idc, "The cardinality of the keyref differs from the " - "cardinality of the referenced key '%s'", + "cardinality of the referenced key/unique '%s'", xmlSchemaFormatQName(&str, refer->targetNamespace, - refer->name) - ); + refer->name), + NULL); FREE_AND_NULL(str) + return(pctxt->err); } } } + return(0); +} + +static int +xmlSchemaResolveAttrUseProhibReferences(xmlSchemaAttributeUseProhibPtr prohib, + xmlSchemaParserCtxtPtr pctxt) +{ + if (xmlSchemaGetAttributeDecl(pctxt->schema, prohib->name, + prohib->targetNamespace) == NULL) { + + xmlSchemaPResCompAttrErr(pctxt, + XML_SCHEMAP_SRC_RESOLVE, + NULL, prohib->node, + "ref", prohib->name, prohib->targetNamespace, + XML_SCHEMA_TYPE_ATTRIBUTE, NULL); + return(XML_SCHEMAP_SRC_RESOLVE); + } + return(0); +} + +#define WXS_REDEFINED_TYPE(c) \ +(((xmlSchemaTypePtr) item)->flags & XML_SCHEMAS_TYPE_REDEFINED) + +#define WXS_REDEFINED_MODEL_GROUP_DEF(c) \ +(((xmlSchemaModelGroupDefPtr) item)->flags & XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED) + +#define WXS_REDEFINED_ATTR_GROUP(c) \ +(((xmlSchemaAttributeGroupPtr) item)->flags & XML_SCHEMAS_ATTRGROUP_REDEFINED) + +static int +xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) +{ + int err = 0; + xmlSchemaRedefPtr redef = WXS_CONSTRUCTOR(pctxt)->redefs; + xmlSchemaBasicItemPtr prev, item; + int wasRedefined; + + if (redef == NULL) + return(0); + + do { + item = redef->item; + /* + * First try to locate the redefined component in the + * schema graph starting with the redefined schema. + * NOTE: According to this schema bug entry: + * http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005OctDec/0019.html + * it's not clear if the referenced component needs to originate + * from the d schema _document_ or the schema; the latter + * would include all imported and included sub-schemas of the + * d schema. Currenlty we latter approach is used. + * SUPPLEMENT: It seems that the WG moves towards the latter + * approach, so we are doing it right. + * + */ + prev = xmlSchemaFindRedefCompInGraph( + redef->targetBucket, item->type, + redef->refName, redef->refTargetNs); + if (prev == NULL) { + xmlChar *str = NULL; + xmlNodePtr node; + + /* + * SPEC src-redefine: + * (6.2.1) "The ·actual value· of its own name attribute plus + * target namespace must successfully ·resolve· to a model + * group definition in I." + * (7.2.1) "The ·actual value· of its own name attribute plus + * target namespace must successfully ·resolve· to an attribute + * group definition in I." + + * + * Note that, if we are redefining with the use of references + * to components, the spec assumes the src-resolve to be used; + * but this won't assure that we search only *inside* the + * redefined schema. + */ + if (redef->reference) + node = WXS_ITEM_NODE(redef->reference); + else + node = WXS_ITEM_NODE(item); + xmlSchemaCustomErr(ACTXT_CAST pctxt, + /* + * TODO: error code. + * Probably XML_SCHEMAP_SRC_RESOLVE, if this is using the + * reference kind. + */ + XML_SCHEMAP_SRC_REDEFINE, node, NULL, + "The %s '%s' to be redefined could not be found in " + "the redefined schema", + WXS_ITEM_TYPE_NAME(item), + xmlSchemaFormatQName(&str, redef->refTargetNs, + redef->refName)); + FREE_AND_NULL(str); + err = pctxt->err; + redef = redef->next; + continue; + } + /* + * TODO: Obtaining and setting the redefinition state is really + * clumsy. + */ + wasRedefined = 0; + switch (item->type) { + case XML_SCHEMA_TYPE_COMPLEX: + case XML_SCHEMA_TYPE_SIMPLE: + if ((WXS_TYPE_CAST prev)->flags & + XML_SCHEMAS_TYPE_REDEFINED) + { + wasRedefined = 1; + break; + } + /* Mark it as redefined. */ + (WXS_TYPE_CAST prev)->flags |= XML_SCHEMAS_TYPE_REDEFINED; + /* + * Assign the redefined type to the + * base type of the redefining type. + * TODO: How + */ + ((xmlSchemaTypePtr) item)->baseType = + (xmlSchemaTypePtr) prev; + break; + case XML_SCHEMA_TYPE_GROUP: + if ((WXS_MODEL_GROUPDEF_CAST prev)->flags & + XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED) + { + wasRedefined = 1; + break; + } + /* Mark it as redefined. */ + (WXS_MODEL_GROUPDEF_CAST prev)->flags |= + XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED; + if (redef->reference != NULL) { + /* + * Overwrite the QName-reference with the + * referenced model group def. + */ + (WXS_PTC_CAST redef->reference)->children = + WXS_TREE_CAST prev; + } + redef->target = prev; + break; + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + if ((WXS_ATTR_GROUP_CAST prev)->flags & + XML_SCHEMAS_ATTRGROUP_REDEFINED) + { + wasRedefined = 1; + break; + } + (WXS_ATTR_GROUP_CAST prev)->flags |= + XML_SCHEMAS_ATTRGROUP_REDEFINED; + if (redef->reference != NULL) { + /* + * Assign the redefined attribute group to the + * QName-reference component. + * This is the easy case, since we will just + * expand the redefined group. + */ + (WXS_QNAME_CAST redef->reference)->item = prev; + redef->target = NULL; + } else { + /* + * This is the complicated case: we need + * to apply src-redefine (7.2.2) at a later + * stage, i.e. when attribute group references + * have beed expanded and simple types have + * beed fixed. + */ + redef->target = prev; + } + break; + default: + PERROR_INT("xmlSchemaResolveRedefReferences", + "Unexpected redefined component type"); + return(-1); + } + if (wasRedefined) { + xmlChar *str = NULL; + xmlNodePtr node; + + if (redef->reference) + node = WXS_ITEM_NODE(redef->reference); + else + node = WXS_ITEM_NODE(redef->item); + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + /* TODO: error code. */ + XML_SCHEMAP_SRC_REDEFINE, + node, NULL, + "The referenced %s was already redefined. Multiple " + "redefinition of the same component is not supported", + xmlSchemaGetComponentDesignation(&str, prev), + NULL); + FREE_AND_NULL(str) + err = pctxt->err; + redef = redef->next; + continue; + } + redef = redef->next; + } while (redef != NULL); + + return(err); +} + +static int +xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) +{ + int err = 0; + xmlSchemaRedefPtr redef = WXS_CONSTRUCTOR(pctxt)->redefs; + xmlSchemaBasicItemPtr item; + + if (redef == NULL) + return(0); + + do { + if (redef->target == NULL) { + redef = redef->next; + continue; + } + item = redef->item; + + switch (item->type) { + case XML_SCHEMA_TYPE_SIMPLE: + case XML_SCHEMA_TYPE_COMPLEX: + /* + * Since the spec wants the {name} of the redefined + * type to be 'absent', we'll NULL it. + */ + (WXS_TYPE_CAST redef->target)->name = NULL; + + /* + * TODO: Seems like there's nothing more to do. The normal + * inheritance mechanism is used. But not 100% sure. + */ + break; + case XML_SCHEMA_TYPE_GROUP: + /* + * URGENT TODO: + * SPEC src-redefine: + * (6.2.2) "The {model group} of the model group definition + * which corresponds to it per XML Representation of Model + * Group Definition Schema Components (§3.7.2) must be a + * ·valid restriction· of the {model group} of that model + * group definition in I, as defined in Particle Valid + * (Restriction) (§3.9.6)." + */ + break; + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + /* + * SPEC src-redefine: + * (7.2.2) "The {attribute uses} and {attribute wildcard} of + * the attribute group definition which corresponds to it + * per XML Representation of Attribute Group Definition Schema + * Components (§3.6.2) must be ·valid restrictions· of the + * {attribute uses} and {attribute wildcard} of that attribute + * group definition in I, as defined in clause 2, clause 3 and + * clause 4 of Derivation Valid (Restriction, Complex) + * (§3.4.6) (where references to the base type definition are + * understood as references to the attribute group definition + * in I)." + */ + err = xmlSchemaCheckDerivationOKRestriction2to4(pctxt, + XML_SCHEMA_ACTION_REDEFINE, + item, redef->target, + (WXS_ATTR_GROUP_CAST item)->attrUses, + (WXS_ATTR_GROUP_CAST redef->target)->attrUses, + (WXS_ATTR_GROUP_CAST item)->attributeWildcard, + (WXS_ATTR_GROUP_CAST redef->target)->attributeWildcard); + if (err == -1) + return(-1); + break; + default: + break; + } + redef = redef->next; + } while (redef != NULL); + return(0); } + + +static int +xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaBucketPtr bucket) +{ + xmlSchemaBasicItemPtr item; + int err; + xmlHashTablePtr *table; + const xmlChar *name; + int i; + +#define WXS_GET_GLOBAL_HASH(c, s, slot) { \ + if (WXS_IS_BUCKET_IMPMAIN((c)->type)) \ + table = &(WXS_IMPBUCKET((c))->schema->slot); \ + else \ + table = &(WXS_INCBUCKET((c))->ownerImport->schema->slot); } + /* + * Add global components to the schema's hash tables. + * This is the place where duplicate components will be + * detected. + * TODO: I think normally we should support imports of the + * same namespace from multiple locations. We don't do currently, + * but if we do then according to: + * http://www.w3.org/Bugs/Public/show_bug.cgi?id=2224 + * we would need, if imported directly, to import redefined + * components as well to be able to catch clashing components. + * (I hope I'll still know what this means after some months :-() + */ + if (bucket == NULL) + return(-1); + if (bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) + return(0); + bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; + + for (i = 0; i < bucket->globals->nbItems; i++) { + item = bucket->globals->items[i]; + table = NULL; + switch (item->type) { + case XML_SCHEMA_TYPE_COMPLEX: + case XML_SCHEMA_TYPE_SIMPLE: + if (WXS_REDEFINED_TYPE(item)) + continue; + name = (WXS_TYPE_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, typeDecl) + break; + case XML_SCHEMA_TYPE_ELEMENT: + name = (WXS_ELEM_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, elemDecl) + break; + case XML_SCHEMA_TYPE_ATTRIBUTE: + name = (WXS_ATTR_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, attrDecl) + break; + case XML_SCHEMA_TYPE_GROUP: + if (WXS_REDEFINED_MODEL_GROUP_DEF(item)) + continue; + name = (WXS_MODEL_GROUPDEF_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, groupDecl) + break; + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + if (WXS_REDEFINED_ATTR_GROUP(item)) + continue; + name = (WXS_ATTR_GROUP_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, attrgrpDecl) + break; + case XML_SCHEMA_TYPE_IDC_KEY: + case XML_SCHEMA_TYPE_IDC_UNIQUE: + case XML_SCHEMA_TYPE_IDC_KEYREF: + name = (WXS_IDC_CAST item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, idcDef) + break; + case XML_SCHEMA_TYPE_NOTATION: + name = ((xmlSchemaNotationPtr) item)->name; + WXS_GET_GLOBAL_HASH(bucket, schema, notaDecl) + break; + default: + PERROR_INT("xmlSchemaAddComponents", + "Unexpected global component type"); + continue; + } + if (*table == NULL) { + *table = xmlHashCreateDict(10, pctxt->dict); + if (*table == NULL) { + PERROR_INT("xmlSchemaAddComponents", + "failed to create a component hash table"); + return(-1); + } + } + err = xmlHashAddEntry(*table, name, item); + if (err != 0) { + xmlChar *str = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_REDEFINED_TYPE, + WXS_ITEM_NODE(item), + WXS_BASIC_CAST item, + "A global %s '%s' does already exist", + WXS_ITEM_TYPE_NAME(item), + xmlSchemaGetComponentQName(&str, item)); + FREE_AND_NULL(str); + } + } + /* + * Process imported/included schemas. + */ + if (bucket->relations != NULL) { + xmlSchemaSchemaRelationPtr rel = bucket->relations; + do { + if ((rel->bucket != NULL) && + ((rel->bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) == 0)) { + if (xmlSchemaAddComponents(pctxt, rel->bucket) == -1) + return(-1); + } + rel = rel->next; + } while (rel != NULL); + } + return(0); +} static int xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) @@ -18653,10 +20550,27 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) if ((con->pending == NULL) || (con->pending->nbItems == 0)) - return(0); + return(0); + + /* TODO: + * SPEC (src-redefine): + * (6.2) "If it has no such self-reference, then all of the + * following must be true:" + + * (6.2.2) The {model group} of the model group definition which + * corresponds to it per XML Representation of Model Group + * Definition Schema Components (§3.7.2) must be a ·valid + * restriction· of the {model group} of that model group definition + * in I, as defined in Particle Valid (Restriction) (§3.9.6)." + */ + xmlSchemaCheckSRCRedefineFirst(pctxt); + + /* + * Add global components to the schemata's hash tables. + */ + xmlSchemaAddComponents(pctxt, WXS_CONSTRUCTOR(pctxt)->mainBucket); pctxt->ctxtType = NULL; - pctxt->parentItem = NULL; items = (xmlSchemaTreeItemPtr *) con->pending->items; nbItems = con->pending->nbItems; /* @@ -18683,6 +20597,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) * - the term of the particle (e.g. a model group) * 6. IDC key-references: * - the referenced IDC 'key' or 'unique' definition + * 7. Attribute prohibitions which had a "ref" attribute. */ for (i = 0; i < nbItems; i++) { item = items[i]; @@ -18695,29 +20610,49 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) case XML_SCHEMA_TYPE_COMPLEX: case XML_SCHEMA_TYPE_SIMPLE: xmlSchemaResolveTypeReferences( - (xmlSchemaTypePtr) item, pctxt, NULL); + (xmlSchemaTypePtr) item, pctxt); FIXHFAILURE; break; case XML_SCHEMA_TYPE_ATTRIBUTE: - xmlSchemaResolveAttrReferences( - (xmlSchemaAttributePtr) item, pctxt, NULL); + xmlSchemaResolveAttrTypeReferences( + (xmlSchemaAttributePtr) item, pctxt); FIXHFAILURE; break; - case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: - xmlSchemaResolveAttrGroupReferences( - (xmlSchemaAttributeGroupPtr) item, pctxt, NULL); + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + xmlSchemaResolveAttrUseReferences( + (xmlSchemaAttributeUsePtr) item, pctxt); + FIXHFAILURE; + break; + case XML_SCHEMA_EXTRA_QNAMEREF: + if ((WXS_QNAME_CAST item)->itemType == + XML_SCHEMA_TYPE_ATTRIBUTEGROUP) + { + xmlSchemaResolveAttrGroupReferences( + WXS_QNAME_CAST item, pctxt); + } FIXHFAILURE; break; - case XML_SCHEMA_TYPE_PARTICLE: - xmlSchemaResolveParticleReferences( - (xmlSchemaTreeItemPtr) item, pctxt, NULL); + case XML_SCHEMA_TYPE_SEQUENCE: + case XML_SCHEMA_TYPE_CHOICE: + case XML_SCHEMA_TYPE_ALL: + xmlSchemaResolveModelGroupParticleReferences(pctxt, + WXS_MODEL_GROUP_CAST item); FIXHFAILURE; break; case XML_SCHEMA_TYPE_IDC_KEY: case XML_SCHEMA_TYPE_IDC_UNIQUE: case XML_SCHEMA_TYPE_IDC_KEYREF: xmlSchemaResolveIDCKeyReferences( - (xmlSchemaIDCPtr) item, pctxt, NULL); + (xmlSchemaIDCPtr) item, pctxt); + FIXHFAILURE; + break; + case XML_SCHEMA_EXTRA_ATTR_USE_PROHIB: + /* + * Handle attribue prohibition which had a + * "ref" attribute. + */ + xmlSchemaResolveAttrUseProhibReferences( + WXS_ATTR_PROHIB_CAST item, pctxt); FIXHFAILURE; break; default: @@ -18767,6 +20702,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) break; } } + if (pctxt->nberrors != 0) + goto exit_error; /* * Model group definition references: * Such a reference is reflected by a particle at the component @@ -18777,26 +20714,39 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) */ for (i = 0; i < nbItems; i++) { item = items[i]; - if ((item->type == XML_SCHEMA_TYPE_PARTICLE) && - (item->children != NULL) && - (item->children->type == XML_SCHEMA_TYPE_GROUP)) { - xmlSchemaGroupDefReferenceTermFixup( - (xmlSchemaParticlePtr) item, pctxt, NULL); - FIXHFAILURE; + switch (item->type) { + case XML_SCHEMA_TYPE_SEQUENCE: + case XML_SCHEMA_TYPE_CHOICE: + xmlSchemaModelGroupToModelGroupDefFixup(pctxt, + WXS_MODEL_GROUP_CAST item); + break; + default: + break; } } if (pctxt->nberrors != 0) goto exit_error; /* - * Now that all references are resolved, no circularity occured - * and the 'term's of particles was fixed we can: - * 1. finish computation of properties of types - * 2. restrict type definitions and check those restrictions - * 3. extend type definitions and check those extensions - * - * This is the most complex part during schema construction. - * TODO: Maybe it would be better to stop at the first error here. + * Expand attribute group references of attribute group definitions. */ + for (i = 0; i < nbItems; i++) { + item = items[i]; + switch (item->type) { + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + if ((! WXS_ATTR_GROUP_EXPANDED(item)) && + WXS_ATTR_GROUP_HAS_REFS(item)) + { + xmlSchemaAttributeGroupExpandRefs(pctxt, + WXS_ATTR_GROUP_CAST item); + FIXHFAILURE; + } + break; + default: + break; + } + } + if (pctxt->nberrors != 0) + goto exit_error; /* * First compute the variety of simple types. This is needed as * a seperate step, since otherwise we won't be able to detect @@ -18806,7 +20756,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: - if (TYPE_IS_NOT_FIXEDUP_1((xmlSchemaTypePtr) item)) { + if (WXS_IS_TYPE_NOT_FIXED_1((xmlSchemaTypePtr) item)) { xmlSchemaFixupSimpleTypeStageOne(pctxt, (xmlSchemaTypePtr) item); FIXHFAILURE; @@ -18816,6 +20766,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) break; } } + if (pctxt->nberrors != 0) + goto exit_error; /* * Detect circular union types. Note that this needs the variety to * be already computed. @@ -18836,14 +20788,56 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) } if (pctxt->nberrors != 0) goto exit_error; - /* Now do the complete type fixup. */ + + /* + * Do the complete type fixup for simple types. + */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: - case XML_SCHEMA_TYPE_COMPLEX: - xmlSchemaTypeFixup((xmlSchemaTypePtr) item, pctxt); + if (WXS_IS_TYPE_NOT_FIXED(WXS_TYPE_CAST item)) { + xmlSchemaFixupSimpleTypeStageTwo(pctxt, WXS_TYPE_CAST item); + FIXHFAILURE; + } + break; + default: + break; + } + } + if (pctxt->nberrors != 0) + goto exit_error; + /* + * At this point we need all simple types to be builded and checked. + */ + /* + * Apply contraints for attribute declarations. + */ + for (i = 0; i < nbItems; i++) { + item = items[i]; + switch (item->type) { + case XML_SCHEMA_TYPE_ATTRIBUTE: + xmlSchemaCheckAttrPropsCorrect(pctxt, WXS_ATTR_CAST item); FIXHFAILURE; + break; + default: + break; + } + } + if (pctxt->nberrors != 0) + goto exit_error; + /* + * Apply constraints for attribute uses. + */ + for (i = 0; i < nbItems; i++) { + item = items[i]; + switch (item->type) { + case XML_SCHEMA_TYPE_ATTRIBUTE_USE: + if (((xmlSchemaAttributeUsePtr)item)->defValue != NULL) { + xmlSchemaCheckAttrUsePropsCorrect(pctxt, + WXS_ATTR_USE_CAST item); + FIXHFAILURE; + } break; default: break; @@ -18851,24 +20845,73 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) } if (pctxt->nberrors != 0) goto exit_error; - + /* - * Now that we are sure the type definitions are finally constructed, - * we can: - * 1. check value contraint values of attribute declarations - * 2. apply various constraints to element declarations + * Apply constraints for attribute group definitions. */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { - case XML_SCHEMA_TYPE_ATTRIBUTE: - if (((xmlSchemaAttributePtr)item)->defValue != NULL) { - xmlSchemaCheckAttrValConstr( - (xmlSchemaAttributePtr) item, pctxt); + case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: + if (( (WXS_ATTR_GROUP_CAST item)->attrUses != NULL) && + ( (WXS_LIST_CAST (WXS_ATTR_GROUP_CAST item)->attrUses)->nbItems > 1)) + { + xmlSchemaCheckAGPropsCorrect(pctxt, WXS_ATTR_GROUP_CAST item); + FIXHFAILURE; + } + break; + default: + break; + } + } + if (pctxt->nberrors != 0) + goto exit_error; + + /* + * Apply constraints for redefinitions. + */ + if (WXS_CONSTRUCTOR(pctxt)->redefs != NULL) + xmlSchemaCheckSRCRedefineSecond(pctxt); + if (pctxt->nberrors != 0) + goto exit_error; + + /* + * Fixup complex types. + */ + for (i = 0; i < nbItems; i++) { + item = con->pending->items[i]; + switch (item->type) { + case XML_SCHEMA_TYPE_COMPLEX: + if (WXS_IS_TYPE_NOT_FIXED(WXS_TYPE_CAST item)) { + xmlSchemaFixupComplexType(pctxt, WXS_TYPE_CAST item); FIXHFAILURE; } break; + default: + break; + } + } + if (pctxt->nberrors != 0) + goto exit_error; + + /* + * The list could have changed, since xmlSchemaFixupComplexType() + * will create particles and model groups in some cases. + */ + items = (xmlSchemaTreeItemPtr *) con->pending->items; + nbItems = con->pending->nbItems; + + /* + * At this point all complex types need to be builded and checked. + */ + /* + * Apply some constraints for element declarations. + */ + for (i = 0; i < nbItems; i++) { + item = items[i]; + switch (item->type) { case XML_SCHEMA_TYPE_ELEMENT: + if ((((xmlSchemaElementPtr) item)->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) { xmlSchemaCheckElementDeclComponent( @@ -18886,12 +20929,13 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) * Finally we can build the automaton from the content model of * complex types. */ + for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_COMPLEX: xmlSchemaBuildContentModel((xmlSchemaTypePtr) item, pctxt); - FIXHFAILURE; + /* FIXHFAILURE; */ break; default: break; @@ -18899,9 +20943,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt) } if (pctxt->nberrors != 0) goto exit_error; - /* - * URGENT TODO: cos-element-consistent, cos-all-limited + * URGENT TODO: cos-element-consistent */ con->pending->nbItems = 0; return(0); @@ -18918,7 +20961,6 @@ exit_failure: * * parse a schema definition resource and build an internal * XML Shema struture which can be used to validate instances. - * *WARNING* this interface is highly subject to change * * Returns the internal XML Schema structure built from the resource or * NULL in case of error @@ -18959,7 +21001,7 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) /* Take ownership of the constructor to be able to free it. */ ctxt->ownsConstructor = 1; } - ctxt->constructor->schema = schema; + ctxt->constructor->mainSchema = schema; /* * Locate and add the schema document. */ @@ -18969,7 +21011,7 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) if (res == -1) goto exit_failure; if (res != 0) - goto exit; + goto exit; if (bucket == NULL) { /* TODO: Error code, actually we failed to *locate* the schema. */ @@ -19060,7 +21102,30 @@ xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt, return; ctxt->error = err; ctxt->warning = warn; - ctxt->userData = ctx; + ctxt->errCtxt = ctx; + if (ctxt->vctxt != NULL) + xmlSchemaSetValidErrors(ctxt->vctxt, err, warn, ctx); +} + +/** + * xmlSchemaSetParserStructuredErrors: + * @ctxt: a schema parser context + * @serror: the structured error function + * @ctx: the functions context + * + * Set the structured error callback + */ +void +xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx) +{ + if (ctxt == NULL) + return; + ctxt->serror = serror; + ctxt->errCtxt = ctx; + if (ctxt->vctxt != NULL) + xmlSchemaSetValidStructuredErrors(ctxt->vctxt, serror, ctx); } /** @@ -19076,8 +21141,8 @@ xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt, */ int xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc * err, - xmlSchemaValidityWarningFunc * warn, void **ctx) + xmlSchemaValidityErrorFunc * err, + xmlSchemaValidityWarningFunc * warn, void **ctx) { if (ctxt == NULL) return(-1); @@ -19086,7 +21151,7 @@ xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, if (warn != NULL) *warn = ctxt->warning; if (ctx != NULL) - *ctx = ctxt->userData; + *ctx = ctxt->errCtxt; return(0); } @@ -19158,14 +21223,14 @@ xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type) */ return(XML_SCHEMA_WHITESPACE_COLLAPSE); } - } else if (VARIETY_LIST(type)) { + } else if (WXS_IS_LIST(type)) { /* * For list types the facet "whiteSpace" is fixed to "collapse". */ return (XML_SCHEMA_WHITESPACE_COLLAPSE); - } else if (VARIETY_UNION(type)) { + } else if (WXS_IS_UNION(type)) { return (XML_SCHEMA_WHITESPACE_UNKNOWN); - } else if (VARIETY_ATOMIC(type)) { + } else if (WXS_IS_ATOMIC(type)) { if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE) return (XML_SCHEMA_WHITESPACE_PRESERVE); else if (type->flags & XML_SCHEMAS_TYPE_WHITESPACE_REPLACE) @@ -19245,7 +21310,7 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, return(ret); if (bucket == NULL) { PERROR_INT("xmlSchemaAssembleByLocation", - "no schema bucket aquired"); + "no schema bucket acquired"); return(-1); } /* @@ -19283,6 +21348,13 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, * no error yet. */ xmlSchemaFixupComponents(pctxt); + ret = pctxt->err; + /* + * Not nice, but we need somehow to channel the schema parser + * error to the validation context. + */ + if ((ret != 0) && (vctxt->err == 0)) + vctxt->err = ret; vctxt->nberrors += pctxt->nberrors; } else { /* Add to validation error sum. */ @@ -19339,11 +21411,15 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt) /* * Parse the value; we will assume an even number of values * to be given (this is how Xerces and XSV work). + * + * URGENT TODO: !! This needs to work for both + * @noNamespaceSchemaLocation AND @schemaLocation on the same + * element !! */ iattr = xmlSchemaGetMetaAttrInfo(vctxt, XML_SCHEMA_ATTR_INFO_META_XSI_SCHEMA_LOC); if (iattr == NULL) - xmlSchemaGetMetaAttrInfo(vctxt, + iattr = xmlSchemaGetMetaAttrInfo(vctxt, XML_SCHEMA_ATTR_INFO_META_XSI_NO_NS_SCHEMA_LOC); if (iattr == NULL) return (0); @@ -19572,7 +21648,7 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, NULL); return; } - aidc->bubbleDepth = -1; + aidc->keyrefDepth = -1; aidc->def = idcDef; aidc->next = NULL; if (vctxt->aidcs == NULL) @@ -19581,6 +21657,12 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, aidc->next = vctxt->aidcs; vctxt->aidcs = aidc; } + /* + * Save if we have keyrefs at all. + */ + if ((vctxt->hasKeyrefs == 0) && + (idcDef->type == XML_SCHEMA_TYPE_IDC_KEYREF)) + vctxt->hasKeyrefs = 1; } /** @@ -19589,7 +21671,7 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, * * Creates a new IDC binding. * - * Returns the new binding in case of succeeded, NULL on internal errors. + * Returns the new IDC binding, NULL on internal errors. */ static xmlSchemaPSVIIDCBindingPtr xmlSchemaIDCNewBinding(xmlSchemaIDCPtr idcDef) @@ -19613,7 +21695,7 @@ xmlSchemaIDCNewBinding(xmlSchemaIDCPtr idcDef) * @vctxt: the WXS validation context * @item: the IDC node table item * - * The validation context is used to store an IDC node table items. + * The validation context is used to store IDC node table items. * They are stored to avoid copying them if IDC node-tables are merged * with corresponding parent IDC node-tables (bubbling). * @@ -19730,7 +21812,7 @@ xmlSchemaIDCAppendNodeTableItem(xmlSchemaPSVIIDCBindingPtr bind, } /** - * xmlSchemaIDCAquireBinding: + * xmlSchemaIDCAcquireBinding: * @vctxt: the WXS validation context * @matcher: the IDC matcher * @@ -19741,22 +21823,22 @@ xmlSchemaIDCAppendNodeTableItem(xmlSchemaPSVIIDCBindingPtr bind, * Returns an IDC binding or NULL on internal errors. */ static xmlSchemaPSVIIDCBindingPtr -xmlSchemaIDCAquireBinding(xmlSchemaValidCtxtPtr vctxt, +xmlSchemaIDCAcquireBinding(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCMatcherPtr matcher) { - xmlSchemaNodeInfoPtr info; + xmlSchemaNodeInfoPtr ielem; - info = vctxt->elemInfos[matcher->depth]; + ielem = vctxt->elemInfos[matcher->depth]; - if (info->idcTable == NULL) { - info->idcTable = xmlSchemaIDCNewBinding(matcher->aidc->def); - if (info->idcTable == NULL) + if (ielem->idcTable == NULL) { + ielem->idcTable = xmlSchemaIDCNewBinding(matcher->aidc->def); + if (ielem->idcTable == NULL) return (NULL); - return(info->idcTable); + return(ielem->idcTable); } else { xmlSchemaPSVIIDCBindingPtr bind = NULL; - bind = info->idcTable; + bind = ielem->idcTable; do { if (bind->definition == matcher->aidc->def) return(bind); @@ -19772,6 +21854,15 @@ xmlSchemaIDCAquireBinding(xmlSchemaValidCtxtPtr vctxt, return (NULL); } +static xmlSchemaItemListPtr +xmlSchemaIDCAcquireTargetList(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED, + xmlSchemaIDCMatcherPtr matcher) +{ + if (matcher->targets == NULL) + matcher->targets = xmlSchemaItemListCreate(); + return(matcher->targets); +} + /** * xmlSchemaIDCFreeKey: * @key: the IDC key @@ -19795,21 +21886,10 @@ xmlSchemaIDCFreeKey(xmlSchemaPSVIIDCKeyPtr key) static void xmlSchemaIDCFreeBinding(xmlSchemaPSVIIDCBindingPtr bind) { - if (bind->nodeTable != NULL) { - if (bind->definition->type == XML_SCHEMA_TYPE_IDC_KEYREF) { - int i; - /* - * Node-table items for keyrefs are not stored globally - * to the validation context, since they are not bubbled. - * We need to free them here. - */ - for (i = 0; i < bind->nbNodes; i++) { - xmlFree(bind->nodeTable[i]->keys); - xmlFree(bind->nodeTable[i]); - } - } + if (bind->nodeTable != NULL) xmlFree(bind->nodeTable); - } + if (bind->dupls != NULL) + xmlSchemaItemListFree(bind->dupls); xmlFree(bind); } @@ -19849,7 +21929,25 @@ xmlSchemaIDCFreeMatcherList(xmlSchemaIDCMatcherPtr matcher) for (i = 0; i < matcher->sizeKeySeqs; i++) if (matcher->keySeqs[i] != NULL) xmlFree(matcher->keySeqs[i]); - xmlFree(matcher->keySeqs); + xmlFree(matcher->keySeqs); + } + if (matcher->targets != NULL) { + if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { + int i; + xmlSchemaPSVIIDCNodePtr idcNode; + /* + * Node-table items for keyrefs are not stored globally + * to the validation context, since they are not bubbled. + * We need to free them here. + */ + for (i = 0; i < matcher->targets->nbItems; i++) { + idcNode = + (xmlSchemaPSVIIDCNodePtr) matcher->targets->items[i]; + xmlFree(idcNode->keys); + xmlFree(idcNode); + } + } + xmlSchemaItemListFree(matcher->targets); } xmlFree(matcher); matcher = next; @@ -19926,7 +22024,7 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, sto->sel = sel; sto->nbHistory = 0; -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: STO push '%s'\n", sto->sel->xpath); #endif @@ -19955,7 +22053,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, if (nodeType == XML_ATTRIBUTE_NODE) depth++; -#if DEBUG_IDC +#ifdef DEBUG_IDC { xmlChar *str = NULL; xmlGenericError(xmlGenericErrorContext, @@ -19971,7 +22069,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, first = vctxt->xpathStates; sto = first; while (sto != head) { -#if DEBUG_IDC +#ifdef DEBUG_IDC if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] selector '%s'\n", sto->matcher->aidc->def->name, sto->sel->xpath); @@ -19996,7 +22094,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, /* * Full match. */ -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: " "MATCH\n"); #endif @@ -20034,7 +22132,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, * Activate state objects for the IDC fields of * the IDC selector. */ -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: " "activating field states\n"); #endif @@ -20049,7 +22147,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, /* * An IDC key node was found by the IDC field. */ -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: key found\n"); #endif @@ -20084,15 +22182,16 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt, int count) { int i, res; - const xmlChar *value = NULL; + xmlChar *value = NULL; *buf = xmlStrdup(BAD_CAST "["); for (i = 0; i < count; i++) { *buf = xmlStrcat(*buf, BAD_CAST "'"); - res = xmlSchemaGetCanonValueWhtsp(seq[i]->val, &value, - xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type)); + res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, + xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type), + &value); if (res == 0) - *buf = xmlStrcat(*buf, value); + *buf = xmlStrcat(*buf, BAD_CAST value); else { VERROR_INT("xmlSchemaFormatIDCKeySequence", "failed to compute a canonical value"); @@ -20103,7 +22202,7 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt, else *buf = xmlStrcat(*buf, BAD_CAST "'"); if (value != NULL) { - xmlFree((xmlChar *) value); + xmlFree(value); value = NULL; } } @@ -20156,13 +22255,13 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCStateObjPtr sto, nextsto; int res, matchDepth; xmlSchemaPSVIIDCKeyPtr key = NULL; - xmlSchemaTypePtr type = vctxt->inode->typeDef; + xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL; if (vctxt->xpathStates == NULL) return (0); sto = vctxt->xpathStates; -#if DEBUG_IDC +#ifdef DEBUG_IDC { xmlChar *str = NULL; xmlGenericError(xmlGenericErrorContext, @@ -20182,7 +22281,7 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, "calling xmlStreamPop()"); return (-1); } -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: stream pop '%s'\n", sto->sel->xpath); #endif @@ -20199,16 +22298,39 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, continue; } if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) { - if (! IS_SIMPLE_TYPE(type)) { + /* + * NOTE: According to + * http://www.w3.org/Bugs/Public/show_bug.cgi?id=2198 + * ... the simple-content of complex types is also allowed. + */ + + if (WXS_IS_COMPLEX(type)) { + if (WXS_HAS_SIMPLE_CONTENT(type)) { + /* + * Sanity check for complex types with simple content. + */ + simpleType = type->contentTypeDef; + if (simpleType == NULL) { + VERROR_INT("xmlSchemaXPathProcessHistory", + "field resolves to a CT with simple content " + "but the CT is missing the ST definition"); + return (-1); + } + } else + simpleType = NULL; + } else + simpleType = type; + if (simpleType == NULL) { xmlChar *str = NULL; + /* * Not qualified if the field resolves to a node of non * simple type. */ xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, - (xmlSchemaTypePtr) sto->matcher->aidc->def, - "The field '%s' of %s does evaluate to a node of " + WXS_BASIC_CAST sto->matcher->aidc->def, + "The XPath '%s' of a field of %s does evaluate to a node of " "non-simple type", sto->sel->xpath, xmlSchemaGetIDCDesignation(&str, sto->matcher->aidc->def)); @@ -20216,13 +22338,14 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, sto->nbHistory--; goto deregister_check; } + if ((key == NULL) && (vctxt->inode->val == NULL)) { /* * Failed to provide the normalized value; maybe * the value was invalid. */ VERROR(XML_SCHEMAV_CVC_IDC, - (xmlSchemaTypePtr) sto->matcher->aidc->def, + WXS_BASIC_CAST sto->matcher->aidc->def, "Warning: No precomputed value available, the value " "was either invalid or something strange happend"); sto->nbHistory--; @@ -20237,6 +22360,18 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, * key-sequences. The position in this list is determined * by the target node's depth relative to the matcher's * depth of creation (i.e. the depth of the scope element). + * + * Element Depth Pos List-entries + * 0 NULL + * 1 NULL + * 2 2 target + * + * + * + * The size of the list is only dependant on the depth of + * the tree. + * An entry will be NULLed in selector_leave, i.e. when + * we hit the target's */ pos = sto->depth - matcher->depth; idx = sto->sel->index; @@ -20289,33 +22424,30 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, keySeq = matcher->keySeqs[pos]; if (keySeq == NULL) { goto create_sequence; - } else { - if (keySeq[idx] != NULL) { - xmlChar *str = NULL; - /* - * cvc-identity-constraint: - * 3 For each node in the ·target node set· all - * of the {fields}, with that node as the context - * node, evaluate to either an empty node-set or - * a node-set with exactly one member, which must - * have a simple type. - * - * The key was already set; report an error. - */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, - XML_SCHEMAV_CVC_IDC, NULL, - (xmlSchemaTypePtr) matcher->aidc->def, - "The field '%s' of %s evaluates to a node-set " - "with more than one member", - sto->sel->xpath, - xmlSchemaGetIDCDesignation(&str, matcher->aidc->def)); - FREE_AND_NULL(str); - sto->nbHistory--; - goto deregister_check; - } else { - goto create_key; - } - } + } else if (keySeq[idx] != NULL) { + xmlChar *str = NULL; + /* + * cvc-identity-constraint: + * 3 For each node in the ·target node set· all + * of the {fields}, with that node as the context + * node, evaluate to either an empty node-set or + * a node-set with exactly one member, which must + * have a simple type. + * + * The key was already set; report an error. + */ + xmlSchemaCustomErr(ACTXT_CAST vctxt, + XML_SCHEMAV_CVC_IDC, NULL, + WXS_BASIC_CAST matcher->aidc->def, + "The XPath '%s' of a field of %s evaluates to a " + "node-set with more than one member", + sto->sel->xpath, + xmlSchemaGetIDCDesignation(&str, matcher->aidc->def)); + FREE_AND_NULL(str); + sto->nbHistory--; + goto deregister_check; + } else + goto create_key; create_sequence: /* @@ -20334,7 +22466,7 @@ create_sequence: matcher->keySeqs[pos] = keySeq; create_key: /* - * Created a key once per node only. + * Create a key once per node only. */ if (key == NULL) { key = (xmlSchemaPSVIIDCKeyPtr) xmlMalloc( @@ -20349,7 +22481,7 @@ create_key: /* * Consume the compiled value. */ - key->type = type; + key->type = simpleType; key->val = vctxt->inode->val; vctxt->inode->val = NULL; /* @@ -20365,10 +22497,11 @@ create_key: } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) { xmlSchemaPSVIIDCKeyPtr **keySeq = NULL; - xmlSchemaPSVIIDCBindingPtr bind; + /* xmlSchemaPSVIIDCBindingPtr bind; */ xmlSchemaPSVIIDCNodePtr ntItem; xmlSchemaIDCMatcherPtr matcher; xmlSchemaIDCPtr idc; + xmlSchemaItemListPtr targets; int pos, i, j, nbKeys; /* * Here we have the following scenario: @@ -20432,9 +22565,12 @@ create_key: * Get the IDC binding from the matcher and check for * duplicate key-sequences. */ - bind = xmlSchemaIDCAquireBinding(vctxt, matcher); +#if 0 + bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); +#endif + targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher); if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && - (bind->nbNodes != 0)) { + (targets->nbItems != 0)) { xmlSchemaPSVIIDCKeyPtr ckey, bkey, *bkeySeq; i = 0; @@ -20443,32 +22579,38 @@ create_key: * Compare the key-sequences, key by key. */ do { - bkeySeq = bind->nodeTable[i]->keys; + bkeySeq = + ((xmlSchemaPSVIIDCNodePtr) targets->items[i])->keys; for (j = 0; j < nbKeys; j++) { ckey = (*keySeq)[j]; bkey = bkeySeq[j]; res = xmlSchemaAreValuesEqual(ckey->val, bkey->val); if (res == -1) { return (-1); - } else if (res == 0) + } else if (res == 0) { + /* + * One of the keys differs, so the key-sequence + * won't be equal; get out. + */ break; + } } if (res == 1) { /* - * Duplicate found. + * Duplicate key-sequence found. */ break; } i++; - } while (i < bind->nbNodes); - if (i != bind->nbNodes) { + } while (i < targets->nbItems); + if (i != targets->nbItems) { xmlChar *str = NULL, *strB = NULL; /* * TODO: Try to report the key-sequence. */ xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, - (xmlSchemaTypePtr) idc, + WXS_BASIC_CAST idc, "Duplicate key-sequence %s in %s", xmlSchemaFormatIDCKeySequence(vctxt, &str, (*keySeq), nbKeys), @@ -20493,7 +22635,7 @@ create_key: memset(ntItem, 0, sizeof(xmlSchemaPSVIIDCNode)); /* - * Store the node-table item on global list. + * Store the node-table item in a global list. */ if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) { if (xmlSchemaIDCStoreNodeTableItem(vctxt, ntItem) == -1) { @@ -20525,7 +22667,10 @@ create_key: ntItem->nodeLine = vctxt->inode->nodeLine; ntItem->keys = *keySeq; *keySeq = NULL; - if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) { +#if 0 + if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) { +#endif + if (xmlSchemaItemListAdd(targets, ntItem) == -1) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) { /* * Free the item, since keyref items won't be @@ -20549,7 +22694,7 @@ selector_key_error: */ xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, - (xmlSchemaTypePtr) idc, + WXS_BASIC_CAST idc, "Not all fields of %s evaluate to a node", xmlSchemaGetIDCDesignation(&str, idc), NULL); FREE_AND_NULL(str); @@ -20571,7 +22716,7 @@ deregister_check: * Deregister state objects if they reach the depth of creation. */ if ((sto->nbHistory == 0) && (sto->depth == depth)) { -#if DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: STO pop '%s'\n", sto->sel->xpath); #endif @@ -20619,7 +22764,7 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, if (idc == NULL) return (0); -#if DEBUG_IDC +#ifdef DEBUG_IDC { xmlChar *str = NULL; xmlGenericError(xmlGenericErrorContext, @@ -20640,13 +22785,17 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, * Since IDCs bubbles are expensive we need to know the * depth at which the bubbles should stop; this will be * the depth of the top-most keyref IDC. If no keyref - * references a key/unique IDC, the bubbleDepth will + * references a key/unique IDC, the keyrefDepth will * be -1, indicating that no bubbles are needed. */ refIdc = (xmlSchemaIDCPtr) idc->ref->item; if (refIdc != NULL) { /* - * Lookup the augmented IDC. + * Remember that we have keyrefs on this node. + */ + vctxt->inode->hasKeyrefs = 1; + /* + * Lookup the referenced augmented IDC info. */ aidc = vctxt->aidcs; while (aidc != NULL) { @@ -20660,9 +22809,9 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, "definition"); return (-1); } - if ((aidc->bubbleDepth == -1) || - (vctxt->depth < aidc->bubbleDepth)) - aidc->bubbleDepth = vctxt->depth; + if ((aidc->keyrefDepth == -1) || + (vctxt->depth < aidc->keyrefDepth)) + aidc->keyrefDepth = vctxt->depth; } } /* @@ -20696,22 +22845,208 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, last->next = matcher; last = matcher; - matcher->type = IDC_MATCHER; - matcher->depth = vctxt->depth; - matcher->aidc = aidc; -#if DEBUG_IDC - xmlGenericError(xmlGenericErrorContext, "IDC: register matcher\n"); -#endif - /* - * Init the automaton state object. - */ - if (xmlSchemaIDCAddStateObject(vctxt, matcher, - idc->selector, XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) == -1) - return (-1); + matcher->type = IDC_MATCHER; + matcher->depth = vctxt->depth; + matcher->aidc = aidc; + matcher->idcType = aidc->def->type; +#ifdef DEBUG_IDC + xmlGenericError(xmlGenericErrorContext, "IDC: register matcher\n"); +#endif + /* + * Init the automaton state object. + */ + if (xmlSchemaIDCAddStateObject(vctxt, matcher, + idc->selector, XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) == -1) + return (-1); + + idc = idc->next; + } while (idc != NULL); + return (0); +} + +static int +xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, + xmlSchemaNodeInfoPtr ielem) +{ + xmlSchemaPSVIIDCBindingPtr bind; + int res, i, j, k, nbTargets, nbFields, nbDupls, nbNodeTable; + xmlSchemaPSVIIDCKeyPtr *keys, *ntkeys; + xmlSchemaPSVIIDCNodePtr *targets, *dupls; + + xmlSchemaIDCMatcherPtr matcher = ielem->idcMatchers; + /* vctxt->createIDCNodeTables */ + while (matcher != NULL) { + /* + * Skip keyref IDCs and empty IDC target-lists. + */ + if ((matcher->aidc->def->type == XML_SCHEMA_TYPE_IDC_KEYREF) || + WXS_ILIST_IS_EMPTY(matcher->targets)) + { + matcher = matcher->next; + continue; + } + /* + * If we _want_ the IDC node-table to be created in any case + * then do so. Otherwise create them only if keyrefs need them. + */ + if ((! vctxt->createIDCNodeTables) && + ((matcher->aidc->keyrefDepth == -1) || + (matcher->aidc->keyrefDepth > vctxt->depth))) + { + matcher = matcher->next; + continue; + } + /* + * Get/create the IDC binding on this element for the IDC definition. + */ + bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); + + if (! WXS_ILIST_IS_EMPTY(bind->dupls)) { + dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items; + nbDupls = bind->dupls->nbItems; + } else { + dupls = NULL; + nbDupls = 0; + } + if (bind->nodeTable != NULL) { + nbNodeTable = bind->nbNodes; + } else { + nbNodeTable = 0; + } + + if ((nbNodeTable == 0) && (nbDupls == 0)) { + /* + * Transfer all IDC target-nodes to the IDC node-table. + */ + bind->nodeTable = + (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + bind->sizeNodes = matcher->targets->sizeItems; + bind->nbNodes = matcher->targets->nbItems; + + matcher->targets->items = NULL; + matcher->targets->sizeItems = 0; + matcher->targets->nbItems = 0; + } else { + /* + * Compare the key-sequences and add to the IDC node-table. + */ + nbTargets = matcher->targets->nbItems; + targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + nbFields = matcher->aidc->def->nbFields; + i = 0; + do { + keys = targets[i]->keys; + if (nbDupls) { + /* + * Search in already found duplicates first. + */ + j = 0; + do { + if (nbFields == 1) { + res = xmlSchemaAreValuesEqual(keys[0]->val, + dupls[j]->keys[0]->val); + if (res == -1) + goto internal_error; + if (res == 1) { + /* + * Equal key-sequence. + */ + goto next_target; + } + } else { + res = 0; + ntkeys = dupls[j]->keys; + for (k = 0; k < nbFields; k++) { + res = xmlSchemaAreValuesEqual(keys[k]->val, + ntkeys[k]->val); + if (res == -1) + goto internal_error; + if (res == 0) { + /* + * One of the keys differs. + */ + break; + } + } + if (res == 1) { + /* + * Equal key-sequence found. + */ + goto next_target; + } + } + j++; + } while (j < nbDupls); + } + if (nbNodeTable) { + j = 0; + do { + if (nbFields == 1) { + res = xmlSchemaAreValuesEqual(keys[0]->val, + bind->nodeTable[j]->keys[0]->val); + if (res == -1) + goto internal_error; + if (res == 0) { + /* + * The key-sequence differs. + */ + goto next_node_table_entry; + } + } else { + res = 0; + ntkeys = bind->nodeTable[j]->keys; + for (k = 0; k < nbFields; k++) { + res = xmlSchemaAreValuesEqual(keys[k]->val, + ntkeys[k]->val); + if (res == -1) + goto internal_error; + if (res == 0) { + /* + * One of the keys differs. + */ + goto next_node_table_entry; + } + } + } + /* + * Add the duplicate to the list of duplicates. + */ + if (bind->dupls == NULL) { + bind->dupls = xmlSchemaItemListCreate(); + if (bind->dupls == NULL) + goto internal_error; + } + if (xmlSchemaItemListAdd(bind->dupls, bind->nodeTable[j]) == -1) + goto internal_error; + /* + * Remove the duplicate entry from the IDC node-table. + */ + bind->nodeTable[j] = bind->nodeTable[bind->nbNodes -1]; + bind->nbNodes--; + + goto next_target; - idc = idc->next; - } while (idc != NULL); - return (0); +next_node_table_entry: + j++; + } while (j < nbNodeTable); + } + /* + * If everything is fine, then add the IDC target-node to + * the IDC node-table. + */ + if (xmlSchemaIDCAppendNodeTableItem(bind, targets[i]) == -1) + goto internal_error; + +next_target: + i++; + } while (i < nbTargets); + } + matcher = matcher->next; + } + return(0); + +internal_error: + return(-1); } /** @@ -20729,26 +23064,11 @@ static int xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) { xmlSchemaPSVIIDCBindingPtr bind; /* IDC bindings of the current node. */ - xmlSchemaPSVIIDCBindingPtr *parTable, parBind = NULL, lastParBind = NULL; /* parent IDC bindings. */ - xmlSchemaPSVIIDCNodePtr node, parNode = NULL; /* node-table entries. */ - xmlSchemaPSVIIDCKeyPtr key, parKey; /* keys of in a key-sequence. */ + xmlSchemaPSVIIDCBindingPtr *parTable, parBind = NULL; /* parent IDC bindings. */ + xmlSchemaPSVIIDCNodePtr node, parNode = NULL, *dupls, *parNodes; /* node-table entries. */ xmlSchemaIDCAugPtr aidc; - int i, j, k, ret = 0, oldNum, newDupls; - int duplTop; + int i, j, k, ret = 0, nbFields, oldNum, oldDupls; - /* - * The node table has the following sections: - * - * O --> old node-table entries (first) - * O - * + --> new node-table entries - * + - * % --> new duplicate node-table entries - * % - * # --> old duplicate node-table entries - * # (last) - * - */ bind = vctxt->inode->idcTable; if (bind == NULL) { /* Fine, no table, no bubbles. */ @@ -20760,136 +23080,160 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * Walk all bindings; create new or add to existing bindings. * Remove duplicate key-sequences. */ -start_binding: while (bind != NULL) { - /* - * Skip keyref IDCs. - */ - if (bind->definition->type == XML_SCHEMA_TYPE_IDC_KEYREF) { - bind = bind->next; - continue; - } + + if ((bind->nbNodes == 0) && WXS_ILIST_IS_EMPTY(bind->dupls)) + goto next_binding; /* * Check if the key/unique IDC table needs to be bubbled. */ - aidc = vctxt->aidcs; - do { - if (aidc->def == bind->definition) { - if ((aidc->bubbleDepth == -1) || - (aidc->bubbleDepth >= vctxt->depth)) { - bind = bind->next; - goto start_binding; + if (! vctxt->createIDCNodeTables) { + aidc = vctxt->aidcs; + do { + if (aidc->def == bind->definition) { + if ((aidc->keyrefDepth == -1) || + (aidc->keyrefDepth >= vctxt->depth)) { + goto next_binding; + } + break; } - break; - } - aidc = aidc->next; - } while (aidc != NULL); + aidc = aidc->next; + } while (aidc != NULL); + } if (parTable != NULL) parBind = *parTable; - while (parBind != NULL) { + /* + * Search a matching parent binding for the + * IDC definition. + */ + while (parBind != NULL) { + if (parBind->definition == bind->definition) + break; + parBind = parBind->next; + } + + if (parBind != NULL) { /* - * Search a matching parent binding for the - * IDC definition. + * Compare every node-table entry of the child node, + * i.e. the key-sequence within, ... */ - if (parBind->definition == bind->definition) { + oldNum = parBind->nbNodes; /* Skip newly added items. */ + if (! WXS_ILIST_IS_EMPTY(parBind->dupls)) { + oldDupls = parBind->dupls->nbItems; + dupls = (xmlSchemaPSVIIDCNodePtr *) parBind->dupls->items; + } else { + dupls = NULL; + oldDupls = 0; + } + + parNodes = parBind->nodeTable; + nbFields = bind->definition->nbFields; + + for (i = 0; i < bind->nbNodes; i++) { + node = bind->nodeTable[i]; + if (node == NULL) + continue; /* - * Compare every node-table entry of the child node, - * i.e. the key-sequence within, ... + * ...with every key-sequence of the parent node, already + * evaluated to be a duplicate key-sequence. */ - oldNum = parBind->nbNodes; /* Skip newly added items. */ - duplTop = oldNum + parBind->nbDupls; - newDupls = 0; - - for (i = 0; i < bind->nbNodes; i++) { - node = bind->nodeTable[i]; - if (node == NULL) - continue; - /* - * ...with every key-sequence of the parent node, already - * evaluated to be a duplicate key-sequence. - */ - if (parBind->nbDupls != 0) { - j = bind->nbNodes + newDupls; - while (j < duplTop) { - parNode = parBind->nodeTable[j]; - for (k = 0; k < bind->definition->nbFields; k++) { - key = node->keys[k]; - parKey = parNode->keys[k]; - ret = xmlSchemaAreValuesEqual(key->val, - parKey->val); - if (ret == -1) { - /* TODO: Internal error */ - return(-1); - } else if (ret == 0) + if (oldDupls) { + j = 0; + while (j < oldDupls) { + if (nbFields == 1) { + ret = xmlSchemaAreValuesEqual( + node->keys[0]->val, + dupls[j]->keys[0]->val); + if (ret == -1) + goto internal_error; + if (ret == 0) { + j++; + continue; + } + } else { + parNode = dupls[j]; + for (k = 0; k < nbFields; k++) { + ret = xmlSchemaAreValuesEqual( + node->keys[k]->val, + parNode->keys[k]->val); + if (ret == -1) + goto internal_error; + if (ret == 0) break; - } - if (ret == 1) - /* Duplicate found. */ - break; - j++; } - if (j != duplTop) { + if (ret == 1) /* Duplicate found. */ - continue; - } - } - /* - * ... and with every key-sequence of the parent node. - */ - j = 0; + break; + j++; + } + if (j != oldDupls) { + /* Duplicate found. Skip this entry. */ + continue; + } + } + /* + * ... and with every key-sequence of the parent node. + */ + if (oldNum) { + j = 0; while (j < oldNum) { - parNode = parBind->nodeTable[j]; - /* - * Compare key by key. - */ - for (k = 0; k < parBind->definition->nbFields; k++) { - key = node->keys[k]; - parKey = parNode->keys[k]; - - ret = xmlSchemaAreValuesEqual(key->val, - parKey->val); - if (ret == -1) { - /* TODO: Internal error */ - } else if (ret == 0) - break; - + parNode = parNodes[j]; + if (nbFields == 1) { + ret = xmlSchemaAreValuesEqual( + node->keys[0]->val, + parNode->keys[0]->val); + if (ret == -1) + goto internal_error; + if (ret == 0) { + j++; + continue; + } + } else { + for (k = 0; k < nbFields; k++) { + ret = xmlSchemaAreValuesEqual( + node->keys[k]->val, + parNode->keys[k]->val); + if (ret == -1) + goto internal_error; + if (ret == 0) + break; + } } if (ret == 1) - /* - * The key-sequences are equal. - */ + /* Duplicate found. */ break; j++; } if (j != oldNum) { /* - * Handle duplicates. - */ - newDupls++; + * Handle duplicates. Move the duplicate in + * the parent's node-table to the list of + * duplicates. + */ oldNum--; parBind->nbNodes--; /* * Move last old item to pos of duplicate. */ - parBind->nodeTable[j] = - parBind->nodeTable[oldNum]; + parNodes[j] = parNodes[oldNum]; if (parBind->nbNodes != oldNum) { /* * If new items exist, move last new item to * last of old items. */ - parBind->nodeTable[oldNum] = - parBind->nodeTable[parBind->nbNodes]; + parNodes[oldNum] = + parNodes[parBind->nbNodes]; } - /* - * Move duplicate to last pos of new/old items. - */ - parBind->nodeTable[parBind->nbNodes] = parNode; - + if (parBind->dupls == NULL) { + parBind->dupls = xmlSchemaItemListCreate(); + if (parBind->dupls == NULL) + goto internal_error; + } + xmlSchemaItemListAdd(parBind->dupls, parNode); } else { /* * Add the node-table entry (node and key-sequence) of @@ -20901,10 +23245,10 @@ start_binding: if (parBind->nodeTable == NULL) { xmlSchemaVErrMemory(NULL, "allocating IDC list of node-table items", NULL); - return(-1); + goto internal_error; } parBind->sizeNodes = 1; - } else if (duplTop >= parBind->sizeNodes) { + } else if (parBind->nbNodes >= parBind->sizeNodes) { parBind->sizeNodes *= 2; parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) xmlRealloc(parBind->nodeTable, parBind->sizeNodes * @@ -20912,71 +23256,94 @@ start_binding: if (parBind->nodeTable == NULL) { xmlSchemaVErrMemory(NULL, "re-allocating IDC list of node-table items", NULL); - return(-1); - } - } - - /* - * Move first old duplicate to last position - * of old duplicates +1. - */ - if (parBind->nbDupls != 0) { - parBind->nodeTable[duplTop] = - parBind->nodeTable[parBind->nbNodes + newDupls]; - } - /* - * Move first new duplicate to last position of - * new duplicates +1. - */ - if (newDupls != 0) { - parBind->nodeTable[parBind->nbNodes + newDupls] = - parBind->nodeTable[parBind->nbNodes]; + goto internal_error; + } } + parNodes = parBind->nodeTable; /* * Append the new node-table entry to the 'new node-table * entries' section. */ - parBind->nodeTable[parBind->nbNodes] = node; - parBind->nbNodes++; - duplTop++; + parNodes[parBind->nbNodes++] = node; } - } - parBind->nbDupls += newDupls; - break; - } - if (parBind->next == NULL) - lastParBind = parBind; - parBind = parBind->next; - } - if ((parBind == NULL) && (bind->nbNodes != 0)) { + + } + + } + } else { /* * No binding for the IDC was found: create a new one and * copy all node-tables. */ parBind = xmlSchemaIDCNewBinding(bind->definition); if (parBind == NULL) - return(-1); - - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) - xmlMalloc(bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); - if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, - "allocating an array of IDC node-table items", NULL); - xmlSchemaIDCFreeBinding(parBind); - return(-1); + goto internal_error; + + /* + * TODO: Hmm, how to optimize the initial number of + * allocated entries? + */ + if (bind->nbNodes != 0) { + /* + * Add all IDC node-table entries. + */ + if (! vctxt->psviExposeIDCNodeTables) { + /* + * Just move the entries. + * NOTE: this is quite save here, since + * all the keyref lookups have already been + * performed. + */ + parBind->nodeTable = bind->nodeTable; + bind->nodeTable = NULL; + parBind->sizeNodes = bind->sizeNodes; + bind->sizeNodes = 0; + parBind->nbNodes = bind->nbNodes; + bind->nbNodes = 0; + } else { + /* + * Copy the entries. + */ + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + xmlMalloc(bind->nbNodes * + sizeof(xmlSchemaPSVIIDCNodePtr)); + if (parBind->nodeTable == NULL) { + xmlSchemaVErrMemory(NULL, + "allocating an array of IDC node-table " + "items", NULL); + xmlSchemaIDCFreeBinding(parBind); + goto internal_error; + } + parBind->sizeNodes = bind->nbNodes; + parBind->nbNodes = bind->nbNodes; + memcpy(parBind->nodeTable, bind->nodeTable, + bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); + } + } + if (bind->dupls) { + /* + * Move the duplicates. + */ + if (parBind->dupls != NULL) + xmlSchemaItemListFree(parBind->dupls); + parBind->dupls = bind->dupls; + bind->dupls = NULL; } - parBind->sizeNodes = bind->nbNodes; - parBind->nbNodes = bind->nbNodes; - memcpy(parBind->nodeTable, bind->nodeTable, - bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); if (*parTable == NULL) *parTable = parBind; - else - lastParBind->next = parBind; - } + else { + parBind->next = *parTable; + *parTable = parBind; + } + } + +next_binding: bind = bind->next; - } + } return (0); + +internal_error: + return(-1); } /** @@ -20989,45 +23356,48 @@ start_binding: static int xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) { - xmlSchemaPSVIIDCBindingPtr refbind, bind; - - refbind = vctxt->inode->idcTable; + xmlSchemaIDCMatcherPtr matcher; + xmlSchemaPSVIIDCBindingPtr bind; + + matcher = vctxt->inode->idcMatchers; /* * Find a keyref. */ - while (refbind != NULL) { - if (refbind->definition->type == XML_SCHEMA_TYPE_IDC_KEYREF) { - int i, j, k, res; + while (matcher != NULL) { + if ((matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) && + matcher->targets && + matcher->targets->nbItems) + { + int i, j, k, res, nbFields, hasDupls; xmlSchemaPSVIIDCKeyPtr *refKeys, *keys; - xmlSchemaPSVIIDCKeyPtr refKey, key; xmlSchemaPSVIIDCNodePtr refNode = NULL; + nbFields = matcher->aidc->def->nbFields; + /* - * Find the referred key/unique. + * Find the IDC node-table for the referenced IDC key/unique. */ bind = vctxt->inode->idcTable; - do { - if ((xmlSchemaIDCPtr) refbind->definition->ref->item == + while (bind != NULL) { + if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == bind->definition) break; bind = bind->next; - } while (bind != NULL); - + } + hasDupls = (bind && bind->dupls && bind->dupls->nbItems) ? 1 : 0; /* * Search for a matching key-sequences. */ - for (i = 0; i < refbind->nbNodes; i++) { + for (i = 0; i < matcher->targets->nbItems; i++) { res = 0; - refNode = refbind->nodeTable[i]; + refNode = matcher->targets->items[i]; if (bind != NULL) { refKeys = refNode->keys; for (j = 0; j < bind->nbNodes; j++) { keys = bind->nodeTable[j]->keys; - for (k = 0; k < bind->definition->nbFields; k++) { - refKey = refKeys[k]; - key = keys[k]; - res = xmlSchemaAreValuesEqual(key->val, - refKey->val); + for (k = 0; k < nbFields; k++) { + res = xmlSchemaAreValuesEqual(keys[k]->val, + refKeys[k]->val); if (res == 0) break; else if (res == -1) { @@ -21041,27 +23411,61 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) break; } } + if ((res == 0) && hasDupls) { + /* + * Search in duplicates + */ + for (j = 0; j < bind->dupls->nbItems; j++) { + keys = ((xmlSchemaPSVIIDCNodePtr) + bind->dupls->items[j])->keys; + for (k = 0; k < nbFields; k++) { + res = xmlSchemaAreValuesEqual(keys[k]->val, + refKeys[k]->val); + if (res == 0) + break; + else if (res == -1) { + return (-1); + } + } + if (res == 1) { + /* + * Match in duplicates found. + */ + xmlChar *str = NULL, *strB = NULL; + xmlSchemaKeyrefErr(vctxt, + XML_SCHEMAV_CVC_IDC, refNode, + (xmlSchemaTypePtr) matcher->aidc->def, + "More than one match found for " + "key-sequence %s of keyref '%s'", + xmlSchemaFormatIDCKeySequence(vctxt, &str, + refNode->keys, nbFields), + xmlSchemaGetComponentQName(&strB, + matcher->aidc->def)); + FREE_AND_NULL(str); + FREE_AND_NULL(strB); + break; + } + } + } } + if (res == 0) { xmlChar *str = NULL, *strB = NULL; xmlSchemaKeyrefErr(vctxt, XML_SCHEMAV_CVC_IDC, refNode, - (xmlSchemaTypePtr) refbind->definition, - "No match found for key-sequence %s of key " - "reference '%s'", + (xmlSchemaTypePtr) matcher->aidc->def, + "No match found for key-sequence %s of keyref '%s'", xmlSchemaFormatIDCKeySequence(vctxt, &str, - refbind->nodeTable[i]->keys, - refbind->definition->nbFields), - xmlSchemaFormatQName(&strB, - refbind->definition->targetNamespace, - refbind->definition->name)); + refNode->keys, nbFields), + xmlSchemaGetComponentQName(&strB, matcher->aidc->def)); FREE_AND_NULL(str); FREE_AND_NULL(strB); } } } - refbind = refbind->next; + matcher = matcher->next; } + /* TODO: Return an error if any error encountered. */ return (0); } @@ -21183,6 +23587,8 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, static void xmlSchemaClearElemInfo(xmlSchemaNodeInfoPtr ielem) { + ielem->hasKeyrefs = 0; + ielem->appliedXPath = 0; if (ielem->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES) { FREE_AND_NULL(ielem->localName); FREE_AND_NULL(ielem->nsName); @@ -21196,14 +23602,24 @@ xmlSchemaClearElemInfo(xmlSchemaNodeInfoPtr ielem) ielem->value = NULL; } if (ielem->val != NULL) { + /* + * PSVI TODO: Be careful not to free it when the value is + * exposed via PSVI. + */ xmlSchemaFreeValue(ielem->val); ielem->val = NULL; } if (ielem->idcMatchers != NULL) { + /* + * URGENT OPTIMIZE TODO: Use a pool of IDC matchers. + */ xmlSchemaIDCFreeMatcherList(ielem->idcMatchers); ielem->idcMatchers = NULL; } if (ielem->idcTable != NULL) { + /* + * OPTIMIZE TODO: Use a pool of IDC tables??. + */ xmlSchemaIDCFreeIDCTable(ielem->idcTable); ielem->idcTable = NULL; } @@ -21328,9 +23744,9 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, if (type->facetSet == NULL) goto pattern_and_enum; - if (! VARIETY_ATOMIC(type)) { - if (VARIETY_LIST(type)) - goto variety_list; + if (! WXS_IS_ATOMIC(type)) { + if (WXS_IS_LIST(type)) + goto WXS_IS_LIST; else goto pattern_and_enum; } @@ -21340,7 +23756,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, */ tmpType = xmlSchemaGetPrimitiveType(type); if ((tmpType->builtInType == XML_SCHEMAS_STRING) || - IS_ANY_SIMPLE_TYPE(tmpType)) { + WXS_IS_ANY_SIMPLE_TYPE(tmpType)) { ws = xmlSchemaGetWhiteSpaceFacetValue(type); } else ws = XML_SCHEMA_WHITESPACE_COLLAPSE; @@ -21393,8 +23809,8 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, ret = 0; } -variety_list: - if (! VARIETY_LIST(type)) +WXS_IS_LIST: + if (! WXS_IS_LIST(type)) goto pattern_and_enum; /* * "length", "minLength" and "maxLength" of list types. @@ -21579,7 +23995,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt, if (nsName == NULL) { ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL, - xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), + WXS_BASIC_CAST xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), "The QName value '%s' has no " "corresponding namespace declaration in " "scope", value, NULL); @@ -21615,7 +24031,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, { int ret = 0, valNeeded = (retVal) ? 1 : 0; xmlSchemaValPtr val = NULL; - xmlSchemaWhitespaceValueType ws; + /* xmlSchemaWhitespaceValueType ws; */ xmlChar *normValue = NULL; #define NORMALIZE(atype) \ @@ -21657,7 +24073,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, valNeeded = 1; if (value == NULL) value = BAD_CAST ""; - if (IS_ANY_SIMPLE_TYPE(type) || VARIETY_ATOMIC(type)) { + if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) { xmlSchemaTypePtr biType; /* The built-in type. */ /* * SPEC (1.2.1) "if {variety} is ·atomic· then the string must ·match· @@ -21700,7 +24116,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, value, &val, valNeeded); break; default: - ws = xmlSchemaGetWhiteSpaceFacetValue(type); + /* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */ if (valNeeded) ret = xmlSchemaValPredefTypeNodeNoNorm(biType, value, &val, NULL); @@ -21717,7 +24133,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, value, &val, valNeeded); break; default: - ws = xmlSchemaGetWhiteSpaceFacetValue(type); + /* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */ if (valNeeded) ret = xmlSchemaValPredefTypeNodeNoNorm(biType, value, &val, node); @@ -21739,7 +24155,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating against a built-in type"); goto internal_error; } - if (VARIETY_LIST(type)) + if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; @@ -21757,7 +24173,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating facets of atomic simple type"); goto internal_error; } - if (VARIETY_LIST(type)) + if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; @@ -21765,7 +24181,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } if (fireErrors && (ret > 0)) xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); - } else if (VARIETY_LIST(type)) { + } else if (WXS_IS_LIST(type)) { xmlSchemaTypePtr itemType; const xmlChar *cur, *end; @@ -21785,7 +24201,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * VAL TODO: Optimize validation of empty values. * VAL TODO: We do not have computed values for lists. */ - itemType = GET_LIST_ITEM_TYPE(type); + itemType = WXS_LIST_ITEMTYPE(type); cur = value; do { while (IS_BLANK_CH(*cur)) @@ -21852,7 +24268,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, NORMALIZE(type); xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); } - } else if (VARIETY_UNION(type)) { + } else if (WXS_IS_UNION(type)) { xmlSchemaTypeLinkPtr memberLink; /* * TODO: For all datatypes ·derived· by ·union· whiteSpace does @@ -21993,7 +24409,7 @@ xmlSchemaVExpandQName(xmlSchemaValidCtxtPtr vctxt, if (*nsName == NULL) { xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, NULL, - xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), + WXS_BASIC_CAST xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), "The QName value '%s' has no " "corresponding namespace declaration in scope", value, NULL); @@ -22055,7 +24471,7 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt, xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_ELT_4_2, NULL, - xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), + WXS_BASIC_CAST xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), "The QName value '%s' of the xsi:type attribute does not " "resolve to a type definition", xmlSchemaFormatQName(&str, nsName, local), NULL); @@ -22081,6 +24497,11 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt, * {disallowed substitutions}: the "block" on the element decl. * {prohibited substitutions}: the "block" on the type def. */ + /* + * OPTIMIZE TODO: We could map types already evaluated + * to be validly derived from other types to avoid checking + * this over and over for the same types. + */ if ((elemDecl->flags & XML_SCHEMAS_ELEM_BLOCK_EXTENSION) || (elemDecl->subtypes->flags & XML_SCHEMAS_TYPE_BLOCK_EXTENSION)) @@ -22091,7 +24512,18 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt, XML_SCHEMAS_TYPE_BLOCK_RESTRICTION)) set |= SUBSET_RESTRICTION; - if (xmlSchemaCheckCOSDerivedOK(*localType, + /* + * REMOVED and CHANGED since this produced a parser context + * which adds to the string dict of the schema. So this would + * change the schema and we don't want this. We don't need + * the parser context anymore. + * + * if ((vctxt->pctxt == NULL) && + * (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1)) + * return (-1); + */ + + if (xmlSchemaCheckCOSDerivedOK(ACTXT_CAST vctxt, *localType, elemDecl->subtypes, set) != 0) { xmlChar *str = NULL; @@ -22122,7 +24554,7 @@ static int xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt) { xmlSchemaElementPtr elemDecl = vctxt->inode->decl; - xmlSchemaTypePtr actualType = ELEM_TYPE(elemDecl); + xmlSchemaTypePtr actualType = WXS_ELEM_TYPEDEF(elemDecl); /* * cvc-elt (3.3.4) : 1 @@ -22318,11 +24750,12 @@ xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt) static int xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) { - xmlSchemaTypePtr type = vctxt->inode->typeDef; - xmlSchemaAttributeLinkPtr attrUseLink; - xmlSchemaAttributePtr attrUse = NULL, attrDecl = NULL; - xmlSchemaAttrInfoPtr attr, tmpAttr; - int i, found, nbAttrs; + xmlSchemaTypePtr type = vctxt->inode->typeDef; + xmlSchemaItemListPtr attrUseList; + xmlSchemaAttributeUsePtr attrUse = NULL; + xmlSchemaAttributePtr attrDecl = NULL; + xmlSchemaAttrInfoPtr iattr, tmpiattr; + int i, j, found, nbAttrs, nbUses; int xpathRes = 0, res, wildIDs = 0, fixed; /* @@ -22343,33 +24776,33 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * noNamespaceSchemaLocation, the appropriate case among the following * must be true: * - */ + */ + attrUseList = (xmlSchemaItemListPtr) type->attrUses; + /* + * @nbAttrs is the number of attributes present in the instance. + */ nbAttrs = vctxt->nbAttrInfos; - for (attrUseLink = type->attributeUses; attrUseLink != NULL; - attrUseLink = attrUseLink->next) { - + if (attrUseList != NULL) + nbUses = attrUseList->nbItems; + else + nbUses = 0; + for (i = 0; i < nbUses; i++) { found = 0; - attrUse = attrUseLink->attr; - /* - * VAL TODO: Implement a real "attribute use" component. - */ - if (attrUse->refDecl != NULL) - attrDecl = attrUse->refDecl; - else - attrDecl = attrUse; - for (i = 0; i < nbAttrs; i++) { - attr = vctxt->attrInfos[i]; + attrUse = attrUseList->items[i]; + attrDecl = WXS_ATTRUSE_DECL(attrUse); + for (j = 0; j < nbAttrs; j++) { + iattr = vctxt->attrInfos[j]; /* * SPEC (cvc-complex-type) (3) * Skip meta attributes. */ - if (attr->metaType) + if (iattr->metaType) continue; - if (attr->localName[0] != attrDecl->name[0]) + if (iattr->localName[0] != attrDecl->name[0]) continue; - if (!xmlStrEqual(attr->localName, attrDecl->name)) + if (!xmlStrEqual(iattr->localName, attrDecl->name)) continue; - if (!xmlStrEqual(attr->nsName, attrDecl->targetNamespace)) + if (!xmlStrEqual(iattr->nsName, attrDecl->targetNamespace)) continue; found = 1; /* @@ -22388,13 +24821,13 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * Assessment (Attribute) (§3.2.4) and * Assessment Outcome (Attribute) (§3.2.5). */ - attr->state = XML_SCHEMAS_ATTR_ASSESSED; - attr->use = attrUse; + iattr->state = XML_SCHEMAS_ATTR_ASSESSED; + iattr->use = attrUse; /* * Context-determined declaration. */ - attr->decl = attrDecl; - attr->typeDef = attrDecl->subtypes; + iattr->decl = attrDecl; + iattr->typeDef = attrDecl->subtypes; break; } @@ -22411,39 +24844,41 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * of the attribute information items in the element information * item's [attributes] as per clause 3.1 above." */ - tmpAttr = xmlSchemaGetFreshAttrInfo(vctxt); - if (tmpAttr == NULL) { + tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt); + if (tmpiattr == NULL) { VERROR_INT( "xmlSchemaVAttributesComplex", "calling xmlSchemaGetFreshAttrInfo()"); return (-1); } - tmpAttr->state = XML_SCHEMAS_ATTR_ERR_MISSING; - tmpAttr->use = attrUse; - tmpAttr->decl = attrDecl; + tmpiattr->state = XML_SCHEMAS_ATTR_ERR_MISSING; + tmpiattr->use = attrUse; + tmpiattr->decl = attrDecl; } else if ((attrUse->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && ((attrUse->defValue != NULL) || (attrDecl->defValue != NULL))) { /* * Handle non-existent, optional, default/fixed attributes. */ - tmpAttr = xmlSchemaGetFreshAttrInfo(vctxt); - if (tmpAttr == NULL) { + tmpiattr = xmlSchemaGetFreshAttrInfo(vctxt); + if (tmpiattr == NULL) { VERROR_INT( "xmlSchemaVAttributesComplex", "calling xmlSchemaGetFreshAttrInfo()"); return (-1); } - tmpAttr->state = XML_SCHEMAS_ATTR_DEFAULT; - tmpAttr->use = attrUse; - tmpAttr->decl = attrDecl; - tmpAttr->typeDef = attrDecl->subtypes; - tmpAttr->localName = attrDecl->name; - tmpAttr->nsName = attrDecl->targetNamespace; + tmpiattr->state = XML_SCHEMAS_ATTR_DEFAULT; + tmpiattr->use = attrUse; + tmpiattr->decl = attrDecl; + tmpiattr->typeDef = attrDecl->subtypes; + tmpiattr->localName = attrDecl->name; + tmpiattr->nsName = attrDecl->targetNamespace; } } + if (vctxt->nbAttrInfos == 0) return (0); + nbUses = vctxt->nbAttrInfos; /* * Validate against the wildcard. */ @@ -22453,12 +24888,12 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * (3.2.1) "There must be an {attribute wildcard}." */ for (i = 0; i < nbAttrs; i++) { - attr = vctxt->attrInfos[i]; + iattr = vctxt->attrInfos[i]; /* * SPEC (cvc-complex-type) (3) * Skip meta attributes. */ - if (attr->state != XML_SCHEMAS_ATTR_UNKNOWN) + if (iattr->state != XML_SCHEMAS_ATTR_UNKNOWN) continue; /* * SPEC (cvc-complex-type) @@ -22471,7 +24906,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * Namespace Name (§3.10.4)." */ if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard, - attr->nsName)) { + iattr->nsName) == 0) { /* * Handle processContents. * @@ -22490,16 +24925,16 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * [validity] = "notKnown" * [validation attempted] = "none" */ - attr->state = XML_SCHEMAS_ATTR_WILD_SKIP; + iattr->state = XML_SCHEMAS_ATTR_WILD_SKIP; continue; } /* * Find an attribute declaration. */ - attr->decl = xmlSchemaGetAttributeDecl(vctxt->schema, - attr->localName, attr->nsName); - if (attr->decl != NULL) { - attr->state = XML_SCHEMAS_ATTR_ASSESSED; + iattr->decl = xmlSchemaGetAttributeDecl(vctxt->schema, + iattr->localName, iattr->nsName); + if (iattr->decl != NULL) { + iattr->state = XML_SCHEMAS_ATTR_ASSESSED; /* * SPEC (cvc-complex-type) * (5) "Let [Definition:] the wild IDs be the set of @@ -22513,16 +24948,16 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * or is derived from ID. Then all of the following * must be true:" */ - attr->typeDef = attr->decl->subtypes; + iattr->typeDef = WXS_ATTR_TYPEDEF(iattr->decl); if (xmlSchemaIsDerivedFromBuiltInType( - attr->typeDef, XML_SCHEMAS_ID)) { + iattr->typeDef, XML_SCHEMAS_ID)) { /* * SPEC (5.1) "There must be no more than one * item in ·wild IDs·." */ if (wildIDs != 0) { /* VAL TODO */ - attr->state = XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID; + iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID; TODO continue; } @@ -22534,34 +24969,32 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * whose {attribute declaration}'s {type definition} * is or is derived from ID." */ - for (attrUseLink = type->attributeUses; - attrUseLink != NULL; - attrUseLink = attrUseLink->next) { + for (j = 0; j < attrUseList->nbItems; j++) { if (xmlSchemaIsDerivedFromBuiltInType( - attrUseLink->attr->subtypes, + WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]), XML_SCHEMAS_ID)) { - /* VAL TODO */ - attr->state = XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID; + /* URGENT VAL TODO: implement */ + iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID; TODO + break; } } } } else if (type->attributeWildcard->processContents == XML_SCHEMAS_ANY_LAX) { - attr->state = XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL; + iattr->state = XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL; /* * SPEC PSVI Assessment Outcome (Attribute) * [validity] = "notKnown" * [validation attempted] = "none" */ } else { - attr->state = XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL; + iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL; } } } } - if (vctxt->nbAttrInfos == 0) return (0); @@ -22569,24 +25002,24 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * Validate values, create default attributes, evaluate IDCs. */ for (i = 0; i < vctxt->nbAttrInfos; i++) { - attr = vctxt->attrInfos[i]; + iattr = vctxt->attrInfos[i]; /* * VAL TODO: Note that we won't try to resolve IDCs to * "lax" and "skip" validated attributes. Check what to * do in this case. */ - if ((attr->state != XML_SCHEMAS_ATTR_ASSESSED) && - (attr->state != XML_SCHEMAS_ATTR_DEFAULT)) + if ((iattr->state != XML_SCHEMAS_ATTR_ASSESSED) && + (iattr->state != XML_SCHEMAS_ATTR_DEFAULT)) continue; /* * VAL TODO: What to do if the type definition is missing? */ - if (attr->typeDef == NULL) { - attr->state = XML_SCHEMAS_ATTR_ERR_NO_TYPE; + if (iattr->typeDef == NULL) { + iattr->state = XML_SCHEMAS_ATTR_ERR_NO_TYPE; continue; } - ACTIVATE_ATTRIBUTE(attr); + ACTIVATE_ATTRIBUTE(iattr); fixed = 0; xpathRes = 0; @@ -22603,30 +25036,30 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) } } - if (attr->state == XML_SCHEMAS_ATTR_DEFAULT) { + if (iattr->state == XML_SCHEMAS_ATTR_DEFAULT) { /* * Default/fixed attributes. */ if (xpathRes) { - if (attr->use->defValue == NULL) { - attr->value = (xmlChar *) attr->use->defValue; - attr->val = attr->use->defVal; + if (iattr->use->defValue != NULL) { + iattr->value = (xmlChar *) iattr->use->defValue; + iattr->val = iattr->use->defVal; } else { - attr->value = (xmlChar *) attr->decl->defValue; - attr->val = attr->decl->defVal; + iattr->value = (xmlChar *) iattr->decl->defValue; + iattr->val = iattr->decl->defVal; } /* * IDCs will consume the precomputed default value, * so we need to clone it. */ - if (attr->val == NULL) { + if (iattr->val == NULL) { VERROR_INT("xmlSchemaVAttributesComplex", "default/fixed value on an attribute use was " "not precomputed"); goto internal_error; } - attr->val = xmlSchemaCopyValue(attr->val); - if (attr->val == NULL) { + iattr->val = xmlSchemaCopyValue(iattr->val); + if (iattr->val == NULL) { VERROR_INT("xmlSchemaVAttributesComplex", "calling xmlSchemaCopyValue()"); goto internal_error; @@ -22638,22 +25071,22 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * uses the *initial* value. */ if ((vctxt->options & XML_SCHEMA_VAL_VC_I_CREATE) && - (attr->node != NULL) && (attr->node->doc != NULL)) { + (iattr->node != NULL) && (iattr->node->doc != NULL)) { xmlChar *normValue; const xmlChar *value; - value = attr->value; + value = iattr->value; /* * Normalize the value. */ - normValue = xmlSchemaNormalizeValue(attr->typeDef, - attr->value); + normValue = xmlSchemaNormalizeValue(iattr->typeDef, + iattr->value); if (normValue != NULL) value = BAD_CAST normValue; - if (attr->nsName == NULL) { - if (xmlNewProp(attr->node->parent, - attr->localName, value) == NULL) { + if (iattr->nsName == NULL) { + if (xmlNewProp(iattr->node->parent, + iattr->localName, value) == NULL) { VERROR_INT("xmlSchemaVAttributesComplex", "callling xmlNewProp()"); if (normValue != NULL) @@ -22663,8 +25096,8 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) } else { xmlNsPtr ns; - ns = xmlSearchNsByHref(attr->node->doc, - attr->node->parent, attr->nsName); + ns = xmlSearchNsByHref(iattr->node->doc, + iattr->node->parent, iattr->nsName); if (ns == NULL) { xmlChar prefix[12]; int counter = 0; @@ -22675,8 +25108,8 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) */ do { snprintf((char *) prefix, 12, "p%d", counter++); - ns = xmlSearchNs(attr->node->doc, - attr->node->parent, BAD_CAST prefix); + ns = xmlSearchNs(iattr->node->doc, + iattr->node->parent, BAD_CAST prefix); if (counter > 1000) { VERROR_INT( "xmlSchemaVAttributesComplex", @@ -22688,10 +25121,16 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) } } while (ns != NULL); ns = xmlNewNs(vctxt->validationRoot, - attr->nsName, BAD_CAST prefix); + iattr->nsName, BAD_CAST prefix); } - xmlNewNsProp(attr->node->parent, ns, - attr->localName, value); + /* + * TODO: + * http://lists.w3.org/Archives/Public/www-xml-schema-comments/2005JulSep/0406.html + * If we have QNames: do we need to ensure there's a + * prefix defined for the QName? + */ + xmlNewNsProp(iattr->node->parent, ns, + iattr->localName, value); } if (normValue != NULL) xmlFree(normValue); @@ -22715,9 +25154,9 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * Note that the attribute *use* can be unavailable, if * the attribute was a wild attribute. */ - if ((attr->decl->flags & XML_SCHEMAS_ATTR_FIXED) || - ((attr->use != NULL) && - (attr->use->flags & XML_SCHEMAS_ATTR_FIXED))) + if ((iattr->decl->flags & XML_SCHEMAS_ATTR_FIXED) || + ((iattr->use != NULL) && + (iattr->use->flags & XML_SCHEMAS_ATTR_FIXED))) fixed = 1; else fixed = 0; @@ -22731,18 +25170,18 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * "normalized attribute value" here? */ if (xpathRes || fixed) { - attr->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED; + iattr->flags |= XML_SCHEMA_NODE_INFO_VALUE_NEEDED; /* * Request a computed value. */ res = xmlSchemaVCheckCVCSimpleType( ACTXT_CAST vctxt, - attr->node, attr->typeDef, attr->value, &(attr->val), + iattr->node, iattr->typeDef, iattr->value, &(iattr->val), 1, 1, 0); } else { res = xmlSchemaVCheckCVCSimpleType( ACTXT_CAST vctxt, - attr->node, attr->typeDef, attr->value, NULL, + iattr->node, iattr->typeDef, iattr->value, NULL, 1, 0, 0); } @@ -22752,7 +25191,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) "calling xmlSchemaStreamValidateSimpleTypeValue()"); goto internal_error; } - attr->state = XML_SCHEMAS_ATTR_INVALID_VALUE; + iattr->state = XML_SCHEMAS_ATTR_INVALID_VALUE; /* * SPEC PSVI Assessment Outcome (Attribute) * [validity] = "invalid" @@ -22760,8 +25199,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) goto eval_idcs; } - if (fixed) { - int ws; + if (fixed) { /* * SPEC Attribute Locally Valid (Use) (cvc-au) * "For an attribute information item to be·valid· @@ -22778,43 +25216,42 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * (4) "The item's *actual* value· must match the *value* of * the {value constraint}, if it is present and fixed." */ - ws = xmlSchemaGetWhiteSpaceFacetValue(attr->typeDef); - if (attr->val == NULL) { + if (iattr->val == NULL) { /* VAL TODO: A value was not precomputed. */ TODO goto eval_idcs; } - if ((attr->use != NULL) && - (attr->use->defValue != NULL)) { - if (attr->use->defVal == NULL) { + if ((iattr->use != NULL) && + (iattr->use->defValue != NULL)) { + if (iattr->use->defVal == NULL) { /* VAL TODO: A default value was not precomputed. */ TODO goto eval_idcs; } - attr->vcValue = attr->use->defValue; + iattr->vcValue = iattr->use->defValue; /* if (xmlSchemaCompareValuesWhtsp(attr->val, (xmlSchemaWhitespaceValueType) ws, attr->use->defVal, (xmlSchemaWhitespaceValueType) ws) != 0) { */ - if (! xmlSchemaAreValuesEqual(attr->val, attr->use->defVal)) - attr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; + if (! xmlSchemaAreValuesEqual(iattr->val, iattr->use->defVal)) + iattr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; } else { - if (attr->decl->defVal == NULL) { + if (iattr->decl->defVal == NULL) { /* VAL TODO: A default value was not precomputed. */ TODO goto eval_idcs; } - attr->vcValue = attr->decl->defValue; + iattr->vcValue = iattr->decl->defValue; /* if (xmlSchemaCompareValuesWhtsp(attr->val, (xmlSchemaWhitespaceValueType) ws, attrDecl->defVal, (xmlSchemaWhitespaceValueType) ws) != 0) { */ - if (! xmlSchemaAreValuesEqual(attr->val, attr->decl->defVal)) - attr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; + if (! xmlSchemaAreValuesEqual(iattr->val, iattr->decl->defVal)) + iattr->state = XML_SCHEMAS_ATTR_ERR_FIXED_VALUE; } /* * [validity] = "valid" @@ -22839,14 +25276,14 @@ eval_idcs: * Report errors. */ for (i = 0; i < vctxt->nbAttrInfos; i++) { - attr = vctxt->attrInfos[i]; - if ((attr->state == XML_SCHEMAS_ATTR_META) || - (attr->state == XML_SCHEMAS_ATTR_ASSESSED) || - (attr->state == XML_SCHEMAS_ATTR_WILD_SKIP) || - (attr->state == XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL)) + iattr = vctxt->attrInfos[i]; + if ((iattr->state == XML_SCHEMAS_ATTR_META) || + (iattr->state == XML_SCHEMAS_ATTR_ASSESSED) || + (iattr->state == XML_SCHEMAS_ATTR_WILD_SKIP) || + (iattr->state == XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL)) continue; - ACTIVATE_ATTRIBUTE(attr); - switch (attr->state) { + ACTIVATE_ATTRIBUTE(iattr); + switch (iattr->state) { case XML_SCHEMAS_ATTR_ERR_MISSING: { xmlChar *str = NULL; ACTIVATE_ELEM; @@ -22854,8 +25291,8 @@ eval_idcs: XML_SCHEMAV_CVC_COMPLEX_TYPE_4, NULL, NULL, "The attribute '%s' is required but missing", xmlSchemaFormatQName(&str, - attr->decl->targetNamespace, - attr->decl->name), + iattr->decl->targetNamespace, + iattr->decl->name), NULL); FREE_AND_NULL(str) break; @@ -22869,7 +25306,7 @@ eval_idcs: XML_SCHEMAV_CVC_AU, NULL, NULL, "The value '%s' does not match the fixed " "value constraint '%s'", - attr->value, attr->vcValue); + iattr->value, iattr->vcValue); break; case XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL: VERROR(XML_SCHEMAV_CVC_WILDCARD, NULL, @@ -22877,7 +25314,7 @@ eval_idcs: "demanded by the strict wildcard"); break; case XML_SCHEMAS_ATTR_UNKNOWN: - if (attr->metaType) + if (iattr->metaType) break; /* * MAYBE VAL TODO: One might report different error messages @@ -22885,10 +25322,10 @@ eval_idcs: */ if (type->attributeWildcard == NULL) { xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt, - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, attr, NULL); + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, iattr, NULL); } else { xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt, - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, attr, NULL); + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, iattr, NULL); } break; default: @@ -22939,7 +25376,7 @@ xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt, } if (wild->processContents == XML_SCHEMAS_ANY_STRICT) { /* VAL TODO: Change to proper error code. */ - VERROR(XML_SCHEMAV_CVC_ELT_1, (xmlSchemaTypePtr) wild, + VERROR(XML_SCHEMAV_CVC_ELT_1, NULL, /* WXS_BASIC_CAST wild */ "No matching global element declaration available, but " "demanded by the strict wildcard"); return (vctxt->err); @@ -22999,7 +25436,7 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, * For a string to be a valid default with respect to a type * definition the appropriate case among the following must be true: */ - if IS_COMPLEX_TYPE(inode->typeDef) { + if WXS_IS_COMPLEX(inode->typeDef) { /* * Complex type. * @@ -23009,9 +25446,9 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, * type}'s particle must be ·emptiable· as defined by * Particle Emptiable (§3.9.6)." */ - if ((! HAS_SIMPLE_CONTENT(inode->typeDef)) && - ((! HAS_MIXED_CONTENT(inode->typeDef)) || - (! IS_PARTICLE_EMPTIABLE(inode->typeDef)))) { + if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) && + ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) || + (! WXS_EMPTIABLE(inode->typeDef)))) { ret = XML_SCHEMAP_COS_VALID_DEFAULT_2_1; /* NOTE that this covers (2.2.2) as well. */ VERROR(ret, NULL, @@ -23032,12 +25469,12 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, * string must be ·valid· with respect to that simple type definition * as defined by String Valid (§3.14.4). */ - if (IS_SIMPLE_TYPE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, NULL, inode->typeDef, value, val, 1, 1, 0); - } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) { + } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, NULL, inode->typeDef->contentTypeDef, value, val, 1, 1, 0); @@ -23224,10 +25661,10 @@ character_content: /* * Speedup if no declaration exists. */ - if (IS_SIMPLE_TYPE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); - } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) { + } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->value); @@ -23260,7 +25697,7 @@ character_content: * defined in Element Default Valid (Immediate) (§3.3.6). */ /* - * NOTE: 'local' above means types aquired by xsi:type. + * NOTE: 'local' above means types acquired by xsi:type. * NOTE: Although the *canonical* value is stated, it is not * relevant if canonical or not. Additionally XML Schema 1.1 * will removed this requirement as well. @@ -23291,10 +25728,10 @@ character_content: * ·actual type definition· as defined by Element Locally Valid (Type) * (§3.3.4). */ - if (IS_SIMPLE_TYPE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->decl->value); - } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) { + } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->decl->value); @@ -23340,7 +25777,7 @@ default_psvi: * to the ·actual type definition· as defined by Element Locally * Valid (Type) (§3.3.4). */ - if (IS_SIMPLE_TYPE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { /* * SPEC (cvc-type) (3.1) * "If the type definition is a simple type definition, ..." @@ -23351,7 +25788,7 @@ default_psvi: */ ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); - } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) { + } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* * SPEC (cvc-type) (3.2) "If the type definition is a complex type * definition, then the element information item must be @@ -23402,7 +25839,7 @@ default_psvi: * 5.2.2.2 The appropriate case among the following must * be true: */ - if (HAS_MIXED_CONTENT(inode->typeDef)) { + if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) { /* * 5.2.2.2.1 If the {content type} of the ·actual type * definition· is mixed, then the *initial value* of the @@ -23427,7 +25864,7 @@ default_psvi: inode->value, inode->decl->value); goto end_elem; } - } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) { + } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* * 5.2.2.2.2 If the {content type} of the ·actual type * definition· is a simple type definition, then the @@ -23466,29 +25903,50 @@ end_elem: /* * Evaluate the history of XPath state objects. */ - if (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1) + if (inode->appliedXPath && + (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) goto internal_error; /* - * TODO: 6 The element information item must be ·valid· with respect to each of - * the {identity-constraint definitions} as per Identity-constraint - * Satisfied (§3.11.4). + * MAYBE TODO: + * SPEC (6) "The element information item must be ·valid· with + * respect to each of the {identity-constraint definitions} as per + * Identity-constraint Satisfied (§3.11.4)." + */ + /* + * PSVI TODO: If we expose IDC node-tables via PSVI then the tables + * need to be built in any case. + * We will currently build IDC node-tables and bubble them only if + * keyrefs do exist. + */ + + /* + * Add the current IDC target-nodes to the IDC node-tables. */ + if ((inode->idcMatchers != NULL) && + (vctxt->hasKeyrefs || vctxt->createIDCNodeTables)) + { + if (xmlSchemaIDCFillNodeTables(vctxt, inode) == -1) + goto internal_error; + } /* * Validate IDC keyrefs. */ - if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1) - goto internal_error; + if (vctxt->inode->hasKeyrefs) + if (xmlSchemaCheckCVCIDCKeyRef(vctxt) == -1) + goto internal_error; /* * Merge/free the IDC table. */ if (inode->idcTable != NULL) { -#ifdef DEBUG_IDC +#ifdef DEBUG_IDC_NODE_TABLE xmlSchemaDebugDumpIDCTable(stdout, inode->nsName, inode->localName, inode->idcTable); #endif - if (vctxt->depth > 0) { + if ((vctxt->depth > 0) && + (vctxt->hasKeyrefs || vctxt->createIDCNodeTables)) + { /* * Merge the IDC node table with the table of the parent node. */ @@ -23511,18 +25969,18 @@ end_elem: return (0); } /* - * Reset the bubbleDepth if needed. + * Reset the keyrefDepth if needed. */ if (vctxt->aidcs != NULL) { xmlSchemaIDCAugPtr aidc = vctxt->aidcs; do { - if (aidc->bubbleDepth == vctxt->depth) { + if (aidc->keyrefDepth == vctxt->depth) { /* - * A bubbleDepth of a key/unique IDC matches the current + * A 'keyrefDepth' of a key/unique IDC matches the current * depth, this means that we are leaving the scope of the - * top-most keyref IDC. + * top-most keyref IDC which refers to this IDC. */ - aidc->bubbleDepth = -1; + aidc->keyrefDepth = -1; } aidc = aidc->next; } while (aidc != NULL); @@ -23727,7 +26185,7 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) case XML_SCHEMA_CONTENT_SIMPLE: case XML_SCHEMA_CONTENT_BASIC: ACTIVATE_PARENT_ELEM - if (IS_COMPLEX_TYPE(ptype)) { + if (WXS_IS_COMPLEX(ptype)) { /* * SPEC (cvc-complex-type) (2.2) * "If the {content type} is a simple type definition, then @@ -23879,7 +26337,9 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, default: break; } - } else { + } else { + if (len < 0) + len = xmlStrlen(value); /* * Concat the value. */ @@ -23909,11 +26369,22 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt) } if (vctxt->xsiAssemble) { /* - * URGENT TODO: Better to fully stop validation - * if there was an error during dynamic schema construction. + * We will stop validation if there was an error during + * dynamic schema construction. + * Note that we simply set @skipDepth to 0, this could + * mean that a streaming document via SAX would be + * still read to the end but it won't be validated any more. + * TODO: If we are sure how to stop the validation at once + * for all input scenarios, then this should be changed to + * instantly stop the validation. */ - if (xmlSchemaAssembleByXSI(vctxt) == -1) - goto internal_error; + ret = xmlSchemaAssembleByXSI(vctxt); + if (ret != 0) { + if (ret == -1) + goto internal_error; + vctxt->skipDepth = 0; + return(ret); + } } if (vctxt->depth > 0) { /* @@ -24025,6 +26496,7 @@ type_validation: */ if (vctxt->xpathStates != NULL) { ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE); + vctxt->inode->appliedXPath = 1; if (ret == -1) { VERROR_INT("xmlSchemaValidateElem", "calling xmlSchemaXPathEvaluate()"); @@ -24034,9 +26506,9 @@ type_validation: /* * Validate attributes. */ - if (IS_COMPLEX_TYPE(vctxt->inode->typeDef)) { + if (WXS_IS_COMPLEX(vctxt->inode->typeDef)) { if ((vctxt->nbAttrInfos != 0) || - (vctxt->inode->typeDef->attributeUses != NULL)) { + (vctxt->inode->typeDef->attrUses != NULL)) { ret = xmlSchemaVAttributesComplex(vctxt); } @@ -24558,12 +27030,19 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) if (vctxt == NULL) return; + /* + * TODO: Should we clear the flags? + * Might be problematic if one reuses the context + * and assumes that the options remain the same. + */ vctxt->flags = 0; vctxt->validationRoot = NULL; vctxt->doc = NULL; #ifdef LIBXML_READER_ENABLED vctxt->reader = NULL; #endif + vctxt->hasKeyrefs = 0; + if (vctxt->value != NULL) { xmlSchemaFreeValue(vctxt->value); vctxt->value = NULL; @@ -24622,6 +27101,10 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) xmlSchemaItemListClear(vctxt->nodeQNames); /* Recreate the dict. */ xmlDictFree(vctxt->dict); + /* + * TODO: Is is save to recreate it? Do we have a scenario + * where the user provides the dict? + */ vctxt->dict = xmlDictCreate(); } @@ -24742,7 +27225,7 @@ xmlSchemaSetValidErrors(xmlSchemaValidCtxtPtr ctxt, return; ctxt->error = err; ctxt->warning = warn; - ctxt->userData = ctx; + ctxt->errCtxt = ctx; if (ctxt->pctxt != NULL) xmlSchemaSetParserErrors(ctxt->pctxt, err, warn, ctx); } @@ -24757,14 +27240,16 @@ xmlSchemaSetValidErrors(xmlSchemaValidCtxtPtr ctxt, */ void xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, void *ctx) + xmlStructuredErrorFunc serror, void *ctx) { if (ctxt == NULL) return; ctxt->serror = serror; ctxt->error = NULL; ctxt->warning = NULL; - ctxt->userData = ctx; + ctxt->errCtxt = ctx; + if (ctxt->pctxt != NULL) + xmlSchemaSetParserStructuredErrors(ctxt->pctxt, serror, ctx); } /** @@ -24780,8 +27265,8 @@ xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, */ int xmlSchemaGetValidErrors(xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc * err, - xmlSchemaValidityWarningFunc * warn, void **ctx) + xmlSchemaValidityErrorFunc * err, + xmlSchemaValidityWarningFunc * warn, void **ctx) { if (ctxt == NULL) return (-1); @@ -24790,7 +27275,7 @@ xmlSchemaGetValidErrors(xmlSchemaValidCtxtPtr ctxt, if (warn != NULL) *warn = ctxt->warning; if (ctx != NULL) - *ctx = ctxt->userData; + *ctx = ctxt->errCtxt; return (0); } @@ -25009,12 +27494,18 @@ static int xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { /* * Some initialization. - */ + */ vctxt->err = 0; vctxt->nberrors = 0; vctxt->depth = -1; vctxt->skipDepth = -1; vctxt->xsiAssemble = 0; + vctxt->hasKeyrefs = 0; +#ifdef ENABLE_IDC_NODE_TABLES_TEST + vctxt->createIDCNodeTables = 1; +#else + vctxt->createIDCNodeTables = 0; +#endif /* * Create a schema + parser if necessary. */ @@ -25045,7 +27536,7 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict); if (pctxt->constructor == NULL) return(-1); - pctxt->constructor->schema = vctxt->schema; + pctxt->constructor->mainSchema = vctxt->schema; /* * Take ownership of the constructor to be able to free it. */ diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 9d99bbb..ffb2505 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -434,9 +434,7 @@ xmlSchemaInitTypes(void) } memset(wild, 0, sizeof(xmlSchemaWildcard)); wild->type = XML_SCHEMA_TYPE_ANY; - wild->any = 1; - wild->minOccurs = 1; - wild->maxOccurs = 1; + wild->any = 1; wild->processContents = XML_SCHEMAS_ANY_LAX; particle->children = (xmlSchemaTreeItemPtr) wild; /* @@ -450,9 +448,7 @@ xmlSchemaInitTypes(void) } memset(wild, 0, sizeof(xmlSchemaWildcard)); wild->any = 1; - wild->processContents = XML_SCHEMAS_ANY_LAX; - wild->minOccurs = 1; - wild->maxOccurs = 1; + wild->processContents = XML_SCHEMAS_ANY_LAX; xmlSchemaTypeAnyTypeDef->attributeWildcard = wild; } xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType", @@ -1700,7 +1696,7 @@ xmlSchemaValidateDates (xmlSchemaValType type, ret = _xmlSchemaParseTimeZone(&(dt->value.date), &cur); if (collapse) while IS_WSP_BLANK_CH(*cur) cur++; - if ((ret != 0) || (*cur != 0) || !VALID_DATETIME((&(dt->value.date)))) + if ((ret != 0) || (*cur != 0) || (!(VALID_DATETIME((&(dt->value.date)))))) goto error; @@ -2248,100 +2244,122 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } case XML_SCHEMAS_DECIMAL:{ const xmlChar *cur = value; - unsigned int len, neg = 0; + unsigned int len, neg, integ, hasLeadingZeroes; xmlChar cval[25]; - xmlChar *cptr = cval; - unsigned int dec = ~0u; + xmlChar *cptr = cval; - if (cur == NULL) + if ((cur == NULL) || (*cur == 0)) goto return1; + /* + * xs:decimal has a whitespace-facet value of 'collapse'. + */ if (normOnTheFly) while IS_WSP_BLANK_CH(*cur) cur++; - /* First we handle an optional sign */ - if (*cur == '+') + /* + * First we handle an optional sign. + */ + neg = 0; + if (*cur == '-') { + neg = 1; cur++; - else if (*cur == '-') { - neg = 1; + } else if (*cur == '+') cur++; - } + /* + * Disallow: "", "-", "- " + */ + if (*cur == 0) + goto return1; /* * Next we "pre-parse" the number, in preparation for calling * the common routine xmlSchemaParseUInt. We get rid of any * leading zeroes (because we have reserved only 25 chars), - * and note the position of any decimal point. + * and note the position of a decimal point. */ len = 0; + integ = ~0u; + hasLeadingZeroes = 0; /* * Skip leading zeroes. */ - while (*cur == '0') + while (*cur == '0') { cur++; + hasLeadingZeroes = 1; + } if (*cur != 0) { - while (len < 24) { + do { if ((*cur >= '0') && (*cur <= '9')) { *cptr++ = *cur++; len++; } else if (*cur == '.') { - if (len == 0) - len++; - if (dec != ~0u) - goto return1; /* multiple decimal points */ cur++; - if ((*cur == 0) && (cur -1 == value)) + integ = len; + do { + if ((*cur >= '0') && (*cur <= '9')) { + *cptr++ = *cur++; + len++; + } else + break; + } while (len < 24); + /* + * Disallow "." but allow "00." + */ + if ((len == 0) && (!hasLeadingZeroes)) goto return1; - - dec = len; - while ((len < 24) && (*cur >= '0') && - (*cur <= '9')) { - *cptr++ = *cur++; - len++; - } break; } else break; - } + } while (len < 24); } if (normOnTheFly) while IS_WSP_BLANK_CH(*cur) cur++; if (*cur != 0) - goto return1; /* error if any extraneous chars */ + goto return1; /* error if any extraneous chars */ if (val != NULL) { v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL); if (v != NULL) { /* - * If a mixed decimal, get rid of trailing zeroes + * Now evaluate the significant digits of the number */ - if (dec != ~0u) { - while ((len > dec) && (cptr > cval) && - (*(cptr-1) == '0')) { - cptr--; - len--; + if (len != 0) { + + if (integ != ~0u) { + /* + * Get rid of trailing zeroes in the + * fractional part. + */ + while ((len != integ) && (*(cptr-1) == '0')) { + cptr--; + len--; + } + } + /* + * Terminate the (preparsed) string. + */ + if (len != 0) { + *cptr = 0; + cptr = cval; + + xmlSchemaParseUInt((const xmlChar **)&cptr, + &v->value.decimal.lo, + &v->value.decimal.mi, + &v->value.decimal.hi); } } - *cptr = 0; /* Terminate our (preparsed) string */ - cptr = cval; - /* - * Now evaluate the significant digits of the number - */ - if (*cptr != 0) - xmlSchemaParseUInt((const xmlChar **)&cptr, - &v->value.decimal.lo, - &v->value.decimal.mi, - &v->value.decimal.hi); /* * Set the total digits to 1 if a zero value. */ - if (len == 0) - len++; v->value.decimal.sign = neg; - if (dec == ~0u) { - v->value.decimal.frac = 0; - v->value.decimal.total = len; + if (len == 0) { + /* Speedup for zero values. */ + v->value.decimal.total = 1; } else { - v->value.decimal.frac = len - dec; v->value.decimal.total = len; + if (integ == ~0u) + v->value.decimal.frac = 0; + else + v->value.decimal.frac = len - integ; } *val = v; } @@ -3406,10 +3424,42 @@ xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaValPtr y) */ integx = x->value.decimal.total - x->value.decimal.frac; integy = y->value.decimal.total - y->value.decimal.frac; + /* + * NOTE: We changed the "total" for values like "0.1" + * (or "-0.1" or ".1") to be 1, which was 2 previously. + * Therefore the special case, when such values are + * compared with 0, needs to be handled separately; + * otherwise a zero would be recognized incorrectly as + * greater than those values. This has the nice side effect + * that we gain an overall optimized comparison with zeroes. + * Note that a "0" has a "total" of 1 already. + */ + if (integx == 1) { + if (x->value.decimal.lo == 0) { + if (integy != 1) + return -order; + else if (y->value.decimal.lo != 0) + return -order; + else + return(0); + } + } + if (integy == 1) { + if (y->value.decimal.lo == 0) { + if (integx != 1) + return order; + else if (x->value.decimal.lo != 0) + return order; + else + return(0); + } + } + if (integx > integy) return order; else if (integy > integx) return -order; + /* * If the number of integral digits is the same for both numbers, * then things get a little more complicated. We need to "normalize" @@ -3763,8 +3813,8 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur) while (1) { if (tempdays < 1) { - long tmon = (long) MODULO_RANGE(r->mon-1, 1, 13); - long tyr = r->year + (long)FQUOTIENT_RANGE(r->mon-1, 1, 13); + long tmon = (long) MODULO_RANGE((int)r->mon-1, 1, 13); + long tyr = r->year + (long)FQUOTIENT_RANGE((int)r->mon-1, 1, 13); if (tyr == 0) tyr--; tempdays += MAX_DAYINMONTH(tyr, tmon); @@ -5377,7 +5427,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, case XML_SCHEMA_FACET_FRACTIONDIGITS: if ((facet->val == NULL) || - ((facet->val->type != XML_SCHEMAS_DECIMAL) && + ((facet->val->type != XML_SCHEMAS_PINTEGER) && (facet->val->type != XML_SCHEMAS_NNINTEGER)) || (facet->val->value.decimal.frac != 0)) { return(-1); diff --git a/xmlstring.c b/xmlstring.c index 67a20b9..4f3b373 100644 --- a/xmlstring.c +++ b/xmlstring.c @@ -147,8 +147,8 @@ xmlStrcmp(const xmlChar *str1, const xmlChar *str2) { * @str1: the first xmlChar * * @str2: the second xmlChar * * - * Check if both string are equal of have same content - * Should be a bit more readable and faster than xmlStrEqual() + * Check if both strings are equal of have same content. + * Should be a bit more readable and faster than xmlStrcmp() * * Returns 1 if they are equal, 0 if they are different */ @@ -437,7 +437,8 @@ xmlStrlen(const xmlChar *str) { * @len: the length of @add * * a strncat for array of xmlChar's, it will extend @cur with the len - * first bytes of @add. + * first bytes of @add. Note that if @len < 0 then this is an API error + * and NULL will be returned. * * Returns a new xmlChar *, the original @cur is reallocated if needed * and should not be freed @@ -450,6 +451,8 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) { if ((add == NULL) || (len == 0)) return(cur); + if (len < 0) + return(NULL); if (cur == NULL) return(xmlStrndup(add, len)); @@ -468,10 +471,11 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) { * xmlStrncatNew: * @str1: first xmlChar string * @str2: second xmlChar string - * @len: the len of @str2 + * @len: the len of @str2 or < 0 * * same as xmlStrncat, but creates a new string. The original - * two strings are not freed. + * two strings are not freed. If @len is < 0 then the length + * will be calculated automatically. * * Returns a new xmlChar * or NULL */ diff --git a/xmlwriter.c b/xmlwriter.c index 6227398..37b7945 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -24,6 +24,25 @@ #define B64LINELEN 72 #define B64CRLF "\r\n" +/* + * The following VA_COPY was coded following an example in + * the Samba project. It may not be sufficient for some + * esoteric implementations of va_list (i.e. it may need + * something involving a memcpy) but (hopefully) will be + * sufficient for libxml2. + */ +#ifndef VA_COPY + #ifdef HAVE_VA_COPY + #define VA_COPY(dest, src) va_copy(dest, src) + #else + #ifdef HAVE___VA_COPY + #define VA_COPY(dest,src) __va_copy(dest, src) + #else + #define VA_COPY(dest,src) (dest) = (src) + #endif + #endif +#endif + /* * Types are kept private */ @@ -80,9 +99,6 @@ static int xmlCmpTextWriterStackEntry(const void *data0, static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1); -static int xmlTextWriterWriteMemCallback(void *context, - const xmlChar * str, int len); -static int xmlTextWriterCloseMemCallback(void *context); static int xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len); static int xmlTextWriterCloseDocCallback(void *context); @@ -256,11 +272,8 @@ xmlNewTextWriterMemory(xmlBufferPtr buf, int compression ATTRIBUTE_UNUSED) xmlOutputBufferPtr out; /*::todo handle compression */ - out = xmlOutputBufferCreateIO((xmlOutputWriteCallback) - xmlTextWriterWriteMemCallback, - (xmlOutputCloseCallback) - xmlTextWriterCloseMemCallback, - (void *) buf, NULL); + out = xmlOutputBufferCreateBuffer(buf, NULL); + if (out == NULL) { xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterMemory : out of memory!\n"); @@ -2842,8 +2855,11 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, if (count < 0) return -1; sum += count; - } else if (writer->indent) { + } else { + if (writer->indent) count = xmlOutputBufferWriteString(writer->out, "\n "); + else + count = xmlOutputBufferWrite(writer->out, 1, " "); if (count < 0) return -1; sum += count; @@ -4274,40 +4290,6 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1) return rc; } -/** - * xmlTextWriterWriteMemCallback: - * @context: the xmlBufferPtr - * @str: the data to write - * @len: the length of the data - * - * Write callback for the xmlOutputBuffer with target xmlBuffer - * - * Returns -1, 0, 1 - */ -static int -xmlTextWriterWriteMemCallback(void *context, const xmlChar * str, int len) -{ - xmlBufferPtr buf = (xmlBufferPtr) context; - - xmlBufferAdd(buf, str, len); - - return len; -} - -/** - * xmlTextWriterCloseMemCallback: - * @context: the xmlBufferPtr - * - * Close callback for the xmlOutputBuffer with target xmlBuffer - * - * Returns -1, 0, 1 - */ -static int -xmlTextWriterCloseMemCallback(void *context ATTRIBUTE_UNUSED) -{ - return 0; -} - /** * xmlTextWriterWriteDocCallback: * @context: the xmlBufferPtr @@ -4373,6 +4355,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) int size; int count; xmlChar *buf; + va_list locarg; size = BUFSIZ; buf = (xmlChar *) xmlMalloc(size); @@ -4382,8 +4365,10 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) return NULL; } - while (((count = vsnprintf((char *) buf, size, format, argptr)) < 0) + VA_COPY(locarg, argptr); + while (((count = vsnprintf((char *) buf, size, format, locarg)) < 0) || (count == size - 1) || (count == size) || (count > size)) { + va_end(locarg); xmlFree(buf); size += BUFSIZ; buf = (xmlChar *) xmlMalloc(size); @@ -4392,7 +4377,9 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } + VA_COPY(locarg, argptr); } + va_end(locarg); return buf; } diff --git a/xpath.c b/xpath.c index f57ba8c..f01b94d 100644 --- a/xpath.c +++ b/xpath.c @@ -64,13 +64,24 @@ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); +/* +* XP_PATTERN_TO_ANY_NODE_ENABLED: when an XPath expression can be +* evaluated using the streaming mode (pattern.c) then this is used to +* enable resolution to nodes of type text-node, cdata-section-node, +* comment-node and pi-node. The only known scenario where this is +* needed is an expression like "foo//.", "//.", etc.; i.e. an expression +* where the final node to be selected can be of any type. +* Disabling this #define will result in an incorrect evaluation to +* only element-nodes and the document node. +*/ +#define XP_PATTERN_TO_ANY_NODE_ENABLED /* * TODO: * There are a few spots where some tests are done which depend upon ascii * data. These should be enhanced for full UTF8 support (see particularly * any use of the macros IS_ASCII_CHARACTER and IS_ASCII_DIGIT) */ - + #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /************************************************************************ * * @@ -808,7 +819,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + + fprintf(output, shift); if (cur == NULL) { fprintf(output, "Object is empty (NULL)\n"); @@ -10998,13 +11010,16 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) static xmlXPathObjectPtr xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp) { int max_depth, min_depth; - int from_root; + int from_root; int ret, depth; +#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED + int eval_all_nodes; +#endif xmlNodePtr cur = NULL, limit = NULL; xmlXPathObjectPtr retval; xmlStreamCtxtPtr patstream; - - int nb_nodes = 0; + + int nb_nodes = 0; if ((ctxt == NULL) || (comp == NULL)) return(NULL); @@ -11082,6 +11097,10 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp) { return(retval); } +#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED + eval_all_nodes = xmlStreamWantsAnyNode(patstream); +#endif + if (from_root) { ret = xmlStreamPush(patstream, NULL, NULL); if (ret < 0) { @@ -11089,34 +11108,53 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp) { xmlXPathNodeSetAddUnique(retval->nodesetval, cur); } } - depth = 0; goto scan_children; do { next_node: nb_nodes++; - if (cur->type == XML_ELEMENT_NODE) { - ret = xmlStreamPush(patstream, cur->name, + + switch (cur->type) { + case XML_ELEMENT_NODE: +#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: +#endif + if (cur->type == XML_ELEMENT_NODE) { + ret = xmlStreamPush(patstream, cur->name, (cur->ns ? cur->ns->href : NULL)); - if (ret < 0) { - } else if (ret == 1) { - xmlXPathNodeSetAddUnique(retval->nodesetval, cur); - } - if ((cur->children == NULL) || (depth >= max_depth)) { - ret = xmlStreamPop(patstream); - while (cur->next != NULL) { - cur = cur->next; - if ((cur->type != XML_ENTITY_DECL) && - (cur->type != XML_DTD_NODE)) - goto next_node; } - } - } +#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED + else if (eval_all_nodes) + ret = xmlStreamPushNode(patstream, NULL, NULL, cur->type); + else + break; +#endif + + if (ret < 0) { + /* NOP. */ + } else if (ret == 1) { + xmlXPathNodeSetAddUnique(retval->nodesetval, cur); + } + if ((cur->children == NULL) || (depth >= max_depth)) { + ret = xmlStreamPop(patstream); + while (cur->next != NULL) { + cur = cur->next; + if ((cur->type != XML_ENTITY_DECL) && + (cur->type != XML_DTD_NODE)) + goto next_node; + } + } + default: + break; + } scan_children: if ((cur->children != NULL) && (depth < max_depth)) { /* - * Do not descend on entities declarations + * Do not descend on entities declarations */ if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; @@ -11144,8 +11182,19 @@ scan_children: depth--; if ((cur == NULL) || (cur == limit)) goto done; - if (cur->type == XML_ELEMENT_NODE) - ret = xmlStreamPop(patstream); + if (cur->type == XML_ELEMENT_NODE) { + ret = xmlStreamPop(patstream); + } +#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED + else if ((eval_all_nodes) && + ((cur->type == XML_TEXT_NODE) || + (cur->type == XML_CDATA_SECTION_NODE) || + (cur->type == XML_COMMENT_NODE) || + (cur->type == XML_PI_NODE))) + { + ret = xmlStreamPop(patstream); + } +#endif if (cur->next != NULL) { cur = cur->next; break; -- cgit v1.2.3