* but is done here due to performance. Move it to an other layer
* is schema construction via an API is implemented.
*/
+
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
+
#define IN_LIBXML
#include "libxml.h"
/*
* Macros for attribute uses.
*/
-#define WXS_ATTRUSE_DECL(au) WXS_ATTR_CAST (WXS_ATTR_USE_CAST (au))->attrDecl
+#define WXS_ATTRUSE_DECL(au) (WXS_ATTR_USE_CAST (au))->attrDecl
#define WXS_ATTRUSE_TYPEDEF(au) WXS_ATTR_TYPEDEF(WXS_ATTRUSE_DECL( WXS_ATTR_USE_CAST au))
typedef xmlSchemaAbstractCtxt *xmlSchemaAbstractCtxtPtr;
struct _xmlSchemaAbstractCtxt {
int type; /* E.g. XML_SCHEMA_CTXT_VALIDATOR */
+ void *dummy; /* Fix alignment issues */
};
typedef struct _xmlSchemaBucket xmlSchemaBucket;
typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
struct _xmlSchemaBasicItem {
xmlSchemaTypeType type;
+ void *dummy; /* Fix alignment issues */
};
/**
*buf = xmlStrcat(*buf, BAD_CAST "'");
FREE_AND_NULL(str);
}
+ /* Falls through. */
default:
named = 0;
}
"valid.");
}
if (expected) {
- msg = xmlStrcat(msg, BAD_CAST " Expected is '");
xmlChar *expectedEscaped = xmlCharStrdup(expected);
+ msg = xmlStrcat(msg, BAD_CAST " Expected is '");
msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));
FREE_AND_NULL(expectedEscaped);
msg = xmlStrcat(msg, BAD_CAST "'.\n");
* STATUS: (seems) complete
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
* (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.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt,
* 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.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt,
* (3.4.6) Constraints on Complex Type Definition Schema Components
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckCTComponent(xmlSchemaParserCtxtPtr ctxt,
* Complex Type Definition Representation OK (src-ct)
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt,
* STATUS: complete
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckParticleRangeOK(int rmin, int rmax,
* CLARIFY: (3.2.2)
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseNameAndTypeOK(xmlSchemaParserCtxtPtr ctxt,
* STATUS: complete
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseNSCompat(xmlSchemaParserCtxtPtr ctxt,
* STATUS: TODO
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseRecurseAsIfGroup(xmlSchemaParserCtxtPtr ctxt,
* STATUS: complete
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseNSSubset(xmlSchemaParserCtxtPtr ctxt,
* STATUS: TODO
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckCOSParticleRestrict(xmlSchemaParserCtxtPtr ctxt,
* STATUS: TODO: subst-groups
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt,
* TODO: subst-groups
*
* Returns 0 if the constraints are satisfied, a positive
- * error code if not and -1 if an internal error occured.
+ * error code if not and -1 if an internal error occurred.
*/
static int
xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt,
return (0);
internal_error:
PERROR_INT("xmlSchemaDeriveAndValidateFacets",
- "an error occured");
+ "an error occurred");
return (-1);
}
ctxt->ownsConstructor = 0;
}
PERROR_INT2("xmlSchemaParse",
- "An internal error occured");
+ "An internal error occurred");
ctxt->schema = NULL;
return(NULL);
}
* Creates an augmented IDC definition for the imported schema.
*/
static void
-xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) {
+xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt, xmlChar *name ATTRIBUTE_UNUSED) {
if (imported->schema->idcDef != NULL) {
xmlHashScan(imported->schema->idcDef ,
(xmlHashScanner) xmlSchemaAugmentIDC, vctxt);
/*
* Get hold of the still expected content, since a further
- * call to xmlRegExecPushString() will loose this information.
+ * call to xmlRegExecPushString() will lose this information.
*/
xmlRegExecNextValues(inode->regexCtxt,
&nbval, &nbneg, &values[0], &terminal);
}
if (ret < 0) {
/*
- * VAL TODO: A reader error occured; what to do here?
+ * VAL TODO: A reader error occurred; what to do here?
*/
ret = 1;
goto exit;
* attributes yet.
*/
if (nb_attributes != 0) {
+ int valueLen, k, l;
xmlChar *value;
for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
* libxml2 differs from normal SAX here in that it escapes all ampersands
* as & instead of delivering the raw converted string. Changing the
* behavior at this point would break applications that use this API, so
- * we are forced to work around it. There is no danger of accidentally
- * decoding some entity other than & in this step because without
- * unescaped ampersands there can be no other entities in the string.
+ * we are forced to work around it.
*/
- value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3],
- attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
+ valueLen = attributes[j+4] - attributes[j+3];
+ value = xmlMallocAtomic(valueLen + 1);
+ if (value == NULL) {
+ xmlSchemaVErrMemory(vctxt,
+ "allocating string for decoded attribute",
+ NULL);
+ goto internal_error;
+ }
+ for (k = 0, l = 0; k < valueLen; l++) {
+ if (k < valueLen - 4 &&
+ attributes[j+3][k+0] == '&' &&
+ attributes[j+3][k+1] == '#' &&
+ attributes[j+3][k+2] == '3' &&
+ attributes[j+3][k+3] == '8' &&
+ attributes[j+3][k+4] == ';') {
+ value[l] = '&';
+ k += 5;
+ } else {
+ value[l] = attributes[j+3][k];
+ k++;
+ }
+ }
+ value[l] = '\0';
/*
* TODO: Set the node line.
*/