struct xmlValidCtxt {
void *userData; /* user specific data block */
xmlValidityErrorFunc error; /* the callback in case of errors */
xmlValidityWarningFunc warning; /* the callback in case of warning */
};
xmlValidCtxtPtr
typedef xmlValidCtxt *xmlValidCtxtPtr;
XML_MIN_NOTATION_TABLE
#define XML_MIN_NOTATION_TABLE 32
struct xmlNotationTable
struct xmlNotationTable {
int nb_notations; /* number of notations stored */
int max_notations; /* maximum number of notations */
xmlNotationPtr *table; /* the table of attributes */
};
xmlNotationTablePtr
typedef xmlNotationTable *xmlNotationTablePtr;
XML_MIN_ELEMENT_TABLE
#define XML_MIN_ELEMENT_TABLE 32
struct xmlElementTable
struct xmlElementTable {
int nb_elements; /* number of elements stored */
int max_elements; /* maximum number of elements */
xmlElementPtr *table; /* the table of elements */
};
xmlElementTablePtr
typedef xmlElementTable *xmlElementTablePtr;
XML_MIN_ATTRIBUTE_TABLE
#define XML_MIN_ATTRIBUTE_TABLE 32
struct xmlAttributeTable
struct xmlAttributeTable {
int nb_attributes; /* number of attributes stored */
int max_attributes; /* maximum number of attributes */
xmlAttributePtr *table; /* the table of attributes */
};
xmlAttributeTablePtr
typedef xmlAttributeTable *xmlAttributeTablePtr;
XML_MIN_ID_TABLE
#define XML_MIN_ID_TABLE 32
struct xmlIDTable
struct xmlIDTable {
int nb_ids; /* number of ids stored */
int max_ids; /* maximum number of ids */
xmlIDPtr *table; /* the table of ids */
};
xmlIDTablePtr
typedef xmlIDTable *xmlIDTablePtr;
XML_MIN_REF_TABLE
#define XML_MIN_REF_TABLE 32
struct xmlRefTable
struct xmlRefTable {
int nb_refs; /* number of refs stored */
int max_refs; /* maximum number of refs */
xmlRefPtr *table; /* the table of refs */
};
Determine whether an attribute is of type Ref. In case we have Dtd(s)
then this is simple, otherwise we use an heuristic: name Ref (upper
or lowercase).
Try to validate a the root element
basically it does the following check as described by the
XML-1.0 recommendation:
- [ VC: Root Element Type ]
it doesn't try to recurse or apply other check to the element
Try to validate a single element definition
basically it does the following checks as described by the
XML-1.0 recommendation:
- [ VC: One ID per Element Type ]
- [ VC: No Duplicate Types ]
- [ VC: Unique Element Type Declaration ]
Try to validate a single attribute definition
basically it does the following checks as described by the
XML-1.0 recommendation:
- [ VC: Attribute Default Legal ]
- [ VC: Enumeration ]
- [ VC: ID Attribute Default ]
The ID/IDREF uniqueness and matching are done separately
Try to validate a single notation definition
basically it does the following checks as described by the
XML-1.0 recommendation:
- it seems that no validity constraing exist on notation declarations
But this function get called anyway ...
basically it does the all the checks described by the XML Rec
i.e. validates the internal and external subset (if present)
and validate the document tree.
Try to validate a single element and it's attributes,
basically it does the following checks as described by the
XML-1.0 recommendation:
- [ VC: Element Valid ]
- [ VC: Required Attribute ]
Then call xmlValidateOneAttribute() for each attribute present.
Try to validate a single attribute for an element
basically it * does the following checks as described by the
XML-1.0 recommendation:
- [ VC: Attribute Value Type ]
- [ VC: Fixed Attribute Default ]
- [ VC: Entity Name ]
- [ VC: Name Token ]
- [ VC: ID ]
- [ VC: IDREF ]
- [ VC: Entity Name ]
- [ VC: Notation Attributes ]
The ID/IDREF uniqueness and matching are done separately
Search the Dtd for the description of this element
dtd :
a pointer to the DtD to search
name :
the element name
Returns :
the xmlElementPtr if found or NULL
xmlValidGetValidElements ()
int xmlValidGetValidElements (xmlNode *prev,
xmlNode *next,
const xmlChar **list,
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
list :
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.
xmlValidGetPotentialChildren ()
int xmlValidGetPotentialChildren (xmlElementContent *ctree,
const xmlChar **list,
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.