50#pragma convert("ISO8859-1")
56#ifdef LIBXML_SCHEMAS_ENABLED
72#ifdef LIBXML_PATTERN_ENABLED
75#ifdef LIBXML_READER_ENABLED
96 #ifndef DEBUG_IDC_NODE_TABLE
97 #define DEBUG_IDC_NODE_TABLE
103#define ENABLE_REDEFINE
109#define DUMP_CONTENT_MODEL
111#ifdef LIBXML_READER_ENABLED
115#define UNBOUNDED (1 << 30)
117 xmlGenericError(xmlGenericErrorContext, \
118 "Unimplemented block at %s:%d\n", \
121#define XML_SCHEMAS_NO_NAMESPACE (const xmlChar *) "##"
127 "http://www.w3.org/2001/XMLSchema";
130 "http://www.w3.org/2001/XMLSchema-instance";
133 "http://www.w3.org/2000/xmlns/";
138#define ACTXT_CAST (xmlSchemaAbstractCtxtPtr)
139#define PCTXT_CAST (xmlSchemaParserCtxtPtr)
140#define VCTXT_CAST (xmlSchemaValidCtxtPtr)
141#define WXS_BASIC_CAST (xmlSchemaBasicItemPtr)
142#define WXS_TREE_CAST (xmlSchemaTreeItemPtr)
143#define WXS_PTC_CAST (xmlSchemaParticlePtr)
144#define WXS_TYPE_CAST (xmlSchemaTypePtr)
145#define WXS_ELEM_CAST (xmlSchemaElementPtr)
146#define WXS_ATTR_GROUP_CAST (xmlSchemaAttributeGroupPtr)
147#define WXS_ATTR_CAST (xmlSchemaAttributePtr)
148#define WXS_ATTR_USE_CAST (xmlSchemaAttributeUsePtr)
149#define WXS_ATTR_PROHIB_CAST (xmlSchemaAttributeUseProhibPtr)
150#define WXS_MODEL_GROUPDEF_CAST (xmlSchemaModelGroupDefPtr)
151#define WXS_MODEL_GROUP_CAST (xmlSchemaModelGroupPtr)
152#define WXS_IDC_CAST (xmlSchemaIDCPtr)
153#define WXS_QNAME_CAST (xmlSchemaQNameRefPtr)
154#define WXS_LIST_CAST (xmlSchemaItemListPtr)
159#define WXS_ITEM_NODE(i) xmlSchemaGetComponentNode(WXS_BASIC_CAST (i))
161#define WXS_ITEM_TYPE_NAME(i) xmlSchemaGetComponentTypeStr(WXS_BASIC_CAST (i))
165#define WXS_ELEM_TYPEDEF(e) (e)->subtypes
167#define WXS_SUBST_HEAD(item) (item)->refDecl
171#define WXS_ATTR_TYPEDEF(a) (a)->subtypes
175#define WXS_ATTRUSE_DECL(au) (WXS_ATTR_USE_CAST (au))->attrDecl
177#define WXS_ATTRUSE_TYPEDEF(au) WXS_ATTR_TYPEDEF(WXS_ATTRUSE_DECL( WXS_ATTR_USE_CAST au))
179#define WXS_ATTRUSE_DECL_NAME(au) (WXS_ATTRUSE_DECL(au))->name
181#define WXS_ATTRUSE_DECL_TNS(au) (WXS_ATTRUSE_DECL(au))->targetNamespace
185#define WXS_ATTR_GROUP_HAS_REFS(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_HAS_REFS)
186#define WXS_ATTR_GROUP_EXPANDED(ag) ((WXS_ATTR_GROUP_CAST (ag))->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED)
190#define WXS_PARTICLE(p) WXS_PTC_CAST (p)
192#define WXS_PARTICLE_TERM(p) (WXS_PARTICLE(p))->children
194#define WXS_PARTICLE_TERM_AS_ELEM(p) (WXS_ELEM_CAST WXS_PARTICLE_TERM(p))
196#define WXS_PARTICLE_MODEL(p) WXS_MODEL_GROUP_CAST WXS_PARTICLE(p)->children
200#define WXS_MODELGROUPDEF_MODEL(mgd) (WXS_MODEL_GROUP_CAST (mgd))->children
204#define WXS_IS_MODEL_GROUP(i) \
205 (((i)->type == XML_SCHEMA_TYPE_SEQUENCE) || \
206 ((i)->type == XML_SCHEMA_TYPE_CHOICE) || \
207 ((i)->type == XML_SCHEMA_TYPE_ALL))
209#define WXS_MODELGROUP_PARTICLE(mg) WXS_PTC_CAST (mg)->children
213#define WXS_IS_BUCKET_INCREDEF(t) (((t) == XML_SCHEMA_SCHEMA_INCLUDE) || \
214 ((t) == XML_SCHEMA_SCHEMA_REDEFINE))
216#define WXS_IS_BUCKET_IMPMAIN(t) (((t) == XML_SCHEMA_SCHEMA_MAIN) || \
217 ((t) == XML_SCHEMA_SCHEMA_IMPORT))
219#define WXS_IMPBUCKET(b) ((xmlSchemaImportPtr) (b))
221#define WXS_INCBUCKET(b) ((xmlSchemaIncludePtr) (b))
225#define WXS_IS_ANYTYPE(i) \
226 (( (i)->type == XML_SCHEMA_TYPE_BASIC) && \
227 ( (WXS_TYPE_CAST (i))->builtInType == XML_SCHEMAS_ANYTYPE))
229#define WXS_IS_COMPLEX(i) \
230 (((i)->type == XML_SCHEMA_TYPE_COMPLEX) || \
231 ((i)->builtInType == XML_SCHEMAS_ANYTYPE))
233#define WXS_IS_SIMPLE(item) \
234 ((item->type == XML_SCHEMA_TYPE_SIMPLE) || \
235 ((item->type == XML_SCHEMA_TYPE_BASIC) && \
236 (item->builtInType != XML_SCHEMAS_ANYTYPE)))
238#define WXS_IS_ANY_SIMPLE_TYPE(i) \
239 (((i)->type == XML_SCHEMA_TYPE_BASIC) && \
240 ((i)->builtInType == XML_SCHEMAS_ANYSIMPLETYPE))
242#define WXS_IS_RESTRICTION(t) \
243 ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)
245#define WXS_IS_EXTENSION(t) \
246 ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)
248#define WXS_IS_TYPE_NOT_FIXED(i) \
249 (((i)->type != XML_SCHEMA_TYPE_BASIC) && \
250 (((i)->flags & XML_SCHEMAS_TYPE_INTERNAL_RESOLVED) == 0))
252#define WXS_IS_TYPE_NOT_FIXED_1(item) \
253 (((item)->type != XML_SCHEMA_TYPE_BASIC) && \
254 (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0))
256#define WXS_TYPE_IS_GLOBAL(t) ((t)->flags & XML_SCHEMAS_TYPE_GLOBAL)
258#define WXS_TYPE_IS_LOCAL(t) (((t)->flags & XML_SCHEMAS_TYPE_GLOBAL) == 0)
262#define WXS_HAS_COMPLEX_CONTENT(item) \
263 ((item->contentType == XML_SCHEMA_CONTENT_MIXED) || \
264 (item->contentType == XML_SCHEMA_CONTENT_EMPTY) || \
265 (item->contentType == XML_SCHEMA_CONTENT_ELEMENTS))
267#define WXS_HAS_SIMPLE_CONTENT(item) \
268 ((item->contentType == XML_SCHEMA_CONTENT_SIMPLE) || \
269 (item->contentType == XML_SCHEMA_CONTENT_BASIC))
271#define WXS_HAS_MIXED_CONTENT(item) \
272 (item->contentType == XML_SCHEMA_CONTENT_MIXED)
274#define WXS_EMPTIABLE(t) \
275 (xmlSchemaIsParticleEmptiable(WXS_PTC_CAST (t)->subtypes))
277#define WXS_TYPE_CONTENTTYPE(t) (t)->subtypes
279#define WXS_TYPE_PARTICLE(t) WXS_PTC_CAST (t)->subtypes
281#define WXS_TYPE_PARTICLE_TERM(t) WXS_PARTICLE_TERM(WXS_TYPE_PARTICLE(t))
285#define WXS_LIST_ITEMTYPE(t) (t)->subtypes
287#define WXS_IS_ATOMIC(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_ATOMIC)
289#define WXS_IS_LIST(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_LIST)
291#define WXS_IS_UNION(t) (t->flags & XML_SCHEMAS_TYPE_VARIETY_UNION)
295#define WXS_CONSTRUCTOR(ctx) (ctx)->constructor
297#define WXS_HAS_BUCKETS(ctx) \
298( (WXS_CONSTRUCTOR((ctx))->buckets != NULL) && \
299(WXS_CONSTRUCTOR((ctx))->buckets->nbItems > 0) )
301#define WXS_SUBST_GROUPS(ctx) WXS_CONSTRUCTOR((ctx))->substGroups
303#define WXS_BUCKET(ctx) WXS_CONSTRUCTOR((ctx))->bucket
305#define WXS_SCHEMA(ctx) (ctx)->schema
307#define WXS_ADD_LOCAL(ctx, item) \
308 xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item)
310#define WXS_ADD_GLOBAL(ctx, item) \
311 xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item)
313#define WXS_ADD_PENDING(ctx, item) \
314 xmlSchemaAddItemSize(&((ctx)->constructor->pending), 10, item)
318#define WXS_ILIST_IS_EMPTY(l) ((l == NULL) || ((l)->nbItems == 0))
322#define IS_SCHEMA(node, type) \
323 ((node != NULL) && (node->ns != NULL) && \
324 (xmlStrEqual(node->name, (const xmlChar *) type)) && \
325 (xmlStrEqual(node->ns->href, xmlSchemaNs)))
327#define FREE_AND_NULL(str) if ((str) != NULL) { xmlFree((xmlChar *) (str)); str = NULL; }
334#define WXS_ARE_DEFAULT_STR_EQUAL(v1, v2) ((v1) == (v2))
336#define INODE_NILLED(item) (item->flags & XML_SCHEMA_ELEM_INFO_NILLED)
338#define CAN_PARSE_SCHEMA(b) (((b)->doc != NULL) && ((b)->parsed == 0))
340#define HFAILURE if (res == -1) goto exit_failure;
342#define HERROR if (res != 0) goto exit_error;
344#define HSTOP(ctx) if ((ctx)->stop) goto exit;
348#define SUBSET_RESTRICTION 1<<0
349#define SUBSET_EXTENSION 1<<1
350#define SUBSET_SUBSTITUTION 1<<2
351#define SUBSET_LIST 1<<3
352#define SUBSET_UNION 1<<4
354typedef struct _xmlSchemaNodeInfo xmlSchemaNodeInfo;
355typedef xmlSchemaNodeInfo *xmlSchemaNodeInfoPtr;
357typedef struct _xmlSchemaItemList xmlSchemaItemList;
358typedef xmlSchemaItemList *xmlSchemaItemListPtr;
359struct _xmlSchemaItemList {
365#define XML_SCHEMA_CTXT_PARSER 1
366#define XML_SCHEMA_CTXT_VALIDATOR 2
368typedef struct _xmlSchemaAbstractCtxt xmlSchemaAbstractCtxt;
369typedef xmlSchemaAbstractCtxt *xmlSchemaAbstractCtxtPtr;
370struct _xmlSchemaAbstractCtxt {
375typedef struct _xmlSchemaBucket xmlSchemaBucket;
376typedef xmlSchemaBucket *xmlSchemaBucketPtr;
378#define XML_SCHEMA_SCHEMA_MAIN 0
379#define XML_SCHEMA_SCHEMA_IMPORT 1
380#define XML_SCHEMA_SCHEMA_INCLUDE 2
381#define XML_SCHEMA_SCHEMA_REDEFINE 3
388typedef struct _xmlSchemaSchemaRelation xmlSchemaSchemaRelation;
389typedef xmlSchemaSchemaRelation *xmlSchemaSchemaRelationPtr;
390struct _xmlSchemaSchemaRelation {
391 xmlSchemaSchemaRelationPtr
next;
393 const xmlChar *importNamespace;
394 xmlSchemaBucketPtr bucket;
397#define XML_SCHEMA_BUCKET_MARKED 1<<0
398#define XML_SCHEMA_BUCKET_COMPS_ADDED 1<<1
400struct _xmlSchemaBucket {
404 const xmlChar *origTargetNamespace;
405 const xmlChar *targetNamespace;
407 xmlSchemaSchemaRelationPtr relations;
412 xmlSchemaItemListPtr globals;
413 xmlSchemaItemListPtr locals;
424typedef struct _xmlSchemaImport xmlSchemaImport;
425typedef xmlSchemaImport *xmlSchemaImportPtr;
426struct _xmlSchemaImport {
431 const xmlChar *origTargetNamespace;
436 const xmlChar *targetNamespace;
439 xmlSchemaSchemaRelationPtr relations;
444 xmlSchemaItemListPtr globals;
445 xmlSchemaItemListPtr locals;
453typedef struct _xmlSchemaInclude xmlSchemaInclude;
454typedef xmlSchemaInclude *xmlSchemaIncludePtr;
455struct _xmlSchemaInclude {
459 const xmlChar *origTargetNamespace;
460 const xmlChar *targetNamespace;
462 xmlSchemaSchemaRelationPtr relations;
467 xmlSchemaItemListPtr globals;
468 xmlSchemaItemListPtr locals;
471 xmlSchemaImportPtr ownerImport;
479typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
480typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
481struct _xmlSchemaBasicItem {
482 xmlSchemaTypeType
type;
492typedef struct _xmlSchemaAnnotItem xmlSchemaAnnotItem;
493typedef xmlSchemaAnnotItem *xmlSchemaAnnotItemPtr;
494struct _xmlSchemaAnnotItem {
495 xmlSchemaTypeType
type;
496 xmlSchemaAnnotPtr annot;
505typedef struct _xmlSchemaTreeItem xmlSchemaTreeItem;
506typedef xmlSchemaTreeItem *xmlSchemaTreeItemPtr;
507struct _xmlSchemaTreeItem {
508 xmlSchemaTypeType
type;
509 xmlSchemaAnnotPtr annot;
510 xmlSchemaTreeItemPtr
next;
511 xmlSchemaTreeItemPtr children;
515#define XML_SCHEMA_ATTR_USE_FIXED 1<<0
522typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
523typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
524struct _xmlSchemaAttributeUse {
525 xmlSchemaTypeType
type;
526 xmlSchemaAnnotPtr annot;
527 xmlSchemaAttributeUsePtr
next;
532 xmlSchemaAttributePtr attrDecl;
538 xmlSchemaValPtr defVal;
547typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
548typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
549struct _xmlSchemaAttributeUseProhib {
550 xmlSchemaTypeType
type;
553 const xmlChar *targetNamespace;
560typedef struct _xmlSchemaRedef xmlSchemaRedef;
561typedef xmlSchemaRedef *xmlSchemaRedefPtr;
562struct _xmlSchemaRedef {
563 xmlSchemaRedefPtr
next;
564 xmlSchemaBasicItemPtr
item;
566 xmlSchemaBasicItemPtr
target;
570 xmlSchemaBucketPtr targetBucket;
576typedef struct _xmlSchemaConstructionCtxt xmlSchemaConstructionCtxt;
577typedef xmlSchemaConstructionCtxt *xmlSchemaConstructionCtxtPtr;
578struct _xmlSchemaConstructionCtxt {
579 xmlSchemaPtr mainSchema;
580 xmlSchemaBucketPtr mainBucket;
582 xmlSchemaItemListPtr buckets;
584 xmlSchemaBucketPtr bucket;
585 xmlSchemaItemListPtr pending;
588 xmlSchemaRedefPtr redefs;
589 xmlSchemaRedefPtr lastRedef;
592#define XML_SCHEMAS_PARSE_ERROR 1
593#define SCHEMAS_PARSE_OPTIONS XML_PARSE_NOENT
595struct _xmlSchemaParserCtxt {
598 xmlSchemaValidityErrorFunc
error;
599 xmlSchemaValidityWarningFunc
warning;
604 xmlSchemaConstructionCtxtPtr constructor;
624 xmlAutomataStatePtr
start;
625 xmlAutomataStatePtr
end;
626 xmlAutomataStatePtr
state;
629 xmlSchemaTypePtr ctxtType;
631 xmlSchemaValidCtxtPtr vctxt;
636 const xmlChar *targetNamespace;
637 xmlSchemaBucketPtr redefined;
639 xmlSchemaRedefPtr redef;
641 xmlSchemaItemListPtr attrProhibs;
650typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
651typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
652struct _xmlSchemaQNameRef {
653 xmlSchemaTypeType
type;
654 xmlSchemaBasicItemPtr
item;
655 xmlSchemaTypeType itemType;
657 const xmlChar *targetNamespace;
667typedef struct _xmlSchemaParticle xmlSchemaParticle;
668typedef xmlSchemaParticle *xmlSchemaParticlePtr;
669struct _xmlSchemaParticle {
670 xmlSchemaTypeType
type;
671 xmlSchemaAnnotPtr annot;
672 xmlSchemaTreeItemPtr
next;
673 xmlSchemaTreeItemPtr children;
687typedef struct _xmlSchemaModelGroup xmlSchemaModelGroup;
688typedef xmlSchemaModelGroup *xmlSchemaModelGroupPtr;
689struct _xmlSchemaModelGroup {
690 xmlSchemaTypeType
type;
691 xmlSchemaAnnotPtr annot;
692 xmlSchemaTreeItemPtr
next;
693 xmlSchemaTreeItemPtr children;
697#define XML_SCHEMA_MODEL_GROUP_DEF_MARKED 1<<0
698#define XML_SCHEMA_MODEL_GROUP_DEF_REDEFINED 1<<1
705typedef struct _xmlSchemaModelGroupDef xmlSchemaModelGroupDef;
706typedef xmlSchemaModelGroupDef *xmlSchemaModelGroupDefPtr;
707struct _xmlSchemaModelGroupDef {
708 xmlSchemaTypeType
type;
709 xmlSchemaAnnotPtr annot;
710 xmlSchemaTreeItemPtr
next;
711 xmlSchemaTreeItemPtr children;
713 const xmlChar *targetNamespace;
718typedef struct _xmlSchemaIDC xmlSchemaIDC;
719typedef xmlSchemaIDC *xmlSchemaIDCPtr;
727typedef struct _xmlSchemaIDCSelect xmlSchemaIDCSelect;
728typedef xmlSchemaIDCSelect *xmlSchemaIDCSelectPtr;
729struct _xmlSchemaIDCSelect {
730 xmlSchemaIDCSelectPtr
next;
744struct _xmlSchemaIDC {
745 xmlSchemaTypeType
type;
746 xmlSchemaAnnotPtr annot;
747 xmlSchemaIDCPtr
next;
750 const xmlChar *targetNamespace;
751 xmlSchemaIDCSelectPtr selector;
752 xmlSchemaIDCSelectPtr
fields;
754 xmlSchemaQNameRefPtr
ref;
762typedef struct _xmlSchemaIDCAug xmlSchemaIDCAug;
763typedef xmlSchemaIDCAug *xmlSchemaIDCAugPtr;
764struct _xmlSchemaIDCAug {
765 xmlSchemaIDCAugPtr
next;
776typedef struct _xmlSchemaPSVIIDCKey xmlSchemaPSVIIDCKey;
777typedef xmlSchemaPSVIIDCKey *xmlSchemaPSVIIDCKeyPtr;
778struct _xmlSchemaPSVIIDCKey {
779 xmlSchemaTypePtr
type;
788typedef struct _xmlSchemaPSVIIDCNode xmlSchemaPSVIIDCNode;
789typedef xmlSchemaPSVIIDCNode *xmlSchemaPSVIIDCNodePtr;
790struct _xmlSchemaPSVIIDCNode {
792 xmlSchemaPSVIIDCKeyPtr *keys;
803typedef struct _xmlSchemaPSVIIDCBinding xmlSchemaPSVIIDCBinding;
804typedef xmlSchemaPSVIIDCBinding *xmlSchemaPSVIIDCBindingPtr;
805struct _xmlSchemaPSVIIDCBinding {
806 xmlSchemaPSVIIDCBindingPtr
next;
807 xmlSchemaIDCPtr definition;
808 xmlSchemaPSVIIDCNodePtr *nodeTable;
811 xmlSchemaItemListPtr dupls;
815#define XPATH_STATE_OBJ_TYPE_IDC_SELECTOR 1
816#define XPATH_STATE_OBJ_TYPE_IDC_FIELD 2
818#define XPATH_STATE_OBJ_MATCHES -2
819#define XPATH_STATE_OBJ_BLOCKED -3
821typedef struct _xmlSchemaIDCMatcher xmlSchemaIDCMatcher;
822typedef xmlSchemaIDCMatcher *xmlSchemaIDCMatcherPtr;
829typedef struct _xmlSchemaIDCStateObj xmlSchemaIDCStateObj;
830typedef xmlSchemaIDCStateObj *xmlSchemaIDCStateObjPtr;
831struct _xmlSchemaIDCStateObj {
833 xmlSchemaIDCStateObjPtr
next;
838 xmlSchemaIDCMatcherPtr matcher;
840 xmlSchemaIDCSelectPtr sel;
851struct _xmlSchemaIDCMatcher {
854 xmlSchemaIDCMatcherPtr
next;
855 xmlSchemaIDCMatcherPtr nextCached;
856 xmlSchemaIDCAugPtr aidc;
858 xmlSchemaPSVIIDCKeyPtr **keySeqs;
861 xmlSchemaItemListPtr targets;
869#define XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES 1<<0
870#define XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES 1<<1
871#define XML_SCHEMA_ELEM_INFO_NILLED 1<<2
872#define XML_SCHEMA_ELEM_INFO_LOCAL_TYPE 1<<3
874#define XML_SCHEMA_NODE_INFO_VALUE_NEEDED 1<<4
875#define XML_SCHEMA_ELEM_INFO_EMPTY 1<<5
876#define XML_SCHEMA_ELEM_INFO_HAS_CONTENT 1<<6
878#define XML_SCHEMA_ELEM_INFO_HAS_ELEM_CONTENT 1<<7
879#define XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT 1<<8
880#define XML_SCHEMA_NODE_INFO_ERR_NOT_EXPECTED 1<<9
881#define XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE 1<<10
888struct _xmlSchemaNodeInfo {
896 xmlSchemaTypePtr typeDef;
903 xmlSchemaElementPtr decl;
905 xmlSchemaPSVIIDCBindingPtr idcTable;
907 xmlSchemaIDCMatcherPtr idcMatchers;
909 xmlRegExecCtxtPtr regexCtxt;
919#define XML_SCHEMAS_ATTR_UNKNOWN 1
920#define XML_SCHEMAS_ATTR_ASSESSED 2
921#define XML_SCHEMAS_ATTR_PROHIBITED 3
922#define XML_SCHEMAS_ATTR_ERR_MISSING 4
923#define XML_SCHEMAS_ATTR_INVALID_VALUE 5
924#define XML_SCHEMAS_ATTR_ERR_NO_TYPE 6
925#define XML_SCHEMAS_ATTR_ERR_FIXED_VALUE 7
926#define XML_SCHEMAS_ATTR_DEFAULT 8
927#define XML_SCHEMAS_ATTR_VALIDATE_VALUE 9
928#define XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL 10
929#define XML_SCHEMAS_ATTR_HAS_ATTR_USE 11
930#define XML_SCHEMAS_ATTR_HAS_ATTR_DECL 12
931#define XML_SCHEMAS_ATTR_WILD_SKIP 13
932#define XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL 14
933#define XML_SCHEMAS_ATTR_ERR_WILD_DUPLICATE_ID 15
934#define XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID 16
935#define XML_SCHEMAS_ATTR_META 17
939#define XML_SCHEMA_ATTR_INFO_META_XSI_TYPE 1
940#define XML_SCHEMA_ATTR_INFO_META_XSI_NIL 2
941#define XML_SCHEMA_ATTR_INFO_META_XSI_SCHEMA_LOC 3
942#define XML_SCHEMA_ATTR_INFO_META_XSI_NO_NS_SCHEMA_LOC 4
943#define XML_SCHEMA_ATTR_INFO_META_XMLNS 5
945typedef struct _xmlSchemaAttrInfo xmlSchemaAttrInfo;
946typedef xmlSchemaAttrInfo *xmlSchemaAttrInfoPtr;
947struct _xmlSchemaAttrInfo {
955 xmlSchemaTypePtr typeDef;
958 xmlSchemaAttributePtr decl;
959 xmlSchemaAttributeUsePtr use;
963 xmlSchemaNodeInfoPtr
parent;
967#define XML_SCHEMA_VALID_CTXT_FLAG_STREAM 1
973struct _xmlSchemaValidCtxt {
976 xmlSchemaValidityErrorFunc
error;
977 xmlSchemaValidityWarningFunc
warning;
996 xmlRegExecCtxtPtr regexp;
997 xmlSchemaValPtr
value;
1002 xmlSchemaParserCtxtPtr pctxt;
1006 xmlSchemaNodeInfoPtr *elemInfos;
1008 xmlSchemaNodeInfoPtr
inode;
1010 xmlSchemaIDCAugPtr aidcs;
1012 xmlSchemaIDCStateObjPtr xpathStates;
1013 xmlSchemaIDCStateObjPtr xpathStatePool;
1014 xmlSchemaIDCMatcherPtr idcMatcherCache;
1016 xmlSchemaPSVIIDCNodePtr *idcNodes;
1020 xmlSchemaPSVIIDCKeyPtr *idcKeys;
1028#ifdef LIBXML_READER_ENABLED
1032 xmlSchemaAttrInfoPtr *attrInfos;
1037 xmlSchemaItemListPtr nodeQNames;
1039 int createIDCNodeTables;
1040 int psviExposeIDCNodeTables;
1043 xmlSchemaValidityLocatorFunc locFunc;
1052typedef struct _xmlSchemaSubstGroup xmlSchemaSubstGroup;
1053typedef xmlSchemaSubstGroup *xmlSchemaSubstGroupPtr;
1054struct _xmlSchemaSubstGroup {
1055 xmlSchemaElementPtr
head;
1056 xmlSchemaItemListPtr members;
1064typedef struct _xmlIDCHashEntry xmlIDCHashEntry;
1065typedef xmlIDCHashEntry *xmlIDCHashEntryPtr;
1066struct _xmlIDCHashEntry {
1067 xmlIDCHashEntryPtr
next;
1077static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt,
1080static int xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr ctxt,
1084xmlSchemaTypeFixup(xmlSchemaTypePtr
type,
1085 xmlSchemaAbstractCtxtPtr ctxt);
1087xmlSchemaFacetTypeToString(xmlSchemaTypeType
type);
1089xmlSchemaParseImport(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr
schema,
1092xmlSchemaCheckFacetValues(xmlSchemaTypePtr typeDecl,
1093 xmlSchemaParserCtxtPtr ctxt);
1095xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt);
1096static xmlSchemaWhitespaceValueType
1097xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr
type);
1098static xmlSchemaTreeItemPtr
1099xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr
schema,
1103xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr
item);
1104static xmlSchemaTypeLinkPtr
1105xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr
type);
1107xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt,
1108 const char *funcName,
1111xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr ctxt,
1112 xmlSchemaTypePtr
type,
1113 xmlSchemaTypePtr baseType,
1116xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl,
1117 xmlSchemaParserCtxtPtr ctxt);
1119xmlSchemaComponentListFree(xmlSchemaItemListPtr
list);
1120static xmlSchemaQNameRefPtr
1121xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt,
1138xmlSchemaItemTypeToStr(xmlSchemaTypeType
type)
1141 case XML_SCHEMA_TYPE_BASIC:
1142 return(
BAD_CAST "simple type definition");
1143 case XML_SCHEMA_TYPE_SIMPLE:
1144 return(
BAD_CAST "simple type definition");
1145 case XML_SCHEMA_TYPE_COMPLEX:
1146 return(
BAD_CAST "complex type definition");
1147 case XML_SCHEMA_TYPE_ELEMENT:
1148 return(
BAD_CAST "element declaration");
1149 case XML_SCHEMA_TYPE_ATTRIBUTE_USE:
1151 case XML_SCHEMA_TYPE_ATTRIBUTE:
1152 return(
BAD_CAST "attribute declaration");
1153 case XML_SCHEMA_TYPE_GROUP:
1154 return(
BAD_CAST "model group definition");
1155 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1156 return(
BAD_CAST "attribute group definition");
1157 case XML_SCHEMA_TYPE_NOTATION:
1158 return(
BAD_CAST "notation declaration");
1159 case XML_SCHEMA_TYPE_SEQUENCE:
1160 return(
BAD_CAST "model group (sequence)");
1161 case XML_SCHEMA_TYPE_CHOICE:
1162 return(
BAD_CAST "model group (choice)");
1163 case XML_SCHEMA_TYPE_ALL:
1164 return(
BAD_CAST "model group (all)");
1165 case XML_SCHEMA_TYPE_PARTICLE:
1167 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1168 return(
BAD_CAST "unique identity-constraint");
1170 case XML_SCHEMA_TYPE_IDC_KEY:
1171 return(
BAD_CAST "key identity-constraint");
1173 case XML_SCHEMA_TYPE_IDC_KEYREF:
1174 return(
BAD_CAST "keyref identity-constraint");
1176 case XML_SCHEMA_TYPE_ANY:
1178 case XML_SCHEMA_EXTRA_QNAMEREF:
1179 return(
BAD_CAST "[helper component] QName reference");
1180 case XML_SCHEMA_EXTRA_ATTR_USE_PROHIB:
1181 return(
BAD_CAST "[helper component] attribute use prohibition");
1183 return(
BAD_CAST "Not a schema component");
1194xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr
item)
1196 switch (
item->type) {
1197 case XML_SCHEMA_TYPE_BASIC:
1198 if (WXS_IS_COMPLEX(WXS_TYPE_CAST
item))
1199 return(
BAD_CAST "complex type definition");
1201 return(
BAD_CAST "simple type definition");
1203 return(xmlSchemaItemTypeToStr(
item->type));
1218xmlSchemaGetComponentNode(xmlSchemaBasicItemPtr
item)
1220 switch (
item->type) {
1221 case XML_SCHEMA_TYPE_ELEMENT:
1222 return (((xmlSchemaElementPtr)
item)->
node);
1223 case XML_SCHEMA_TYPE_ATTRIBUTE:
1224 return (((xmlSchemaAttributePtr)
item)->
node);
1225 case XML_SCHEMA_TYPE_COMPLEX:
1226 case XML_SCHEMA_TYPE_SIMPLE:
1227 return (((xmlSchemaTypePtr)
item)->
node);
1228 case XML_SCHEMA_TYPE_ANY:
1229 case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
1230 return (((xmlSchemaWildcardPtr)
item)->
node);
1231 case XML_SCHEMA_TYPE_PARTICLE:
1232 return (((xmlSchemaParticlePtr)
item)->
node);
1233 case XML_SCHEMA_TYPE_SEQUENCE:
1234 case XML_SCHEMA_TYPE_CHOICE:
1235 case XML_SCHEMA_TYPE_ALL:
1236 return (((xmlSchemaModelGroupPtr)
item)->
node);
1237 case XML_SCHEMA_TYPE_GROUP:
1238 return (((xmlSchemaModelGroupDefPtr)
item)->
node);
1239 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1240 return (((xmlSchemaAttributeGroupPtr)
item)->
node);
1241 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1242 case XML_SCHEMA_TYPE_IDC_KEY:
1243 case XML_SCHEMA_TYPE_IDC_KEYREF:
1244 return (((xmlSchemaIDCPtr)
item)->
node);
1245 case XML_SCHEMA_EXTRA_QNAMEREF:
1246 return(((xmlSchemaQNameRefPtr)
item)->
node);
1251 case XML_SCHEMA_TYPE_ATTRIBUTE_USE:
1252 return (((xmlSchemaAttributeUsePtr)
item)->
node);
1265static xmlSchemaBasicItemPtr
1266xmlSchemaGetNextComponent(xmlSchemaBasicItemPtr
item)
1268 switch (
item->type) {
1269 case XML_SCHEMA_TYPE_ELEMENT:
1270 return ((xmlSchemaBasicItemPtr) ((xmlSchemaElementPtr)
item)->
next);
1271 case XML_SCHEMA_TYPE_ATTRIBUTE:
1272 return ((xmlSchemaBasicItemPtr) ((xmlSchemaAttributePtr)
item)->
next);
1273 case XML_SCHEMA_TYPE_COMPLEX:
1274 case XML_SCHEMA_TYPE_SIMPLE:
1275 return ((xmlSchemaBasicItemPtr) ((xmlSchemaTypePtr)
item)->
next);
1276 case XML_SCHEMA_TYPE_ANY:
1277 case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
1279 case XML_SCHEMA_TYPE_PARTICLE:
1280 return ((xmlSchemaBasicItemPtr) ((xmlSchemaParticlePtr)
item)->
next);
1281 case XML_SCHEMA_TYPE_SEQUENCE:
1282 case XML_SCHEMA_TYPE_CHOICE:
1283 case XML_SCHEMA_TYPE_ALL:
1285 case XML_SCHEMA_TYPE_GROUP:
1287 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1288 return ((xmlSchemaBasicItemPtr) ((xmlSchemaAttributeGroupPtr)
item)->
next);
1289 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1290 case XML_SCHEMA_TYPE_IDC_KEY:
1291 case XML_SCHEMA_TYPE_IDC_KEYREF:
1292 return ((xmlSchemaBasicItemPtr) ((xmlSchemaIDCPtr)
item)->
next);
1318 if (namespaceName !=
NULL) {
1323 if (localName !=
NULL) {
1324 if (namespaceName ==
NULL)
1337 return (xmlSchemaFormatQName(
buf,
ns->href, localName));
1339 return (xmlSchemaFormatQName(
buf,
NULL, localName));
1343xmlSchemaGetComponentName(xmlSchemaBasicItemPtr
item)
1348 switch (
item->type) {
1349 case XML_SCHEMA_TYPE_ELEMENT:
1350 return (((xmlSchemaElementPtr)
item)->
name);
1351 case XML_SCHEMA_TYPE_ATTRIBUTE:
1352 return (((xmlSchemaAttributePtr)
item)->
name);
1353 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1354 return (((xmlSchemaAttributeGroupPtr)
item)->
name);
1355 case XML_SCHEMA_TYPE_BASIC:
1356 case XML_SCHEMA_TYPE_SIMPLE:
1357 case XML_SCHEMA_TYPE_COMPLEX:
1358 return (((xmlSchemaTypePtr)
item)->
name);
1359 case XML_SCHEMA_TYPE_GROUP:
1360 return (((xmlSchemaModelGroupDefPtr)
item)->
name);
1361 case XML_SCHEMA_TYPE_IDC_KEY:
1362 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1363 case XML_SCHEMA_TYPE_IDC_KEYREF:
1364 return (((xmlSchemaIDCPtr)
item)->
name);
1365 case XML_SCHEMA_TYPE_ATTRIBUTE_USE:
1366 if (WXS_ATTRUSE_DECL(
item) !=
NULL) {
1367 return(xmlSchemaGetComponentName(
1368 WXS_BASIC_CAST WXS_ATTRUSE_DECL(
item)));
1371 case XML_SCHEMA_EXTRA_QNAMEREF:
1372 return (((xmlSchemaQNameRefPtr)
item)->
name);
1373 case XML_SCHEMA_TYPE_NOTATION:
1374 return (((xmlSchemaNotationPtr)
item)->
name);
1384#define xmlSchemaGetQNameRefName(r) (WXS_QNAME_CAST (r))->name
1385#define xmlSchemaGetQNameRefTargetNs(r) (WXS_QNAME_CAST (r))->targetNamespace
1401xmlSchemaGetComponentTargetNs(xmlSchemaBasicItemPtr
item)
1406 switch (
item->type) {
1407 case XML_SCHEMA_TYPE_ELEMENT:
1408 return (((xmlSchemaElementPtr)
item)->targetNamespace);
1409 case XML_SCHEMA_TYPE_ATTRIBUTE:
1410 return (((xmlSchemaAttributePtr)
item)->targetNamespace);
1411 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1412 return (((xmlSchemaAttributeGroupPtr)
item)->targetNamespace);
1413 case XML_SCHEMA_TYPE_BASIC:
1414 return (
BAD_CAST "http://www.w3.org/2001/XMLSchema");
1415 case XML_SCHEMA_TYPE_SIMPLE:
1416 case XML_SCHEMA_TYPE_COMPLEX:
1417 return (((xmlSchemaTypePtr)
item)->targetNamespace);
1418 case XML_SCHEMA_TYPE_GROUP:
1419 return (((xmlSchemaModelGroupDefPtr)
item)->targetNamespace);
1420 case XML_SCHEMA_TYPE_IDC_KEY:
1421 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1422 case XML_SCHEMA_TYPE_IDC_KEYREF:
1423 return (((xmlSchemaIDCPtr)
item)->targetNamespace);
1424 case XML_SCHEMA_TYPE_ATTRIBUTE_USE:
1425 if (WXS_ATTRUSE_DECL(
item) !=
NULL) {
1426 return(xmlSchemaGetComponentTargetNs(
1427 WXS_BASIC_CAST WXS_ATTRUSE_DECL(
item)));
1431 case XML_SCHEMA_EXTRA_QNAMEREF:
1432 return (((xmlSchemaQNameRefPtr)
item)->targetNamespace);
1433 case XML_SCHEMA_TYPE_NOTATION:
1434 return (((xmlSchemaNotationPtr)
item)->targetNamespace);
1448 return (xmlSchemaFormatQName(
buf,
1449 xmlSchemaGetComponentTargetNs((xmlSchemaBasicItemPtr)
item),
1450 xmlSchemaGetComponentName((xmlSchemaBasicItemPtr)
item)));
1461 (xmlSchemaBasicItemPtr)
item));
1468xmlSchemaGetIDCDesignation(
xmlChar **
buf, xmlSchemaIDCPtr idc)
1470 return(xmlSchemaGetComponentDesignation(
buf, idc));
1481xmlSchemaWildcardPCToString(
int pc)
1484 case XML_SCHEMAS_ANY_SKIP:
1486 case XML_SCHEMAS_ANY_LAX:
1488 case XML_SCHEMAS_ANY_STRICT:
1491 return (
BAD_CAST "invalid process contents");
1509xmlSchemaGetCanonValueWhtspExt_1(xmlSchemaValPtr
val,
1510 xmlSchemaWhitespaceValueType ws,
1515 xmlSchemaValType valType;
1521 list = xmlSchemaValueGetNext(
val) ? 1 : 0;
1525 valType = xmlSchemaGetValType(
val);
1527 case XML_SCHEMAS_STRING:
1528 case XML_SCHEMAS_NORMSTRING:
1529 case XML_SCHEMAS_ANYSIMPLETYPE:
1530 value = xmlSchemaValueGetAsString(
val);
1532 if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE)
1533 value2 = xmlSchemaCollapseString(
value);
1534 else if (ws == XML_SCHEMA_WHITESPACE_REPLACE)
1535 value2 = xmlSchemaWhiteSpaceReplace(
value);
1541 if (xmlSchemaGetCanonValue(
val, &value2) == -1) {
1544 goto internal_error;
1546 if (for_hash && valType == XML_SCHEMAS_DECIMAL) {
1557 if (
len > 2 && value2[
len-1] ==
'0' && value2[
len-2] ==
'.')
1562 if (*retValue ==
NULL)
1573 FREE_AND_NULL(value2)
1574 val = xmlSchemaValueGetNext(
val);
1579 if (*retValue !=
NULL)
1587xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr
val,
1588 xmlSchemaWhitespaceValueType ws,
1591 return xmlSchemaGetCanonValueWhtspExt_1(
val, ws, retValue, 0);
1595xmlSchemaGetCanonValueHash(xmlSchemaValPtr
val,
1598 return xmlSchemaGetCanonValueWhtspExt_1(
val, XML_SCHEMA_WHITESPACE_COLLAPSE,
1631 xmlSchemaBasicItemPtr
item,
1642 if (itemDes !=
NULL) {
1645 switch (
item->type) {
1646 case XML_SCHEMA_TYPE_BASIC: {
1647 xmlSchemaTypePtr
type = WXS_TYPE_CAST
item;
1649 if (WXS_IS_ATOMIC(
type))
1651 else if (WXS_IS_LIST(
type))
1653 else if (WXS_IS_UNION(
type))
1661 case XML_SCHEMA_TYPE_SIMPLE: {
1662 xmlSchemaTypePtr
type = WXS_TYPE_CAST
item;
1664 if (
type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1669 if (WXS_IS_ATOMIC(
type))
1671 else if (WXS_IS_LIST(
type))
1673 else if (WXS_IS_UNION(
type))
1677 if (
type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1684 case XML_SCHEMA_TYPE_COMPLEX: {
1685 xmlSchemaTypePtr
type = WXS_TYPE_CAST
item;
1687 if (
type->flags & XML_SCHEMAS_TYPE_GLOBAL)
1692 if (
type->flags & XML_SCHEMAS_TYPE_GLOBAL) {
1699 case XML_SCHEMA_TYPE_ATTRIBUTE_USE: {
1700 xmlSchemaAttributeUsePtr ause;
1702 ause = WXS_ATTR_USE_CAST
item;
1704 if (WXS_ATTRUSE_DECL(ause) !=
NULL) {
1707 xmlSchemaGetComponentQName(&
str, WXS_ATTRUSE_DECL(ause)));
1715 case XML_SCHEMA_TYPE_ATTRIBUTE: {
1716 xmlSchemaAttributePtr
attr;
1718 attr = (xmlSchemaAttributePtr)
item;
1727 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
1728 xmlSchemaGetComponentDesignation(
buf,
item);
1730 case XML_SCHEMA_TYPE_ELEMENT: {
1731 xmlSchemaElementPtr
elem;
1737 elem->targetNamespace,
elem->name));
1741 case XML_SCHEMA_TYPE_IDC_UNIQUE:
1742 case XML_SCHEMA_TYPE_IDC_KEY:
1743 case XML_SCHEMA_TYPE_IDC_KEYREF:
1744 if (
item->type == XML_SCHEMA_TYPE_IDC_UNIQUE)
1746 else if (
item->type == XML_SCHEMA_TYPE_IDC_KEY)
1753 case XML_SCHEMA_TYPE_ANY:
1754 case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
1756 ((xmlSchemaWildcardPtr)
item)->processContents));
1759 case XML_SCHEMA_FACET_MININCLUSIVE:
1760 case XML_SCHEMA_FACET_MINEXCLUSIVE:
1761 case XML_SCHEMA_FACET_MAXINCLUSIVE:
1762 case XML_SCHEMA_FACET_MAXEXCLUSIVE:
1763 case XML_SCHEMA_FACET_TOTALDIGITS:
1764 case XML_SCHEMA_FACET_FRACTIONDIGITS:
1765 case XML_SCHEMA_FACET_PATTERN:
1766 case XML_SCHEMA_FACET_ENUMERATION:
1767 case XML_SCHEMA_FACET_WHITESPACE:
1768 case XML_SCHEMA_FACET_LENGTH:
1769 case XML_SCHEMA_FACET_MAXLENGTH:
1770 case XML_SCHEMA_FACET_MINLENGTH:
1775 case XML_SCHEMA_TYPE_GROUP: {
1783 case XML_SCHEMA_TYPE_SEQUENCE:
1784 case XML_SCHEMA_TYPE_CHOICE:
1785 case XML_SCHEMA_TYPE_ALL:
1786 case XML_SCHEMA_TYPE_PARTICLE:
1789 case XML_SCHEMA_TYPE_NOTATION: {
1803 if ((named == 0) && (itemNode !=
NULL)) {
1813 xmlSchemaFormatQName(&
str,
elem->ns->href,
elem->name));
1822 if (itemNode->
ns !=
NULL) {
1845xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr actxt,
1848 xmlSchemaFacetPtr facet;
1849 xmlSchemaWhitespaceValueType
ws;
1861 ws = xmlSchemaGetWhiteSpaceFacetValue(
type->baseType);
1862 for (facet =
type->facets; facet !=
NULL; facet = facet->
next) {
1863 if (facet->type != XML_SCHEMA_FACET_ENUMERATION)
1866 res = xmlSchemaGetCanonValueWhtspExt(facet->val,
1869 xmlSchemaInternalErr(actxt,
1870 "xmlSchemaFormatFacetEnumSet",
1871 "compute the canonical lexical representation");
1897 }
while ((
type !=
NULL) && (
type->type != XML_SCHEMA_TYPE_BASIC));
1910xmlSchemaErrMemory(
const char *
msg)
1918xmlSchemaPSimpleErr(
const char *
msg)
1932xmlSchemaPErrMemory(xmlSchemaParserCtxtPtr ctxt,
1963 channel = ctxt->error;
1964 data = ctxt->errCtxt;
1965 schannel = ctxt->serror;
1969 (
const char *) str1, (
const char *) str2,
NULL, 0, 0,
2029 channel = ctxt->error;
2030 data = ctxt->errCtxt;
2031 schannel = ctxt->serror;
2035 (
const char *) strData1, (
const char *) strData2,
2036 (
const char *) strData3, 0, 0,
msg, str1, str2,
2054xmlSchemaVErrMemory(xmlSchemaValidCtxtPtr ctxt,
2070 msg, (
const char *)
str);
2073#define WXS_ERROR_TYPE_ERROR 1
2074#define WXS_ERROR_TYPE_WARNING 2
2091xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
2102 if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
2103 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
2109 channel = vctxt->error;
2111 channel = vctxt->warning;
2113 schannel = vctxt->serror;
2114 data = vctxt->errCtxt;
2122 (vctxt->depth >= 0) &&
2123 (vctxt->inode !=
NULL)) {
2124 node = vctxt->inode->node;
2130 (vctxt->parserCtxt !=
NULL) &&
2131 (vctxt->parserCtxt->input !=
NULL)) {
2132 file = vctxt->parserCtxt->input->filename;
2133 line = vctxt->parserCtxt->input->line;
2134 col = vctxt->parserCtxt->input->col;
2145 if (vctxt->doc !=
NULL)
2146 file = (
const char *) vctxt->doc->URL;
2147 else if ((vctxt->parserCtxt !=
NULL) &&
2148 (vctxt->parserCtxt->input !=
NULL))
2149 file = vctxt->parserCtxt->input->filename;
2151 if (vctxt->locFunc !=
NULL) {
2155 vctxt->locFunc(vctxt->locCtxt, &
f, &
l);
2163 file = vctxt->filename;
2165 __xmlRaiseError(schannel, channel,
data, ctxt,
2168 (
const char *) str1, (
const char *) str2,
2169 (
const char *) str3, 0, col,
msg, str1, str2, str3, str4);
2171 }
else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) {
2172 xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt;
2176 channel = pctxt->error;
2178 channel = pctxt->warning;
2180 schannel = pctxt->serror;
2181 data = pctxt->errCtxt;
2182 __xmlRaiseError(schannel, channel,
data, ctxt,
2184 errorLevel,
NULL, 0,
2185 (
const char *) str1, (
const char *) str2,
2186 (
const char *) str3, 0, 0,
msg, str1, str2, str3, str4);
2206xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt,
2215xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt,
2221 msg, str1, str2, str3, str4);
2225xmlSchemaErr(xmlSchemaAbstractCtxtPtr actxt,
2234 xmlSchemaAbstractCtxtPtr actxt,
2280 }
else if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
2281 xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt;
2286 xmlSchemaNodeInfoPtr ielem =
2287 vctxt->elemInfos[vctxt->depth];
2291 ielem->nsName, ielem->localName));
2299 vctxt->inode->nsName, vctxt->inode->localName));
2302 }
else if (actxt->type == XML_SCHEMA_CTXT_PARSER) {
2336xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt,
2337 const char *funcName,
2350 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR)
2352 (
const char *)
msg, (
const xmlChar *) funcName, str1, str2);
2353 else if (actxt->type == XML_SCHEMA_CTXT_PARSER)
2355 (
const char *)
msg, (
const xmlChar *) funcName, str1, str2);
2361xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt,
2362 const char *funcName,
2370xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt,
2371 const char *funcName,
2376 xmlSchemaInternalErr2(ACTXT_CAST pctxt, funcName,
message,
2382xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt,
2385 xmlSchemaBasicItemPtr
item,
2393 (actxt->type == XML_SCHEMA_CTXT_PARSER)) {
2398 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2402 (
const char *)
msg, str1, str2, str3, str4);
2407xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt,
2410 xmlSchemaBasicItemPtr
item,
2422xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt,
2433 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2439 (
const char *)
msg, str1, str2, str3,
NULL);
2447xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
2449 xmlSchemaPSVIIDCNodePtr idcNode,
2462 xmlSchemaFormatQName(&qname,
2463 vctxt->nodeQNames->items[idcNode->nodeQNameID +1],
2464 vctxt->nodeQNames->items[idcNode->nodeQNameID]),
2466 FREE_AND_NULL(qname);
2471xmlSchemaEvalErrorNodeType(xmlSchemaAbstractCtxtPtr actxt,
2475 return (
node->type);
2476 if ((actxt->type == XML_SCHEMA_CTXT_VALIDATOR) &&
2477 (((xmlSchemaValidCtxtPtr) actxt)->inode !=
NULL))
2478 return ( ((xmlSchemaValidCtxtPtr) actxt)->
inode->nodeType);
2483xmlSchemaIsGlobalItem(xmlSchemaTypePtr
item)
2485 switch (
item->type) {
2486 case XML_SCHEMA_TYPE_COMPLEX:
2487 case XML_SCHEMA_TYPE_SIMPLE:
2488 if (
item->flags & XML_SCHEMAS_TYPE_GLOBAL)
2491 case XML_SCHEMA_TYPE_GROUP:
2493 case XML_SCHEMA_TYPE_ELEMENT:
2494 if ( ((xmlSchemaElementPtr)
item)->
flags &
2495 XML_SCHEMAS_ELEM_GLOBAL)
2498 case XML_SCHEMA_TYPE_ATTRIBUTE:
2499 if ( ((xmlSchemaAttributePtr)
item)->
flags &
2500 XML_SCHEMAS_ATTR_GLOBAL)
2511xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt,
2515 xmlSchemaTypePtr
type,
2520 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2522 if (displayValue || (xmlSchemaEvalErrorNodeType(actxt,
node) ==
2529 if (! xmlSchemaIsGlobalItem(
type))
2534 if (WXS_IS_ATOMIC(
type))
2536 else if (WXS_IS_LIST(
type))
2538 else if (WXS_IS_UNION(
type))
2541 if (xmlSchemaIsGlobalItem(
type)) {
2544 if (
type->builtInType != 0) {
2548 const xmlChar *qName = xmlSchemaFormatQName(&
str,
type->targetNamespace,
type->name);
2557 if (displayValue || (xmlSchemaEvalErrorNodeType(actxt,
node) ==
2567 xmlSchemaNodeInfoPtr
ni,
2572 return (xmlSchemaFormatQName(
str,
node->ns->href,
node->name));
2574 return (xmlSchemaFormatQName(
str,
NULL,
node->name));
2576 return (xmlSchemaFormatQName(
str,
ni->nsName,
ni->localName));
2581xmlSchemaIllegalAttrErr(xmlSchemaAbstractCtxtPtr actxt,
2583 xmlSchemaAttrInfoPtr
ni,
2588 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2591 xmlSchemaFormatErrorNodeQName(&
str, (xmlSchemaNodeInfoPtr)
ni,
node),
2598xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt,
2612 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2620 if (nbval + nbneg > 0) {
2621 if (nbval + nbneg > 1) {
2627 for (
i = 0;
i < nbval + nbneg;
i++) {
2631 if ((
cur[0] ==
'n') && (
cur[1] ==
'o') && (
cur[2] ==
't') &&
2646 while ((*
end != 0) && (*
end !=
'|'))
2656 if ((nbneg == 0) || (*
end !=
'*') || (*localName !=
'*')) {
2676 FREE_AND_NULL(nsName)
2678 FREE_AND_NULL(localName);
2683 FREE_AND_NULL(localName);
2685 if (
i < nbval + nbneg -1)
2698xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt,
2703 xmlSchemaTypePtr
type,
2704 xmlSchemaFacetPtr facet,
2710 xmlSchemaTypeType facetType;
2711 int nodeType = xmlSchemaEvalErrorNodeType(actxt,
node);
2713 xmlSchemaFormatNodeForError(&
msg, actxt,
node);
2715 facetType = XML_SCHEMA_FACET_ENUMERATION;
2721 facetType = facet->type;
2730 if ((facetType == XML_SCHEMA_FACET_LENGTH) ||
2731 (facetType == XML_SCHEMA_FACET_MINLENGTH) ||
2732 (facetType == XML_SCHEMA_FACET_MAXLENGTH)) {
2734 char len[25], actLen[25];
2744 snprintf(
len, 24,
"%lu", xmlSchemaGetFacetValueAsULong(facet));
2747 if (facetType == XML_SCHEMA_FACET_LENGTH)
2749 BAD_CAST "this differs from the allowed length of '%s'.\n");
2750 else if (facetType == XML_SCHEMA_FACET_MAXLENGTH)
2752 BAD_CAST "this exceeds the allowed maximum length of '%s'.\n");
2753 else if (facetType == XML_SCHEMA_FACET_MINLENGTH)
2755 BAD_CAST "this underruns the allowed minimum length of '%s'.\n");
2764 }
else if (facetType == XML_SCHEMA_FACET_ENUMERATION) {
2766 "of the set {%s}.\n");
2768 xmlSchemaFormatFacetEnumSet(actxt, &
str,
type));
2769 }
else if (facetType == XML_SCHEMA_FACET_PATTERN) {
2771 "by the pattern '%s'.\n");
2774 }
else if (facetType == XML_SCHEMA_FACET_MININCLUSIVE) {
2776 "minimum value allowed ('%s').\n");
2779 }
else if (facetType == XML_SCHEMA_FACET_MAXINCLUSIVE) {
2781 "maximum value allowed ('%s').\n");
2784 }
else if (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE) {
2789 }
else if (facetType == XML_SCHEMA_FACET_MAXEXCLUSIVE) {
2794 }
else if (facetType == XML_SCHEMA_FACET_TOTALDIGITS) {
2796 "digits than are allowed ('%s').\n");
2799 }
else if (facetType == XML_SCHEMA_FACET_FRACTIONDIGITS) {
2801 "digits than are allowed ('%s').\n");
2814 xmlSchemaErr(actxt,
error,
node, (
const char *)
msg, str1, str2);
2820#define VERROR(err, type, msg) \
2821 xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
2823#define VERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST vctxt, func, msg);
2825#define PERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST pctxt, func, msg);
2826#define PERROR_INT2(func, msg) xmlSchemaInternalErr(ACTXT_CAST ctxt, func, msg);
2828#define AERROR_INT(func, msg) xmlSchemaInternalErr(actxt, func, msg);
2842xmlSchemaPMissingAttrErr(xmlSchemaParserCtxtPtr ctxt,
2844 xmlSchemaBasicItemPtr ownerItem,
2851 xmlSchemaFormatItemForReport(&
des,
NULL, ownerItem, ownerElem);
2856 xmlSchemaPErr(ctxt, ownerElem,
error,
2857 "%s: The attribute '%s' is required but missing.\n",
2878xmlSchemaPResCompAttrErr(xmlSchemaParserCtxtPtr ctxt,
2880 xmlSchemaBasicItemPtr ownerItem,
2885 xmlSchemaTypeType refType,
2886 const char *refTypeStr)
2890 xmlSchemaFormatItemForReport(&
des,
NULL, ownerItem, ownerElem);
2891 if (refTypeStr ==
NULL)
2892 refTypeStr = (
const char *) xmlSchemaItemTypeToStr(refType);
2893 xmlSchemaPErrExt(ctxt, ownerElem,
error,
2895 "%s, attribute '%s': The QName value '%s' does not resolve to a(n) "
2897 xmlSchemaFormatQName(&
strA, refURI, refName),
2914xmlSchemaPCustomAttrErr(xmlSchemaParserCtxtPtr ctxt,
2917 xmlSchemaBasicItemPtr ownerItem,
2923 if (ownerDes ==
NULL)
2924 xmlSchemaFormatItemForReport(&
des,
NULL, ownerItem,
attr->parent);
2925 else if (*ownerDes ==
NULL) {
2926 xmlSchemaFormatItemForReport(ownerDes,
NULL, ownerItem,
attr->parent);
2932 "%s, attribute '%s': %s.\n",
2937 "%s, attribute '%s': %s.\n",
2940 if (ownerDes ==
NULL)
2954xmlSchemaPIllegalAttrErr(xmlSchemaParserCtxtPtr ctxt,
2961 xmlSchemaFormatNodeForError(&
strA, ACTXT_CAST ctxt,
attr->parent);
2963 "%sThe attribute '%s' is not allowed.\n",
BAD_CAST strA,
2966 FREE_AND_NULL(
strA);
2967 FREE_AND_NULL(strB);
2985xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt,
2987 xmlSchemaBasicItemPtr
item,
2996 xmlSchemaFormatItemForReport(&
des,
NULL,
item, itemElem);
3001 itemElem = WXS_ITEM_NODE(
item);
3021xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt,
3023 xmlSchemaBasicItemPtr
item,
3046xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt,
3049 xmlSchemaBasicItemPtr ownerItem,
3050 const xmlSchemaAttributeUsePtr attruse,
3057 xmlSchemaFormatItemForReport(&
msg,
NULL, ownerItem,
NULL);
3061 WXS_BASIC_CAST attruse,
NULL));
3066 xmlSchemaErr4(ACTXT_CAST ctxt,
error,
node,
3067 (
const char *)
msg, str1, str2, str3, str4);
3082xmlSchemaPIllegalFacetAtomicErr(xmlSchemaParserCtxtPtr ctxt,
3084 xmlSchemaTypePtr
type,
3085 xmlSchemaTypePtr baseType,
3086 xmlSchemaFacetPtr facet)
3090 xmlSchemaFormatItemForReport(&
des,
NULL, WXS_BASIC_CAST
type,
type->node);
3092 "%s: The facet '%s' is not allowed on types derived from the "
3094 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type),
3095 xmlSchemaFormatItemForReport(&strT,
NULL, WXS_BASIC_CAST baseType,
NULL),
3098 FREE_AND_NULL(strT);
3112xmlSchemaPIllegalFacetListUnionErr(xmlSchemaParserCtxtPtr ctxt,
3114 xmlSchemaTypePtr
type,
3115 xmlSchemaFacetPtr facet)
3119 xmlSchemaFormatItemForReport(&
des,
NULL, WXS_BASIC_CAST
type,
3122 "%s: The facet '%s' is not allowed.\n",
3123 BAD_CAST des, xmlSchemaFacetTypeToString(facet->type));
3138xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt,
3140 xmlSchemaBasicItemPtr ownerItem,
3147 xmlSchemaFormatItemForReport(&
des,
NULL, WXS_BASIC_CAST ownerItem,
attr->parent);
3149 "%s: The attributes '%s' and '%s' are mutually exclusive.\n",
3167xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt,
3171 xmlSchemaTypePtr
type,
3180 xmlSchemaFormatNodeForError(&
msg, ACTXT_CAST ctxt,
node);
3191 if (! xmlSchemaIsGlobalItem(
type))
3196 if (WXS_IS_ATOMIC(
type))
3198 else if (WXS_IS_LIST(
type))
3200 else if (WXS_IS_UNION(
type))
3203 if (xmlSchemaIsGlobalItem(
type)) {
3206 if (
type->builtInType != 0) {
3210 const xmlChar *qName = xmlSchemaFormatQName(&
str,
type->targetNamespace,
type->name);
3229 FREE_AND_NULL(expectedEscaped);
3260xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt,
3262 xmlSchemaBasicItemPtr ownerItem,
3270 xmlSchemaFormatItemForReport(&
des,
NULL, ownerItem, ownerElem);
3272 xmlSchemaPErr2(ctxt, ownerElem,
child,
error,
3277 xmlSchemaPErr2(ctxt, ownerElem,
child,
error,
3278 "%s: The content is not valid. Expected is %s.\n",
3281 xmlSchemaPErr2(ctxt, ownerElem,
child,
error,
3282 "%s: The content is not valid.\n",
3320xmlSchemaNewSchema(xmlSchemaParserCtxtPtr ctxt)
3326 xmlSchemaPErrMemory(ctxt,
"allocating schema",
NULL);
3330 ret->dict = ctxt->dict;
3344xmlSchemaNewFacet(
void)
3346 xmlSchemaFacetPtr
ret;
3348 ret = (xmlSchemaFacetPtr)
xmlMalloc(
sizeof(xmlSchemaFacet));
3366static xmlSchemaAnnotPtr
3369 xmlSchemaAnnotPtr
ret;
3371 ret = (xmlSchemaAnnotPtr)
xmlMalloc(
sizeof(xmlSchemaAnnot));
3373 xmlSchemaPErrMemory(ctxt,
"allocating annotation",
node);
3381static xmlSchemaItemListPtr
3382xmlSchemaItemListCreate(
void)
3384 xmlSchemaItemListPtr
ret;
3388 xmlSchemaPErrMemory(
NULL,
3389 "allocating an item list structure",
NULL);
3392 memset(
ret, 0,
sizeof(xmlSchemaItemList));
3397xmlSchemaItemListClear(xmlSchemaItemListPtr
list)
3404 list->sizeItems = 0;
3408xmlSchemaItemListAdd(xmlSchemaItemListPtr
list,
void *
item)
3412 20 *
sizeof(
void *));
3414 xmlSchemaPErrMemory(
NULL,
"allocating new item list",
NULL);
3417 list->sizeItems = 20;
3418 }
else if (
list->sizeItems <=
list->nbItems) {
3419 list->sizeItems *= 2;
3421 list->sizeItems *
sizeof(
void *));
3423 xmlSchemaPErrMemory(
NULL,
"growing item list",
NULL);
3424 list->sizeItems = 0;
3433xmlSchemaItemListAddSize(xmlSchemaItemListPtr
list,
3438 if (initialSize <= 0)
3441 initialSize *
sizeof(
void *));
3443 xmlSchemaPErrMemory(
NULL,
"allocating new item list",
NULL);
3446 list->sizeItems = initialSize;
3447 }
else if (
list->sizeItems <=
list->nbItems) {
3448 list->sizeItems *= 2;
3450 list->sizeItems *
sizeof(
void *));
3452 xmlSchemaPErrMemory(
NULL,
"growing item list",
NULL);
3453 list->sizeItems = 0;
3462xmlSchemaItemListInsert(xmlSchemaItemListPtr
list,
void *
item,
int idx)
3466 20 *
sizeof(
void *));
3468 xmlSchemaPErrMemory(
NULL,
"allocating new item list",
NULL);
3471 list->sizeItems = 20;
3472 }
else if (
list->sizeItems <=
list->nbItems) {
3473 list->sizeItems *= 2;
3475 list->sizeItems *
sizeof(
void *));
3477 xmlSchemaPErrMemory(
NULL,
"growing item list",
NULL);
3478 list->sizeItems = 0;
3499xmlSchemaItemListInsertSize(xmlSchemaItemListPtr
list,
3505 if (initialSize <= 0)
3508 initialSize *
sizeof(
void *));
3510 xmlSchemaPErrMemory(
NULL,
"allocating new item list",
NULL);
3513 list->sizeItems = initialSize;
3514 }
else if (
list->sizeItems <=
list->nbItems) {
3515 list->sizeItems *= 2;
3517 list->sizeItems *
sizeof(
void *));
3519 xmlSchemaPErrMemory(
NULL,
"growing item list",
NULL);
3520 list->sizeItems = 0;
3541xmlSchemaItemListRemove(xmlSchemaItemListPtr
list,
int idx)
3545 xmlSchemaPSimpleErr(
"Internal error: xmlSchemaItemListRemove, "
3550 if (
list->nbItems == 1) {
3555 list->sizeItems = 0;
3556 }
else if (
list->nbItems -1 ==
idx) {
3573xmlSchemaItemListFree(xmlSchemaItemListPtr
list)
3583xmlSchemaBucketFree(xmlSchemaBucketPtr bucket)
3587 if (bucket->globals !=
NULL) {
3588 xmlSchemaComponentListFree(bucket->globals);
3589 xmlSchemaItemListFree(bucket->globals);
3591 if (bucket->locals !=
NULL) {
3592 xmlSchemaComponentListFree(bucket->locals);
3593 xmlSchemaItemListFree(bucket->locals);
3595 if (bucket->relations !=
NULL) {
3596 xmlSchemaSchemaRelationPtr prev,
cur = bucket->relations;
3603 if ((! bucket->preserveDoc) && (bucket->doc !=
NULL)) {
3606 if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) {
3608 xmlSchemaFree(WXS_IMPBUCKET(bucket)->
schema);
3616 xmlSchemaBucketFree((xmlSchemaBucketPtr) bucket);
3619static xmlSchemaBucketPtr
3620xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
3623 xmlSchemaBucketPtr
ret;
3625 xmlSchemaPtr mainSchema;
3627 if (WXS_CONSTRUCTOR(pctxt)->mainSchema ==
NULL) {
3628 PERROR_INT(
"xmlSchemaBucketCreate",
3629 "no main schema on constructor");
3632 mainSchema = WXS_CONSTRUCTOR(pctxt)->mainSchema;
3634 if (WXS_IS_BUCKET_INCREDEF(
type))
3635 size =
sizeof(xmlSchemaInclude);
3637 size =
sizeof(xmlSchemaImport);
3640 xmlSchemaPErrMemory(
NULL,
"allocating schema bucket",
NULL);
3644 ret->targetNamespace = targetNamespace;
3646 ret->globals = xmlSchemaItemListCreate();
3651 ret->locals = xmlSchemaItemListCreate();
3663 if (! WXS_HAS_BUCKETS(pctxt)) {
3664 if (WXS_IS_BUCKET_INCREDEF(
type)) {
3665 PERROR_INT(
"xmlSchemaBucketCreate",
3666 "first bucket but it's an include or redefine");
3667 xmlSchemaBucketFree(
ret);
3671 ret->type = XML_SCHEMA_SCHEMA_MAIN;
3673 WXS_CONSTRUCTOR(pctxt)->mainBucket =
ret;
3674 WXS_IMPBUCKET(
ret)->schema = mainSchema;
3678 mainSchema->targetNamespace = targetNamespace;
3680 if (
type == XML_SCHEMA_SCHEMA_MAIN) {
3681 PERROR_INT(
"xmlSchemaBucketCreate",
3682 "main bucket but it's not the first one");
3683 xmlSchemaBucketFree(
ret);
3685 }
else if (
type == XML_SCHEMA_SCHEMA_IMPORT) {
3690 WXS_IMPBUCKET(
ret)->schema = xmlSchemaNewSchema(pctxt);
3692 xmlSchemaBucketFree(
ret);
3695 WXS_IMPBUCKET(
ret)->schema->targetNamespace = targetNamespace;
3698 if (WXS_IS_BUCKET_IMPMAIN(
type)) {
3705 if (mainSchema->schemasImports ==
NULL) {
3707 WXS_CONSTRUCTOR(pctxt)->dict);
3708 if (mainSchema->schemasImports ==
NULL) {
3709 xmlSchemaBucketFree(
ret);
3713 if (targetNamespace ==
NULL)
3715 XML_SCHEMAS_NO_NAMESPACE,
ret);
3718 targetNamespace,
ret);
3720 PERROR_INT(
"xmlSchemaBucketCreate",
3721 "failed to add the schema bucket to the hash");
3722 xmlSchemaBucketFree(
ret);
3727 if (WXS_IS_BUCKET_IMPMAIN(WXS_CONSTRUCTOR(pctxt)->bucket->type))
3728 WXS_INCBUCKET(
ret)->ownerImport =
3729 WXS_IMPBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket);
3731 WXS_INCBUCKET(
ret)->ownerImport =
3732 WXS_INCBUCKET(WXS_CONSTRUCTOR(pctxt)->bucket)->ownerImport;
3735 if (mainSchema->includes ==
NULL) {
3736 mainSchema->includes = xmlSchemaItemListCreate();
3737 if (mainSchema->includes ==
NULL) {
3738 xmlSchemaBucketFree(
ret);
3742 xmlSchemaItemListAdd(mainSchema->includes,
ret);
3748 if (xmlSchemaItemListAdd(WXS_CONSTRUCTOR(pctxt)->buckets,
ret) == -1)
3754xmlSchemaAddItemSize(xmlSchemaItemListPtr *
list,
int initialSize,
void *
item)
3757 *
list = xmlSchemaItemListCreate();
3761 xmlSchemaItemListAddSize(*
list, initialSize,
item);
3772xmlSchemaFreeAnnot(xmlSchemaAnnotPtr annot)
3776 if (annot->next ==
NULL) {
3779 xmlSchemaAnnotPtr prev;
3783 annot = annot->next;
3785 }
while (annot !=
NULL);
3796xmlSchemaFreeNotation(xmlSchemaNotationPtr nota)
3810xmlSchemaFreeAttribute(xmlSchemaAttributePtr
attr)
3815 xmlSchemaFreeAnnot(
attr->annot);
3817 xmlSchemaFreeValue(
attr->defVal);
3828xmlSchemaFreeAttributeUse(xmlSchemaAttributeUsePtr use)
3832 if (use->annot !=
NULL)
3833 xmlSchemaFreeAnnot(use->annot);
3834 if (use->defVal !=
NULL)
3835 xmlSchemaFreeValue(use->defVal);
3846xmlSchemaFreeAttributeUseProhib(xmlSchemaAttributeUseProhibPtr prohib)
3860xmlSchemaFreeWildcardNsSet(xmlSchemaWildcardNsPtr
set)
3862 xmlSchemaWildcardNsPtr
next;
3878xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard)
3880 if (wildcard ==
NULL)
3882 if (wildcard->annot !=
NULL)
3883 xmlSchemaFreeAnnot(wildcard->annot);
3884 if (wildcard->nsSet !=
NULL)
3885 xmlSchemaFreeWildcardNsSet(wildcard->nsSet);
3886 if (wildcard->negNsSet !=
NULL)
3898xmlSchemaFreeAttributeGroup(xmlSchemaAttributeGroupPtr attrGr)
3902 if (attrGr->annot !=
NULL)
3903 xmlSchemaFreeAnnot(attrGr->annot);
3904 if (attrGr->attrUses !=
NULL)
3905 xmlSchemaItemListFree(WXS_LIST_CAST attrGr->attrUses);
3916xmlSchemaFreeQNameRef(xmlSchemaQNameRefPtr
item)
3928xmlSchemaFreeTypeLinkList(xmlSchemaTypeLinkPtr
link)
3930 xmlSchemaTypeLinkPtr
next;
3940xmlSchemaFreeIDCStateObjList(xmlSchemaIDCStateObjPtr sto)
3942 xmlSchemaIDCStateObjPtr
next;
3943 while (sto !=
NULL) {
3945 if (sto->history !=
NULL)
3947 if (sto->xpathCtxt !=
NULL)
3948 xmlFreeStreamCtxt((xmlStreamCtxtPtr) sto->xpathCtxt);
3961xmlSchemaFreeIDC(xmlSchemaIDCPtr idcDef)
3963 xmlSchemaIDCSelectPtr
cur, prev;
3967 if (idcDef->annot !=
NULL)
3968 xmlSchemaFreeAnnot(idcDef->annot);
3970 if (idcDef->selector !=
NULL) {
3971 if (idcDef->selector->xpathComp !=
NULL)
3972 xmlFreePattern((xmlPatternPtr) idcDef->selector->xpathComp);
3976 if (idcDef->fields !=
NULL) {
3977 cur = idcDef->fields;
3981 if (prev->xpathComp !=
NULL)
3982 xmlFreePattern((xmlPatternPtr) prev->xpathComp);
3996xmlSchemaFreeElement(xmlSchemaElementPtr
elem)
4001 xmlSchemaFreeAnnot(
elem->annot);
4003 xmlRegFreeRegexp(
elem->contModel);
4005 xmlSchemaFreeValue(
elem->defVal);
4016xmlSchemaFreeFacet(xmlSchemaFacetPtr facet)
4020 if (facet->val !=
NULL)
4021 xmlSchemaFreeValue(facet->val);
4022 if (facet->regexp !=
NULL)
4023 xmlRegFreeRegexp(facet->regexp);
4024 if (facet->annot !=
NULL)
4025 xmlSchemaFreeAnnot(facet->annot);
4036xmlSchemaFreeType(xmlSchemaTypePtr
type)
4041 xmlSchemaFreeAnnot(
type->annot);
4043 xmlSchemaFacetPtr facet,
next;
4045 facet =
type->facets;
4046 while (facet !=
NULL) {
4048 xmlSchemaFreeFacet(facet);
4053 xmlSchemaItemListFree((xmlSchemaItemListPtr)
type->attrUses);
4055 xmlSchemaFreeTypeLinkList(
type->memberTypes);
4067 xmlRegFreeRegexp(
type->contModel);
4078xmlSchemaFreeModelGroupDef(xmlSchemaModelGroupDefPtr
item)
4081 xmlSchemaFreeAnnot(
item->annot);
4092xmlSchemaFreeModelGroup(xmlSchemaModelGroupPtr
item)
4095 xmlSchemaFreeAnnot(
item->annot);
4100xmlSchemaComponentListFree(xmlSchemaItemListPtr
list)
4105 xmlSchemaTreeItemPtr
item;
4106 xmlSchemaTreeItemPtr *
items = (xmlSchemaTreeItemPtr *)
list->items;
4113 switch (
item->type) {
4114 case XML_SCHEMA_TYPE_SIMPLE:
4115 case XML_SCHEMA_TYPE_COMPLEX:
4116 xmlSchemaFreeType((xmlSchemaTypePtr)
item);
4118 case XML_SCHEMA_TYPE_ATTRIBUTE:
4119 xmlSchemaFreeAttribute((xmlSchemaAttributePtr)
item);
4121 case XML_SCHEMA_TYPE_ATTRIBUTE_USE:
4122 xmlSchemaFreeAttributeUse((xmlSchemaAttributeUsePtr)
item);
4124 case XML_SCHEMA_EXTRA_ATTR_USE_PROHIB:
4125 xmlSchemaFreeAttributeUseProhib(
4126 (xmlSchemaAttributeUseProhibPtr)
item);
4128 case XML_SCHEMA_TYPE_ELEMENT:
4129 xmlSchemaFreeElement((xmlSchemaElementPtr)
item);
4131 case XML_SCHEMA_TYPE_PARTICLE:
4133 xmlSchemaFreeAnnot(
item->annot);
4136 case XML_SCHEMA_TYPE_SEQUENCE:
4137 case XML_SCHEMA_TYPE_CHOICE:
4138 case XML_SCHEMA_TYPE_ALL:
4139 xmlSchemaFreeModelGroup((xmlSchemaModelGroupPtr)
item);
4141 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
4142 xmlSchemaFreeAttributeGroup(
4143 (xmlSchemaAttributeGroupPtr)
item);
4145 case XML_SCHEMA_TYPE_GROUP:
4146 xmlSchemaFreeModelGroupDef(
4147 (xmlSchemaModelGroupDefPtr)
item);
4149 case XML_SCHEMA_TYPE_ANY:
4150 case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
4151 xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
item);
4153 case XML_SCHEMA_TYPE_IDC_KEY:
4154 case XML_SCHEMA_TYPE_IDC_UNIQUE:
4155 case XML_SCHEMA_TYPE_IDC_KEYREF:
4156 xmlSchemaFreeIDC((xmlSchemaIDCPtr)
item);
4158 case XML_SCHEMA_TYPE_NOTATION:
4159 xmlSchemaFreeNotation((xmlSchemaNotationPtr)
item);
4161 case XML_SCHEMA_EXTRA_QNAMEREF:
4162 xmlSchemaFreeQNameRef((xmlSchemaQNameRefPtr)
item);
4166 xmlSchemaPSimpleInternalErr(
NULL,
4167 "Internal error: xmlSchemaComponentListFree, "
4168 "unexpected component type '%s'\n",
4185xmlSchemaFree(xmlSchemaPtr
schema)
4215 xmlSchemaItemListPtr
list = (xmlSchemaItemListPtr)
schema->includes;
4218 xmlSchemaBucketFree((xmlSchemaBucketPtr)
list->items[
i]);
4220 xmlSchemaItemListFree(
list);
4223 xmlSchemaFreeAnnot(
schema->annot);
4236#ifdef LIBXML_OUTPUT_ENABLED
4239xmlSchemaTypeDump(xmlSchemaTypePtr
type,
FILE * output);
4249xmlSchemaElementDump(
void *payload,
void *
data,
4254 xmlSchemaElementPtr
elem = (xmlSchemaElementPtr) payload;
4261 if (
elem->flags & XML_SCHEMAS_ELEM_GLOBAL)
4264 if (
namespace !=
NULL)
4265 fprintf(output,
"ns '%s'",
namespace);
4268 if ((
elem->minOccurs != 1) || (
elem->maxOccurs != 1)) {
4270 if (
elem->maxOccurs >= UNBOUNDED)
4271 fprintf(output,
"max: unbounded\n");
4272 else if (
elem->maxOccurs != 1)
4281 if ((
elem->flags & XML_SCHEMAS_ELEM_NILLABLE) ||
4282 (
elem->flags & XML_SCHEMAS_ELEM_ABSTRACT) ||
4283 (
elem->flags & XML_SCHEMAS_ELEM_FIXED) ||
4284 (
elem->flags & XML_SCHEMAS_ELEM_DEFAULT)) {
4286 if (
elem->flags & XML_SCHEMAS_ELEM_FIXED)
4288 if (
elem->flags & XML_SCHEMAS_ELEM_DEFAULT)
4289 fprintf(output,
"[default] ");
4290 if (
elem->flags & XML_SCHEMAS_ELEM_ABSTRACT)
4291 fprintf(output,
"[abstract] ");
4292 if (
elem->flags & XML_SCHEMAS_ELEM_NILLABLE)
4293 fprintf(output,
"[nillable] ");
4310 }
else if (
elem->subtypes !=
NULL) {
4314 xmlSchemaTypeDump(
elem->subtypes, output);
4320 fprintf(output,
" substitutionGroup: '%s' ",
elem->substGroup);
4336xmlSchemaAnnotDump(
FILE * output, xmlSchemaAnnotPtr annot)
4348 fprintf(output,
" Annot: empty\n");
4360xmlSchemaContentModelDump(xmlSchemaParticlePtr particle,
FILE * output,
int depth)
4363 xmlSchemaTreeItemPtr term;
4367 if (particle ==
NULL)
4369 for (
i = 0;((
i <
depth) && (
i < 25));
i++)
4373 if (particle->children ==
NULL) {
4374 fprintf(output,
"MISSING particle term\n");
4377 term = particle->children;
4381 switch (term->type) {
4382 case XML_SCHEMA_TYPE_ELEMENT:
4383 fprintf(output,
"ELEM '%s'", xmlSchemaFormatQName(&
str,
4384 ((xmlSchemaElementPtr)term)->targetNamespace,
4385 ((xmlSchemaElementPtr)term)->
name));
4388 case XML_SCHEMA_TYPE_SEQUENCE:
4391 case XML_SCHEMA_TYPE_CHOICE:
4394 case XML_SCHEMA_TYPE_ALL:
4397 case XML_SCHEMA_TYPE_ANY:
4405 if (particle->minOccurs != 1)
4406 fprintf(output,
" min: %d", particle->minOccurs);
4407 if (particle->maxOccurs >= UNBOUNDED)
4408 fprintf(output,
" max: unbounded");
4409 else if (particle->maxOccurs != 1)
4410 fprintf(output,
" max: %d", particle->maxOccurs);
4413 ((term->type == XML_SCHEMA_TYPE_SEQUENCE) ||
4414 (term->type == XML_SCHEMA_TYPE_CHOICE) ||
4415 (term->type == XML_SCHEMA_TYPE_ALL)) &&
4416 (term->children !=
NULL)) {
4417 xmlSchemaContentModelDump((xmlSchemaParticlePtr) term->children,
4420 if (particle->next !=
NULL)
4421 xmlSchemaContentModelDump((xmlSchemaParticlePtr) particle->next,
4433xmlSchemaAttrUsesDump(xmlSchemaItemListPtr uses,
FILE * output)
4435 xmlSchemaAttributeUsePtr use;
4436 xmlSchemaAttributeUseProhibPtr prohib;
4437 xmlSchemaQNameRefPtr
ref;
4442 if ((uses ==
NULL) || (uses->nbItems == 0))
4445 fprintf(output,
" attributes:\n");
4446 for (
i = 0;
i < uses->nbItems;
i++) {
4447 use = uses->items[
i];
4448 if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
4449 fprintf(output,
" [prohibition] ");
4450 prohib = (xmlSchemaAttributeUseProhibPtr) use;
4452 tns = prohib->targetNamespace;
4453 }
else if (use->type == XML_SCHEMA_EXTRA_QNAMEREF) {
4454 fprintf(output,
" [reference] ");
4455 ref = (xmlSchemaQNameRefPtr) use;
4457 tns =
ref->targetNamespace;
4460 name = WXS_ATTRUSE_DECL_NAME(use);
4461 tns = WXS_ATTRUSE_DECL_TNS(use);
4464 (
const char *) xmlSchemaFormatQName(&
str, tns,
name));
4477xmlSchemaTypeDump(xmlSchemaTypePtr
type,
FILE * output)
4480 fprintf(output,
"Type: NULL\n");
4487 fprintf(output,
"(no name) ");
4489 fprintf(output,
"ns '%s' ",
type->targetNamespace);
4490 switch (
type->type) {
4491 case XML_SCHEMA_TYPE_BASIC:
4494 case XML_SCHEMA_TYPE_SIMPLE:
4497 case XML_SCHEMA_TYPE_COMPLEX:
4498 fprintf(output,
"[complex] ");
4500 case XML_SCHEMA_TYPE_SEQUENCE:
4501 fprintf(output,
"[sequence] ");
4503 case XML_SCHEMA_TYPE_CHOICE:
4506 case XML_SCHEMA_TYPE_ALL:
4509 case XML_SCHEMA_TYPE_UR:
4512 case XML_SCHEMA_TYPE_RESTRICTION:
4513 fprintf(output,
"[restriction] ");
4515 case XML_SCHEMA_TYPE_EXTENSION:
4516 fprintf(output,
"[extension] ");
4519 fprintf(output,
"[unknown type %d] ",
type->type);
4523 switch (
type->contentType) {
4524 case XML_SCHEMA_CONTENT_UNKNOWN:
4525 fprintf(output,
"[unknown] ");
4527 case XML_SCHEMA_CONTENT_EMPTY:
4530 case XML_SCHEMA_CONTENT_ELEMENTS:
4531 fprintf(output,
"[element] ");
4533 case XML_SCHEMA_CONTENT_MIXED:
4536 case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
4539 case XML_SCHEMA_CONTENT_BASIC:
4542 case XML_SCHEMA_CONTENT_SIMPLE:
4545 case XML_SCHEMA_CONTENT_ANY:
4558 xmlSchemaAttrUsesDump(
type->attrUses, output);
4560 xmlSchemaAnnotDump(output,
type->annot);
4561#ifdef DUMP_CONTENT_MODEL
4562 if ((
type->type == XML_SCHEMA_TYPE_COMPLEX) &&
4564 xmlSchemaContentModelDump((xmlSchemaParticlePtr)
type->subtypes,
4571xmlSchemaTypeDumpEntry(
void *
type,
void *output,
4574 xmlSchemaTypeDump((xmlSchemaTypePtr)
type, (
FILE *) output);
4585xmlSchemaDump(
FILE * output, xmlSchemaPtr
schema)
4590 fprintf(output,
"Schemas: NULL\n");
4599 fprintf(output,
"%s", (
const char *)
schema->targetNamespace);
4601 fprintf(output,
"no target namespace");
4604 xmlSchemaAnnotDump(output,
schema->annot);
4609#ifdef DEBUG_IDC_NODE_TABLE
4617xmlSchemaDebugDumpIDCTable(
FILE * output,
4620 xmlSchemaPSVIIDCBindingPtr
bind)
4624 xmlSchemaPSVIIDCNodePtr tab;
4625 xmlSchemaPSVIIDCKeyPtr
key;
4628 fprintf(output,
"IDC: TABLES on '%s'\n",
4629 xmlSchemaFormatQName(&
str, namespaceName, localName));
4635 fprintf(output,
"IDC: BINDING '%s' (%d)\n",
4636 xmlSchemaGetComponentQName(&
str,
4639 for (
i = 0;
i <
bind->nbNodes;
i++) {
4640 tab =
bind->nodeTable[
i];
4642 for (
j = 0;
j <
bind->definition->nbFields;
j++) {
4649 fprintf(output,
"CANON-VALUE-FAILED ");
4651 FREE_AND_NULL(
value)
4653 fprintf(output,
"(no val), ");
4655 fprintf(output,
"(key missing), ");
4659 if (
bind->dupls &&
bind->dupls->nbItems) {
4660 fprintf(output,
"IDC: dupls (%d):\n",
bind->dupls->nbItems);
4661 for (
i = 0;
i <
bind->dupls->nbItems;
i++) {
4662 tab =
bind->dupls->items[
i];
4664 for (
j = 0;
j <
bind->definition->nbFields;
j++) {
4671 fprintf(output,
"CANON-VALUE-FAILED ");
4673 FREE_AND_NULL(
value)
4675 fprintf(output,
"(no val), ");
4677 fprintf(output,
"(key missing), ");
4711 prop =
node->properties;
4712 while (prop !=
NULL) {
4738 prop =
node->properties;
4739 while (prop !=
NULL) {
4740 if ((prop->
ns !=
NULL) &&
4750xmlSchemaGetNodeContent(xmlSchemaParserCtxtPtr ctxt,
xmlNodePtr node)
4800#define WXS_FIND_GLOBAL_ITEM(slot) \
4801 if (xmlStrEqual(nsName, schema->targetNamespace)) { \
4802 ret = xmlHashLookup(schema->slot, name); \
4803 if (ret != NULL) goto exit; \
4805 if (xmlHashSize(schema->schemasImports) > 1) { \
4806 xmlSchemaImportPtr import; \
4807 if (nsName == NULL) \
4808 import = xmlHashLookup(schema->schemasImports, \
4809 XML_SCHEMAS_NO_NAMESPACE); \
4811 import = xmlHashLookup(schema->schemasImports, nsName); \
4812 if (import == NULL) \
4814 ret = xmlHashLookup(import->schema->slot, name); \
4827static xmlSchemaElementPtr
4831 xmlSchemaElementPtr
ret =
NULL;
4836 WXS_FIND_GLOBAL_ITEM(elemDecl)
4861static xmlSchemaTypePtr
4871 ret = xmlSchemaGetPredefinedType(
name, nsName);
4882 WXS_FIND_GLOBAL_ITEM(typeDecl)
4908static xmlSchemaAttributePtr
4912 xmlSchemaAttributePtr
ret =
NULL;
4917 WXS_FIND_GLOBAL_ITEM(attrDecl)
4942static xmlSchemaAttributeGroupPtr
4946 xmlSchemaAttributeGroupPtr
ret =
NULL;
4951 WXS_FIND_GLOBAL_ITEM(attrgrpDecl)
4982static xmlSchemaModelGroupDefPtr
4986 xmlSchemaModelGroupDefPtr
ret =
NULL;
4991 WXS_FIND_GLOBAL_ITEM(groupDecl)
5007static xmlSchemaNotationPtr
5008xmlSchemaGetNotation(xmlSchemaPtr
schema,
5012 xmlSchemaNotationPtr
ret =
NULL;
5017 WXS_FIND_GLOBAL_ITEM(notaDecl)
5023static xmlSchemaIDCPtr
5024xmlSchemaGetIDC(xmlSchemaPtr
schema,
5033 WXS_FIND_GLOBAL_ITEM(idcDef)
5049static xmlSchemaBasicItemPtr
5050xmlSchemaGetNamedComponent(xmlSchemaPtr
schema,
5051 xmlSchemaTypeType itemType,
5056 case XML_SCHEMA_TYPE_GROUP:
5057 return ((xmlSchemaBasicItemPtr) xmlSchemaGetGroup(
schema,
5059 case XML_SCHEMA_TYPE_ELEMENT:
5060 return ((xmlSchemaBasicItemPtr) xmlSchemaGetElem(
schema,
5074#define IS_BLANK_NODE(n) \
5075 (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content, -1)))
5097 }
else while ((*
str != 0) && (
len != 0)) {
5107#define WXS_COMP_NAME(c, t) ((t) (c))->name
5108#define WXS_COMP_TNS(c, t) ((t) (c))->targetNamespace
5113static xmlSchemaBasicItemPtr
5114xmlSchemaFindRedefCompInGraph(xmlSchemaBucketPtr bucket,
5115 xmlSchemaTypeType
type,
5119 xmlSchemaBasicItemPtr
ret;
5124 if ((bucket->globals ==
NULL) ||
5125 (bucket->globals->nbItems == 0))
5130 for (
i = 0;
i < bucket->globals->nbItems;
i++) {
5131 ret = bucket->globals->items[
i];
5134 case XML_SCHEMA_TYPE_COMPLEX:
5135 case XML_SCHEMA_TYPE_SIMPLE:
5136 if ((WXS_COMP_NAME(
ret, xmlSchemaTypePtr) ==
name) &&
5137 (WXS_COMP_TNS(
ret, xmlSchemaTypePtr) ==
5143 case XML_SCHEMA_TYPE_GROUP:
5144 if ((WXS_COMP_NAME(
ret,
5145 xmlSchemaModelGroupDefPtr) ==
name) &&
5147 xmlSchemaModelGroupDefPtr) == nsName))
5152 case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
5153 if ((WXS_COMP_NAME(
ret,
5154 xmlSchemaAttributeGroupPtr) ==
name) &&
5156 xmlSchemaAttributeGroupPtr) == nsName))
5171 if (bucket->relations !=
NULL) {
5172 xmlSchemaSchemaRelationPtr rel = bucket->relations;
5178 bucket->flags |= XML_SCHEMA_BUCKET_MARKED;
5180 if ((rel->bucket !=
NULL) &&
5181 ((rel->bucket->flags & XML_SCHEMA_BUCKET_MARKED) == 0)) {
5182 ret = xmlSchemaFindRedefCompInGraph(rel->bucket,
5188 }
while (rel !=
NULL);
5189 bucket->flags ^= XML_SCHEMA_BUCKET_MARKED;
5205static xmlSchemaNotationPtr
5206xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr
schema,
5210 xmlSchemaNotationPtr
ret =
NULL;
5215 ret = (xmlSchemaNotationPtr)
xmlMalloc(
sizeof(xmlSchemaNotation));
5217 xmlSchemaPErrMemory(ctxt,
"add annotation",
NULL);
5220 memset(
ret, 0,
sizeof(xmlSchemaNotation));
5221 ret->type = XML_SCHEMA_TYPE_NOTATION;
5223 ret->targetNamespace = nsName;
5226 WXS_ADD_GLOBAL(ctxt,
ret);
5242static xmlSchemaAttributePtr
5243xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr
schema,
5247 xmlSchemaAttributePtr
ret =
NULL;
5252 ret = (xmlSchemaAttributePtr)
xmlMalloc(
sizeof(xmlSchemaAttribute));
5254 xmlSchemaPErrMemory(ctxt,
"allocating attribute",
NULL);
5257 memset(
ret, 0,
sizeof(xmlSchemaAttribute));
5258 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE;
5261 ret->targetNamespace = nsName;
5264 WXS_ADD_GLOBAL(ctxt,
ret);
5266 WXS_ADD_LOCAL(ctxt,
ret);
5267 WXS_ADD_PENDING(ctxt,
ret);
5283static xmlSchemaAttributeUsePtr
5284xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt,
5287 xmlSchemaAttributeUsePtr
ret =
NULL;
5292 ret = (xmlSchemaAttributeUsePtr)
xmlMalloc(
sizeof(xmlSchemaAttributeUse));
5294 xmlSchemaPErrMemory(pctxt,
"allocating attribute",
NULL);
5297 memset(
ret, 0,
sizeof(xmlSchemaAttributeUse));
5298 ret->type = XML_SCHEMA_TYPE_ATTRIBUTE_USE;
5301 WXS_ADD_LOCAL(pctxt,
ret);
5311static xmlSchemaRedefPtr
5312xmlSchemaAddRedef(xmlSch