#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "constraints.h"
#include "referenceTables.h"
#include "validator.h"
Functions | |
int | xmlcpgnameForm (const char *s) |
Tests wheter s is in Name form. | |
int | xmlcpgNmTokenForm (const char *s) |
int | xmlcpgwellFormednessElementTypeMatch (char *stag, char *etag) |
The Name in an element's end-tag must match the element type in the start-tag. | |
xmlcpgIterator * | xmlcpgvalidityChildren (xmlcpgIterator *it, xmlcpgObject *specs) |
void | xmlcpgvalidityElementValid (xmlcpgElement *element, xmlcpgObject *specs) |
An element is valid if there is a declaration matching elementdecl where the Name matches the element type, and one of the following holds:. | |
int | xmlcpgwellFormednessUniqueAttSpec (const char *name, const xmlcpgList *atts) |
No attribute name may appear more than once in the same start-tag or empty-element tag. | |
void | xmlcpgvalidityAttributeValueType (xmlcpgAttribute *attribute, xmlcpgMap *specs, xmlcpgElement *element) |
The attribute must have been declared; the value must be of the type declared for it. | |
int | xmlcpgwellFormednessNoExternalEntityReferences (const char *entityName) |
Attribute values cannot contain direct or indirect entity references to external entities. | |
int | xmlcpgwellFormednessNoLessThanInAttributeValues (const xmlcpgAttribute *attribute) |
The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <. | |
int | xmlcpgwellFormednessEntityDeclared (const char *entity) |
In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference must match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. | |
int | xmlcpgvalidityEntityDeclared (xmlcpgObject *ast) |
In a document with an external subset or external parameter entities with "standalone='no'", the Name given in the entity reference must match that in an entity declaration. | |
int | xmlcpgwellFormednessParsedEntity (const char *entity) |
An entity reference must not contain the name of an unparsed entity. | |
int | xmlcpgwellFormednessNoRecursion (xmlcpgObject *ast) |
A parsed entity must not contain a recursive reference to itself, either directly or indirectly. | |
void | xmlcpgwellFormednessInDTD (const char *entity) |
Parameter-entity references may only appear in the DTD. | |
int | xmlcpgvalidityNotationDeclared (xmlcpgObject *ast) |
The Name must match the declared name of a notation. | |
void | xmlcpgvalidityUniqueNotationName (xmlcpgString *name) |
Only one notation declaration can declare a given Name. | |
int | xmlcpgvalidityRootElementType (xmlcpgDocument *document) |
The Name in the document type declaration must match the element type of the root element. | |
int | xmlcpgwellFormednessExternalSubset (xmlcpgObject *ast) |
The external subset, if any, must match the production for extSubset. | |
int | xmlcpgvalidityStandaloneDocumentDeclaration (xmlcpgList *dtd) |
The standalone document declaration must have the value "no" if any external markup declarations contain declarations of:. | |
void | xmlcpgvalidityProperDeclarationPENesting (xmlcpgPEDecl *entity) |
Parameter-entity replacement text must be properly nested with markup declarations. | |
int | xmlcpgwellFormednessPEsinInternalSubset (xmlcpgObject *ast) |
In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. | |
int | xmlcpgvalidityUniqueElementTypeDeclaration (xmlcpgString *elementName) |
No element type may be declared more than once. | |
void | xmlcpgvalidityProperGroupPENesting (xmlcpgList *list) |
Parameter-entity replacement text must be properly nested with parenthesized groups. | |
void | xmlcpgvalidityNoDuplicateTypes (xmlcpgList *list) |
The same name must not appear more than once in a single mixed-content declaration. | |
void | xmlcpgvalidityID (xmlcpgString *attributeValue, xmlcpgElement *element) |
Values of type ID must match the Name production. | |
void | xmlcpgvalidityOneIDperElementType (xmlcpgElement *element, xmlcpgMap *specs) |
No element type may have more than one ID attribute specified. | |
int | xmlcpgvalidityIDAttributeDefault (xmlcpgObject *attType, xmlcpgObject *defaultDecl, char *nameAttribute) |
An ID attribute must have a declared default of IMPLIED or REQUIRED. | |
void | xmlcpgvalidityIDREF (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each Name must match the value of an ID attribute on some element in the XML document; i.e. | |
void | xmlcpgvalidityIDREFS (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each Name must match the value of an ID attribute on some element in the XML document; i.e. | |
void | xmlcpgvalidityEntityName (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Name must match the name of an unparsed entity declared in the DTD. | |
void | xmlcpgvalidityEntityNames (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Name must match the name of an unparsed entity declared in the DTD. | |
void | xmlcpgvalidityNameToken (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type NMTOKEN must match the Nmtoken production. | |
void | xmlcpgvalidityNameTokens (xmlcpgString *attribute, xmlcpgElement *element) |
Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens. | |
void | xmlcpgvalidityNotationAttributes (xmlcpgString *attribute, xmlcpgObject *names, xmlcpgElement *element) |
Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared. | |
void | xmlcpgvalidityOneNotationPerElementType (xmlcpgObject *ast, xmlcpgMap *specs) |
No element type may have more than one NOTATION attribute specified. | |
void | xmlcpgvalidityNoNotationonEmptyElement (xmlcpgElement *element, xmlcpgMap *specs) |
For compatibility, an attribute of type NOTATION must not be declared on an element declared EMPTY. | |
void | xmlcpgvalidityEnumeration (xmlcpgString *attribute, xmlcpgObject *nameTokens, xmlcpgElement *element) |
Values of this type must match one of the Nmtoken tokens in the declaration. | |
void | xmlcpgvalidityRequiredAttribute (xmlcpgObject *container, xmlcpgElement *element) |
If the default declaration is the keyword REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration. | |
void | xmlcpgvalidityAttributeDefaultLegal (xmlcpgAttDef *attDef) |
The declared default value must meet the lexical constraints of the declared attribute type. | |
void | xmlcpgvalidityFixedAttributeDefault (xmlcpgString *attribute, xmlcpgFixed *defaultDecl, xmlcpgElement *element) |
If an attribute has a default value declared with the FIXED keyword, instances of that attribute must match the default value. | |
void | xmlcpgvalidityLegalCharacter (xmlcpgObject *ast) |
Characters referred to using character references must match the production for Char. | |
int | xmlcpgwellFormednessPEBetweenDeclarations (xmlcpgObject *ast) |
The replacement text of a parameter entity reference in a DeclSep must match the production extSubsetDecl. | |
void | xmlcpgvalidityIDReferences () |
Test whether each Name match the value of an ID attribute on some element in the XML document; i.e. | |
void | xmlcpgcompatibilityError (const char *message) |
Signals a compatibility error. | |
void | xmlcpgvalidityWarning (const char *message) |
Signals a validity warning. | |
void | xmlcpgwellFormedConstraintFailure (const char *message) |
Signals a "Well Formed Constraint" test failure. | |
void | xmlcpgconstraintsInit () |
Initializes variables for validation purposes. | |
void | xmlcpgconstraintsDestroy () |
Destroys variables for validation purposes. | |
Variables | |
xmlcpgList * | usedIDs = NULL |
xmlcpgList * | idRefs = NULL |
xmlcpgList * | usedNameNotation = NULL |
xmlcpgList * | elementList = NULL |
|
Signals a compatibility error.
|
|
Destroys variables for validation purposes.
|
|
Initializes variables for validation purposes. It is used by xmlcpgspecializedValidator. |
|
Tests wheter s is in Name form.
|
|
|
|
The declared default value must meet the lexical constraints of the declared attribute type.
|
|
The attribute must have been declared; the value must be of the type declared for it. (For attribute types, see 3.3 Attribute-List Declarations.)
|
|
|
|
An element is valid if there is a declaration matching elementdecl where the Name matches the element type, and one of the following holds:. 1.The declaration matches EMPTY and the element has no content. 2.The declaration matches children and the sequence of child elements belongs to the language generated by the regular expression in the content model, with optional white space (characters matching the nonterminal S) between the start-tag and the first child element, between child elements, or between the last child element and the end-tag. Note that a CDATA section containing only white space does not match the nonterminal S, and hence cannot appear in these positions. 3.The declaration matches Mixed and the content consists of character data and child elements whose types match names in the content model. 4.The declaration matches ANY, and the types of any child elements have been declared. |
|
In a document with an external subset or external parameter entities with "standalone='no'", the Name given in the entity reference must match that in an entity declaration. For interoperability, valid documents should declare the entities amp, lt, gt, apos, quot, in the form specified in 4.6 Predefined Entities. The declaration of a parameter entity must precede any reference to it. Similarly, the declaration of a general entity must precede any attribute-list declaration containing a default value with a direct or indirect reference to that general entity.
|
|
Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Name must match the name of an unparsed entity declared in the DTD.
|
|
Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Name must match the name of an unparsed entity declared in the DTD.
|
|
Values of this type must match one of the Nmtoken tokens in the declaration.
|
|
If an attribute has a default value declared with the FIXED keyword, instances of that attribute must match the default value.
|
|
Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.
|
|
An ID attribute must have a declared default of IMPLIED or REQUIRED.
|
|
Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute.
|
|
Test whether each Name match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute. |
|
Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute.
|
|
Characters referred to using character references must match the production for Char.
|
|
Values of type NMTOKEN must match the Nmtoken production.
|
|
Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.
|
|
The same name must not appear more than once in a single mixed-content declaration.
|
|
For compatibility, an attribute of type NOTATION must not be declared on an element declared EMPTY.
|
|
Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.
|
|
The Name must match the declared name of a notation.
|
|
No element type may have more than one ID attribute specified.
|
|
No element type may have more than one NOTATION attribute specified.
|
|
Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text.
|
|
Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text should contain at least one non-blank character, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).
|
|
If the default declaration is the keyword REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration.
|
|
The Name in the document type declaration must match the element type of the root element.
|
|
The standalone document declaration must have the value "no" if any external markup declarations contain declarations of:. The standalone document declaration must have the value "no" if any external markup declarations contain declarations of: o attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or o entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or o attributes with values subject to normalization, where the attribute appears in the document with a value which will change as a result of normalization, or o element types with element content, if white space occurs directly within any instance of those types.
|
|
No element type may be declared more than once.
|
|
Only one notation declaration can declare a given Name.
|
|
Signals a validity warning.
|
|
Signals a "Well Formed Constraint" test failure.
|
|
The Name in an element's end-tag must match the element type in the start-tag.
|
|
In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference must match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'.
|
|
The external subset, if any, must match the production for extSubset.
|
|
Parameter-entity references may only appear in the DTD.
|
|
Attribute values cannot contain direct or indirect entity references to external entities.
|
|
The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <.
|
|
A parsed entity must not contain a recursive reference to itself, either directly or indirectly.
|
|
An entity reference must not contain the name of an unparsed entity. Unparsed entities may be referred to only in attribute values declared to be of type ENTITY or ENTITIES.
|
|
The replacement text of a parameter entity reference in a DeclSep must match the production extSubsetDecl.
|
|
In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)
|
|
No attribute name may appear more than once in the same start-tag or empty-element tag.
|
|
|
|
|
|
|
|
|