libxml2 Reference Manual |
---|
valid - The DTD validation
API for the DTD handling and the validity checking
Author(s): Daniel Veillard
#define XML_VCTXT_DTD_VALIDATED; #define XML_VCTXT_USE_PCTXT; typedef struct _xmlHashTable xmlAttributeTable; typedef xmlAttributeTable * xmlAttributeTablePtr; typedef struct _xmlHashTable xmlElementTable; typedef xmlElementTable * xmlElementTablePtr; typedef struct _xmlHashTable xmlIDTable; typedef xmlIDTable * xmlIDTablePtr; typedef struct _xmlHashTable xmlNotationTable; typedef xmlNotationTable * xmlNotationTablePtr; typedef struct _xmlHashTable xmlRefTable; typedef xmlRefTable * xmlRefTablePtr; typedef struct _xmlValidCtxt xmlValidCtxt; typedef xmlValidCtxt * xmlValidCtxtPtr; typedef struct _xmlValidState xmlValidState; typedef xmlValidState * xmlValidStatePtr; xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name,
const xmlChar * ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree); xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * name,
xmlElementTypeVal type,
xmlElementContentPtr content); xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * value,
xmlAttrPtr attr); xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * name,
const xmlChar * PublicID,
const xmlChar * SystemID); xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * value,
xmlAttrPtr attr); xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table); xmlElementContentPtr xmlCopyDocElementContent (xmlDocPtr doc,
xmlElementContentPtr cur); xmlElementContentPtr xmlCopyElementContent (xmlElementContentPtr cur); xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table); xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur); xmlNotationTablePtr xmlCopyNotationTable (xmlNotationTablePtr table); xmlEnumerationPtr xmlCreateEnumeration (const xmlChar * name); void xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr); void xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table); void xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem); void xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table); void xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota); void xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table); void xmlFreeAttributeTable (xmlAttributeTablePtr table); void xmlFreeDocElementContent (xmlDocPtr doc,
xmlElementContentPtr cur); void xmlFreeElementContent (xmlElementContentPtr cur); void xmlFreeElementTable (xmlElementTablePtr table); void xmlFreeEnumeration (xmlEnumerationPtr cur); void xmlFreeIDTable (xmlIDTablePtr table); void xmlFreeNotationTable (xmlNotationTablePtr table); void xmlFreeRefTable (xmlRefTablePtr table); void xmlFreeValidCtxt (xmlValidCtxtPtr cur); xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name); xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar * name); xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar * name); xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name,
const xmlChar * prefix); xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar * name,
const xmlChar * prefix); xmlAttrPtr xmlGetID (xmlDocPtr doc,
const xmlChar * ID); xmlListPtr xmlGetRefs (xmlDocPtr doc,
const xmlChar * ID); int xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr); int xmlIsMixedElement (xmlDocPtr doc,
const xmlChar * name); int xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr); xmlElementContentPtr xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar * name,
xmlElementContentType type); xmlElementContentPtr xmlNewElementContent (const xmlChar * name,
xmlElementContentType type); xmlValidCtxtPtr xmlNewValidCtxt (void); int xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr); int xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr); void xmlSnprintfElementContent (char * buf,
int size,
xmlElementContentPtr content,
int englob); void xmlSprintfElementContent (char * buf,
xmlElementContentPtr content,
int englob); int xmlValidBuildContentModel (xmlValidCtxtPtr ctxt,
xmlElementPtr elem); xmlChar * xmlValidCtxtNormalizeAttributeValue (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * name,
const xmlChar * value); int xmlValidGetPotentialChildren (xmlElementContent * ctree,
const xmlChar ** names,
int * len,
int max); int xmlValidGetValidElements (xmlNode * prev,
xmlNode * next,
const xmlChar ** names,
int max); xmlChar * xmlValidNormalizeAttributeValue (xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * name,
const xmlChar * value); int xmlValidateAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr); int xmlValidateAttributeValue (xmlAttributeType type,
const xmlChar * value); int xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc); int xmlValidateDocumentFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc); int xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd); int xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc); int xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem); int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem); int xmlValidateNameValue (const xmlChar * value); int xmlValidateNamesValue (const xmlChar * value); int xmlValidateNmtokenValue (const xmlChar * value); int xmlValidateNmtokensValue (const xmlChar * value); int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota); int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * notationName); int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar * value); int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem); int xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * prefix,
xmlNsPtr ns,
const xmlChar * value); int xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * qname); int xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar * data,
int len); int xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * qname); int xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc); typedef void xmlValidityErrorFunc (void * ctx,
const char * msg,
... ...); typedef void xmlValidityWarningFunc (void * ctx,
const char * msg,
... ...);
#define XML_VCTXT_DTD_VALIDATED;
Set after xmlValidateDtdFinal was called.
#define XML_VCTXT_USE_PCTXT;
Set if the validation context is part of a parser context.
struct _xmlHashTable { The content of this structure is not made public by the API. } xmlAttributeTable;
xmlAttributeTable * xmlAttributeTablePtr;
struct _xmlHashTable { The content of this structure is not made public by the API. } xmlElementTable;
xmlElementTable * xmlElementTablePtr;
struct _xmlHashTable { The content of this structure is not made public by the API. } xmlIDTable;
xmlIDTable * xmlIDTablePtr;
struct _xmlHashTable { The content of this structure is not made public by the API. } xmlNotationTable;
xmlNotationTable * xmlNotationTablePtr;
struct _xmlHashTable { The content of this structure is not made public by the API. } xmlRefTable;
xmlRefTable * xmlRefTablePtr;
struct _xmlValidCtxt { void * userData : user specific data block xmlValidityErrorFunc error : the callback in case of errors xmlValidityWarningFunc warning : the callback in case of warning Node analysis stack used when validat xmlNodePtr node : Current parsed Node int nodeNr : Depth of the parsing stack int nodeMax : Max depth of the parsing stack xmlNodePtr * nodeTab : array of nodes unsigned int flags : internal flags xmlDocPtr doc : the document int valid : temporary validity check result state state used for non-determinist xmlValidState * vstate : current state int vstateNr : Depth of the validation stack int vstateMax : Max depth of the validation stack xmlValidState * vstateTab : array of validation states xmlAutomataPtr am : the automata xmlAutomataStatePtr state : used to build the automata void * am void * state } xmlValidCtxt;
xmlValidCtxt * xmlValidCtxtPtr;
struct _xmlValidState { The content of this structure is not made public by the API. } xmlValidState;
xmlValidState * xmlValidStatePtr;
void xmlValidityErrorFunc (void * ctx,
const char * msg,
... ...)
Callback called when a validity error is found. This is a message oriented function similar to an *printf function.
ctx: | usually an xmlValidCtxtPtr to a validity error context, but comes from ctxt->userData (which normally contains such a pointer); ctxt->userData can be changed by the user. |
msg: | the string to format *printf like vararg |
...: | remaining arguments to the format |
void xmlValidityWarningFunc (void * ctx,
const char * msg,
... ...)
Callback called when a validity warning is found. This is a message oriented function similar to an *printf function.
ctx: | usually an xmlValidCtxtPtr to a validity error context, but comes from ctxt->userData (which normally contains such a pointer); ctxt->userData can be changed by the user. |
msg: | the string to format *printf like vararg |
...: | remaining arguments to the format |
xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name,
const xmlChar * ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree)
Register a new attribute declaration Note that @tree becomes the ownership of the DTD
ctxt: | the validation context |
dtd: | pointer to the DTD |
elem: | the element name |
name: | the attribute name |
ns: | the attribute namespace prefix |
type: | the attribute type |
def: | the attribute default type |
defaultValue: | the attribute default value |
tree: | if it's an enumeration, the associated list |
Returns: | NULL if not new, otherwise the attribute decl |
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * name,
xmlElementTypeVal type,
xmlElementContentPtr content)
Register a new element declaration
ctxt: | the validation context |
dtd: | pointer to the DTD |
name: | the entity name |
type: | the element type |
content: | the element content tree or NULL |
Returns: | NULL if not, otherwise the entity |
xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * value,
xmlAttrPtr attr)
Register a new id declaration
xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar * name,
const xmlChar * PublicID,
const xmlChar * SystemID)
Register a new notation declaration
ctxt: | the validation context |
dtd: | pointer to the DTD |
name: | the entity name |
PublicID: | the public identifier or NULL |
SystemID: | the system identifier or NULL |
Returns: | NULL if not, otherwise the entity |
xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * value,
xmlAttrPtr attr)
DEPRECATED, do not use. This function will be removed from the public API. Register a new ref declaration
xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table)
Build a copy of an attribute table.
table: | An attribute table |
Returns: | the new xmlAttributeTablePtr or NULL in case of error. |
xmlElementContentPtr xmlCopyDocElementContent (xmlDocPtr doc,
xmlElementContentPtr cur)
Build a copy of an element content description.
doc: | the document owning the element declaration |
cur: | An element content pointer. |
Returns: | the new xmlElementContentPtr or NULL in case of error. |
xmlElementContentPtr xmlCopyElementContent (xmlElementContentPtr cur)
Build a copy of an element content description. Deprecated, use xmlCopyDocElementContent instead
cur: | An element content pointer. |
Returns: | the new xmlElementContentPtr or NULL in case of error. |
xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table)
Build a copy of an element table.
table: | An element table |
Returns: | the new xmlElementTablePtr or NULL in case of error. |
xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur)
Copy an enumeration attribute node (recursive).
cur: | the tree to copy. |
Returns: | the xmlEnumerationPtr just created or NULL in case of error. |
xmlNotationTablePtr xmlCopyNotationTable (xmlNotationTablePtr table)
Build a copy of a notation table.
table: | A notation table |
Returns: | the new xmlNotationTablePtr or NULL in case of error. |
xmlEnumerationPtr xmlCreateEnumeration (const xmlChar * name)
create and initialize an enumeration attribute node.
name: | the enumeration name or NULL |
Returns: | the xmlEnumerationPtr just created or NULL in case of error. |
void xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr)
This will dump the content of the attribute declaration as an XML DTD definition
buf: | the XML buffer output |
attr: | An attribute declaration |
void xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table)
This will dump the content of the attribute table as an XML DTD definition
buf: | the XML buffer output |
table: | An attribute table |
void xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem)
This will dump the content of the element declaration as an XML DTD definition
buf: | the XML buffer output |
elem: | An element table |
void xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table)
This will dump the content of the element table as an XML DTD definition
buf: | the XML buffer output |
table: | An element table |
void xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota)
This will dump the content the notation declaration as an XML DTD definition
buf: | the XML buffer output |
nota: | A notation declaration |
void xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table)
This will dump the content of the notation table as an XML DTD definition
buf: | the XML buffer output |
table: | A notation table |
void xmlFreeAttributeTable (xmlAttributeTablePtr table)
Deallocate the memory used by an entities hash table.
table: | An attribute table |
void xmlFreeDocElementContent (xmlDocPtr doc,
xmlElementContentPtr cur)
Free an element content structure. The whole subtree is removed.
doc: | the document owning the element declaration |
cur: | the element content tree to free |
void xmlFreeElementContent (xmlElementContentPtr cur)
Free an element content structure. The whole subtree is removed. Deprecated, use xmlFreeDocElementContent instead
cur: | the element content tree to free |
void xmlFreeElementTable (xmlElementTablePtr table)
Deallocate the memory used by an element hash table.
table: | An element table |
void xmlFreeEnumeration (xmlEnumerationPtr cur)
free an enumeration attribute node (recursive).
cur: | the tree to free. |
void xmlFreeIDTable (xmlIDTablePtr table)
Deallocate the memory used by an ID hash table.
table: | An id table |
void xmlFreeNotationTable (xmlNotationTablePtr table)
Deallocate the memory used by an entities hash table.
table: | An notation table |
void xmlFreeRefTable (xmlRefTablePtr table)
DEPRECATED, do not use. This function will be removed from the public API. Deallocate the memory used by an Ref hash table.
table: | An ref table |
void xmlFreeValidCtxt (xmlValidCtxtPtr cur)
Free a validation context structure.
cur: | the validation context to free |
xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name)
Search the DTD for the description of this attribute on this element.
dtd: | a pointer to the DtD to search |
elem: | the element name |
name: | the attribute name |
Returns: | the xmlAttributePtr if found or NULL |
xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar * name)
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 |
xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar * name)
Search the DTD for the description of this notation
dtd: | a pointer to the DtD to search |
name: | the notation name |
Returns: | the xmlNotationPtr if found or NULL |
xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar * elem,
const xmlChar * name,
const xmlChar * prefix)
Search the DTD for the description of this qualified attribute on this element.
dtd: | a pointer to the DtD to search |
elem: | the element name |
name: | the attribute name |
prefix: | the attribute namespace prefix |
Returns: | the xmlAttributePtr if found or NULL |
xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar * name,
const xmlChar * prefix)
Search the DTD for the description of this element
dtd: | a pointer to the DtD to search |
name: | the element name |
prefix: | the element namespace prefix |
Returns: | the xmlElementPtr if found or NULL |
xmlAttrPtr xmlGetID (xmlDocPtr doc,
const xmlChar * ID)
Search the attribute declaring the given ID
doc: | pointer to the document |
ID: | the ID value |
Returns: | NULL if not found, otherwise the xmlAttrPtr defining the ID |
xmlListPtr xmlGetRefs (xmlDocPtr doc,
const xmlChar * ID)
DEPRECATED, do not use. This function will be removed from the public API. Find the set of references for the supplied ID.
doc: | pointer to the document |
ID: | the ID value |
Returns: | NULL if not found, otherwise node set for the ID. |
int xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr)
Determine whether an attribute is of type ID. In case we have DTD(s) then this is done if DTD loading has been requested. In the case of HTML documents parsed with the HTML parser, then ID detection is done systematically.
int xmlIsMixedElement (xmlDocPtr doc,
const xmlChar * name)
Search in the DtDs whether an element accept Mixed content (or ANY) basically if it is supposed to accept text childs
doc: | the document |
name: | the element name |
Returns: | 0 if no, 1 if yes, and -1 if no element description is available |
int xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr)
DEPRECATED, do not use. This function will be removed from the public API. 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).
xmlElementContentPtr xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar * name,
xmlElementContentType type)
Allocate an element content structure for the document.
doc: | the document |
name: | the subelement name or NULL |
type: | the type of element content decl |
Returns: | NULL if not, otherwise the new element content structure |
xmlElementContentPtr xmlNewElementContent (const xmlChar * name,
xmlElementContentType type)
Allocate an element content structure. Deprecated in favor of xmlNewDocElementContent
name: | the subelement name or NULL |
type: | the type of element content decl |
Returns: | NULL if not, otherwise the new element content structure |
xmlValidCtxtPtr xmlNewValidCtxt (void)
Allocate a validation context structure.
Returns: | NULL if not, otherwise the new validation context structure |
int xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr)
Remove the given attribute from the ID table maintained internally.
doc: | the document |
attr: | the attribute |
Returns: | -1 if the lookup failed and 0 otherwise |
int xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr)
DEPRECATED, do not use. This function will be removed from the public API. Remove the given attribute from the Ref table maintained internally.
doc: | the document |
attr: | the attribute |
Returns: | -1 if the lookup failed and 0 otherwise |
void xmlSnprintfElementContent (char * buf,
int size,
xmlElementContentPtr content,
int englob)
This will dump the content of the element content definition Intended just for the debug routine
buf: | an output buffer |
size: | the buffer size |
content: | An element table |
englob: | 1 if one must print the englobing parenthesis, 0 otherwise |
void xmlSprintfElementContent (char * buf,
xmlElementContentPtr content,
int englob)
Deprecated, unsafe, use xmlSnprintfElementContent
buf: | an output buffer |
content: | An element table |
englob: | 1 if one must print the englobing parenthesis, 0 otherwise |
int xmlValidBuildContentModel (xmlValidCtxtPtr ctxt,
xmlElementPtr elem)
(Re)Build the automata associated to the content model of this element
ctxt: | a validation context |
elem: | an element declaration node |
Returns: | 1 in case of success, 0 in case of error |
xmlChar * xmlValidCtxtNormalizeAttributeValue (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * name,
const xmlChar * value)
Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character. Also check VC: Standalone Document Declaration in P32, and update ctxt->valid accordingly
int xmlValidGetPotentialChildren (xmlElementContent * ctree,
const xmlChar ** names,
int * len,
int max)
Build/extend a list of potential children allowed by the content tree
ctree: | an element content tree |
names: | an array to store the list of child names |
len: | a pointer to the number of element in the list |
max: | the size of the array |
Returns: | the number of element in the list, or -1 in case of error. |
int xmlValidGetValidElements (xmlNode * prev,
xmlNode * next,
const xmlChar ** names,
int max)
This function returns the list of authorized children to insert within an existing tree while respecting the validity constraints forced by the Dtd. The insertion point is defined using @prev and @next in the following ways: to insert before 'node': xmlValidGetValidElements(node->prev, node, ... to insert next 'node': xmlValidGetValidElements(node, node->next, ... to replace 'node': xmlValidGetValidElements(node->prev, node->next, ... to prepend a child to 'node': xmlValidGetValidElements(NULL, node->childs, to append a child to 'node': xmlValidGetValidElements(node->last, NULL, ... pointers to the element names are inserted at the beginning of the array and do not need to be freed.
prev: | an element to insert after |
next: | an element to insert next |
names: | an array to store the list of child names |
max: | the size of the array |
Returns: | the number of element in the list, or -1 in case of error. If the function returns the value @max the caller is invited to grow the receiving array and retry. |
xmlChar * xmlValidNormalizeAttributeValue (xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * name,
const xmlChar * value)
Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character.
int xmlValidateAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr)
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
ctxt: | the validation context |
doc: | a document instance |
attr: | an attribute definition |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateAttributeValue (xmlAttributeType type,
const xmlChar * value)
Validate that the given attribute value match the proper production [ VC: ID ] Values of type ID must match the Name production.... [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names ... [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names ... [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.
int xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc)
Try to validate the document instance 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.
ctxt: | the validation context |
doc: | a document instance |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateDocumentFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc)
Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/IDREFS attributes definition for validity
ctxt: | the validation context |
doc: | a document instance |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd)
Try to validate the document against the dtd instance Basically it does check all the definitions in the DtD. Note the the internal subset (if present) is de-coupled (i.e. not used), which could give problems if ID or IDREF is present.
ctxt: | the validation context |
doc: | a document instance |
dtd: | a dtd instance |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc)
Does the final step for the dtds validation once all the subsets have been parsed basically it does the following checks described by the XML Rec - check that ENTITY and ENTITIES type attributes default or possible values matches one of the defined entities. - check that NOTATION type attributes default or possible values matches one of the defined notations.
ctxt: | the validation context |
doc: | a document instance |
Returns: | 1 if valid or 0 if invalid and -1 if not well-formed |
int xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem)
Try to validate the subtree under an element
ctxt: | the validation context |
doc: | a document instance |
elem: | an element instance |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem)
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 ]
ctxt: | the validation context |
doc: | a document instance |
elem: | an element definition |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNameValue (const xmlChar * value)
Validate that the given value match Name production
value: | an Name value |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNamesValue (const xmlChar * value)
Validate that the given value match Names production
value: | an Names value |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNmtokenValue (const xmlChar * value)
Validate that the given value match Nmtoken production [ VC: Name Token ]
value: | an Nmtoken value |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNmtokensValue (const xmlChar * value)
Validate that the given value match Nmtokens production [ VC: Name Token ]
value: | an Nmtokens value |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota)
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 constraint exists on notation declarations But this function get called anyway ...
ctxt: | the validation context |
doc: | a document instance |
nota: | a notation definition |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar * notationName)
Validate that the given name match a notation declaration. - [ VC: Notation Declared ]
ctxt: | the validation context |
doc: | the document |
notationName: | the notation name to check |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar * value)
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
int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem)
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. The ID/IDREF checkings are done separately
ctxt: | the validation context |
doc: | a document instance |
elem: | an element instance |
Returns: | 1 if valid or 0 otherwise |
int xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * prefix,
xmlNsPtr ns,
const xmlChar * value)
Try to validate a single namespace declaration 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
ctxt: | the validation context |
doc: | a document instance |
elem: | an element instance |
prefix: | the namespace prefix |
ns: | an namespace declaration instance |
value: | the attribute value (without entities processing) |
Returns: | 1 if valid or 0 otherwise |
int xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * qname)
Pop the element end from the validation stack.
ctxt: | the validation context |
doc: | a document instance |
elem: | an element instance |
qname: | the qualified name as appearing in the serialization |
Returns: | 1 if no validation problem was found or 0 otherwise |
int xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar * data,
int len)
check the CData parsed for validation in the current stack
ctxt: | the validation context |
data: | some character data read |
len: | the length of the data |
Returns: | 1 if no validation problem was found or 0 otherwise |
int xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar * qname)
Push a new element start on the validation stack.
ctxt: | the validation context |
doc: | a document instance |
elem: | an element instance |
qname: | the qualified name as appearing in the serialization |
Returns: | 1 if no validation problem was found or 0 otherwise |
int xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc)
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
ctxt: | the validation context |
doc: | a document instance |
Returns: | 1 if valid or 0 otherwise |