libxml2
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
valid.h File Reference

DTD validator. More...

Data Structures

struct  _xmlValidCtxt
 An xmlValidCtxt is used for error reporting when validating. More...
 

Typedefs

typedef void(* xmlValidityErrorFunc) (void *ctx, const char *msg,...)
 Report a validity error.
 
typedef void(* xmlValidityWarningFunc) (void *ctx, const char *msg,...)
 Report a validity warning.
 

Functions

xmlNotationxmlAddNotationDecl (xmlValidCtxt *ctxt, xmlDtd *dtd, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
 Register a new notation declaration.
 
xmlNotationTable * xmlCopyNotationTable (xmlNotationTable *table)
 Build a copy of a notation table.
 
void xmlFreeNotationTable (xmlNotationTable *table)
 Deallocate the memory used by an entities hash table.
 
void xmlDumpNotationDecl (xmlBuffer *buf, xmlNotation *nota)
 This will dump the content the notation declaration as an XML DTD definition.
 
void xmlDumpNotationTable (xmlBuffer *buf, xmlNotationTable *table)
 This will dump the content of the notation table as an XML DTD definition.
 
xmlElementContentxmlNewElementContent (const xmlChar *name, xmlElementContentType type)
 Allocate an element content structure.
 
xmlElementContentxmlCopyElementContent (xmlElementContent *content)
 Build a copy of an element content description.
 
void xmlFreeElementContent (xmlElementContent *cur)
 Free an element content structure.
 
xmlElementContentxmlNewDocElementContent (xmlDoc *doc, const xmlChar *name, xmlElementContentType type)
 Allocate an element content structure for the document.
 
xmlElementContentxmlCopyDocElementContent (xmlDoc *doc, xmlElementContent *content)
 Build a copy of an element content description.
 
void xmlFreeDocElementContent (xmlDoc *doc, xmlElementContent *cur)
 Free an element content structure.
 
void xmlSnprintfElementContent (char *buf, int size, xmlElementContent *content, int englob)
 This will dump the content of the element content definition Intended just for the debug routine.
 
void xmlSprintfElementContent (char *buf, xmlElementContent *content, int englob)
 Deprecated, unsafe, use xmlSnprintfElementContent()
 
xmlElementxmlAddElementDecl (xmlValidCtxt *ctxt, xmlDtd *dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContent *content)
 Register a new element declaration.
 
xmlElementTable * xmlCopyElementTable (xmlElementTable *table)
 Build a copy of an element table.
 
void xmlFreeElementTable (xmlElementTable *table)
 Deallocate the memory used by an element hash table.
 
void xmlDumpElementTable (xmlBuffer *buf, xmlElementTable *table)
 This will dump the content of the element table as an XML DTD definition.
 
void xmlDumpElementDecl (xmlBuffer *buf, xmlElement *elem)
 This will dump the content of the element declaration as an XML DTD definition.
 
xmlEnumerationxmlCreateEnumeration (const xmlChar *name)
 Create and initialize an enumeration attribute node.
 
void xmlFreeEnumeration (xmlEnumeration *cur)
 Free an enumeration attribute node (recursive).
 
xmlEnumerationxmlCopyEnumeration (xmlEnumeration *cur)
 Copy an enumeration attribute node (recursive).
 
xmlAttributexmlAddAttributeDecl (xmlValidCtxt *ctxt, xmlDtd *dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *ns, xmlAttributeType type, xmlAttributeDefault def, const xmlChar *defaultValue, xmlEnumeration *tree)
 Register a new attribute declaration.
 
xmlAttributeTable * xmlCopyAttributeTable (xmlAttributeTable *table)
 Build a copy of an attribute table.
 
void xmlFreeAttributeTable (xmlAttributeTable *table)
 Deallocate the memory used by an entities hash table.
 
void xmlDumpAttributeTable (xmlBuffer *buf, xmlAttributeTable *table)
 This will dump the content of the attribute table as an XML DTD definition.
 
void xmlDumpAttributeDecl (xmlBuffer *buf, xmlAttribute *attr)
 This will dump the content of the attribute declaration as an XML DTD definition.
 
int xmlAddIDSafe (xmlAttr *attr, const xmlChar *value)
 Add an attribute to the docment's ID table.
 
xmlIDxmlAddID (xmlValidCtxt *ctxt, xmlDoc *doc, const xmlChar *value, xmlAttr *attr)
 Add an attribute to the docment's ID table.
 
void xmlFreeIDTable (xmlIDTable *table)
 Deallocate the memory used by an ID hash table.
 
xmlAttrxmlGetID (xmlDoc *doc, const xmlChar *ID)
 Search the document's ID table for the attribute with the given ID.
 
int xmlIsID (xmlDoc *doc, xmlNode *elem, xmlAttr *attr)
 Determine whether an attribute is of type ID.
 
int xmlRemoveID (xmlDoc *doc, xmlAttr *attr)
 Remove the given attribute from the document's ID table.
 
xmlRef * xmlAddRef (xmlValidCtxt *ctxt, xmlDoc *doc, const xmlChar *value, xmlAttr *attr)
 Register a new ref declaration.
 
void xmlFreeRefTable (xmlRefTable *table)
 Deallocate the memory used by an Ref hash table.
 
int xmlIsRef (xmlDoc *doc, xmlNode *elem, xmlAttr *attr)
 Determine whether an attribute is of type Ref.
 
int xmlRemoveRef (xmlDoc *doc, xmlAttr *attr)
 Remove the given attribute from the Ref table maintained internally.
 
xmlList * xmlGetRefs (xmlDoc *doc, const xmlChar *ID)
 Find the set of references for the supplied ID.
 
xmlValidCtxtxmlNewValidCtxt (void)
 The public function calls related to validity checking.
 
void xmlFreeValidCtxt (xmlValidCtxt *)
 Free a validation context structure.
 
int xmlValidateRoot (xmlValidCtxt *ctxt, xmlDoc *doc)
 Try to validate the root element.
 
int xmlValidateElementDecl (xmlValidCtxt *ctxt, xmlDoc *doc, xmlElement *elem)
 Try to validate a single element definition.
 
xmlCharxmlValidNormalizeAttributeValue (xmlDoc *doc, xmlNode *elem, const xmlChar *name, const xmlChar *value)
 Performs the validation-related extra step of the normalization of attribute values:
 
xmlCharxmlValidCtxtNormalizeAttributeValue (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem, const xmlChar *name, const xmlChar *value)
 Performs the validation-related extra step of the normalization of attribute values:
 
int xmlValidateAttributeDecl (xmlValidCtxt *ctxt, xmlDoc *doc, xmlAttribute *attr)
 Try to validate a single attribute definition.
 
int xmlValidateAttributeValue (xmlAttributeType type, const xmlChar *value)
 Validate that the given attribute value matches the proper production.
 
int xmlValidateNotationDecl (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNotation *nota)
 Try to validate a single notation definition.
 
int xmlValidateDtd (xmlValidCtxt *ctxt, xmlDoc *doc, xmlDtd *dtd)
 Try to validate the document against the DTD instance.
 
int xmlValidateDtdFinal (xmlValidCtxt *ctxt, xmlDoc *doc)
 Performs the final validation steps of DTD content once all the subsets have been parsed.
 
int xmlValidateDocument (xmlValidCtxt *ctxt, xmlDoc *doc)
 Try to validate the document instance.
 
int xmlValidateElement (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem)
 Try to validate the subtree under an element.
 
int xmlValidateOneElement (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem)
 Try to validate a single element and its attributes.
 
int xmlValidateOneAttribute (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem, xmlAttr *attr, const xmlChar *value)
 Try to validate a single attribute for an element.
 
int xmlValidateOneNamespace (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem, const xmlChar *prefix, xmlNs *ns, const xmlChar *value)
 Try to validate a single namespace declaration for an element.
 
int xmlValidateDocumentFinal (xmlValidCtxt *ctxt, xmlDoc *doc)
 Performs the final step of document validation once all the incremental validation steps have been completed.
 
int xmlValidateNotationUse (xmlValidCtxt *ctxt, xmlDoc *doc, const xmlChar *notationName)
 Validate that the given name match a notation declaration.
 
int xmlIsMixedElement (xmlDoc *doc, const xmlChar *name)
 Search in the DTDs whether an element accepts mixed content or ANY (basically if it is supposed to accept text children).
 
xmlAttributexmlGetDtdAttrDesc (xmlDtd *dtd, const xmlChar *elem, const xmlChar *name)
 Search the DTD for the description of this attribute on this element.
 
xmlAttributexmlGetDtdQAttrDesc (xmlDtd *dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *prefix)
 Search the DTD for the description of this qualified attribute on this element.
 
xmlNotationxmlGetDtdNotationDesc (xmlDtd *dtd, const xmlChar *name)
 Search the DTD for the description of this notation.
 
xmlElementxmlGetDtdQElementDesc (xmlDtd *dtd, const xmlChar *name, const xmlChar *prefix)
 Search the DTD for the description of this element.
 
xmlElementxmlGetDtdElementDesc (xmlDtd *dtd, const xmlChar *name)
 Search the DTD for the description of this element.
 
int xmlValidGetPotentialChildren (xmlElementContent *ctree, const xmlChar **names, int *len, int max)
 Build/extend a list of potential children allowed by the content tree.
 
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.
 
int xmlValidateNameValue (const xmlChar *value)
 Validate that the given value matches the Name production.
 
int xmlValidateNamesValue (const xmlChar *value)
 Validate that the given value matches the Names production.
 
int xmlValidateNmtokenValue (const xmlChar *value)
 Validate that the given value matches the Nmtoken production.
 
int xmlValidateNmtokensValue (const xmlChar *value)
 Validate that the given value matches the Nmtokens production.
 
int xmlValidBuildContentModel (xmlValidCtxt *ctxt, xmlElement *elem)
 (Re)Build the automata associated to the content model of this element
 
int xmlValidatePushElement (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem, const xmlChar *qname)
 Push a new element start on the validation stack.
 
int xmlValidatePushCData (xmlValidCtxt *ctxt, const xmlChar *data, int len)
 Check the CData parsed for validation in the current stack.
 
int xmlValidatePopElement (xmlValidCtxt *ctxt, xmlDoc *doc, xmlNode *elem, const xmlChar *qname)
 Pop the element end from the validation stack.
 

Detailed Description

DTD validator.

API to handle XML Document Type Definitions and validate documents.

Author
Daniel Veillard

Typedef Documentation

◆ xmlValidityErrorFunc

typedef void(* xmlValidityErrorFunc) (void *ctx, const char *msg,...)

Report a validity error.

Parameters
ctxuser data (usually an xmlValidCtxt)
msgprintf-like format string
...arguments to format

◆ xmlValidityWarningFunc

typedef void(* xmlValidityWarningFunc) (void *ctx, const char *msg,...)

Report a validity warning.

Parameters
ctxuser data (usually an xmlValidCtxt)
msgprintf-like format string
...arguments to format

Function Documentation

◆ xmlAddAttributeDecl()

xmlAttribute * xmlAddAttributeDecl ( xmlValidCtxt ctxt,
xmlDtd dtd,
const xmlChar elem,
const xmlChar name,
const xmlChar ns,
xmlAttributeType  type,
xmlAttributeDefault  def,
const xmlChar defaultValue,
xmlEnumeration tree 
)

Register a new attribute declaration.

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
dtdpointer to the DTD
elemthe element name
namethe attribute name
nsthe attribute namespace prefix
typethe attribute type
defthe attribute default type
defaultValuethe attribute default value
treeif it's an enumeration, the associated list
Returns
the attribute decl or NULL on error.

◆ xmlAddElementDecl()

xmlElement * xmlAddElementDecl ( xmlValidCtxt ctxt,
xmlDtd dtd,
const xmlChar name,
xmlElementTypeVal  type,
xmlElementContent content 
)

Register a new element declaration.

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
dtdpointer to the DTD
namethe entity name
typethe element type
contentthe element content tree or NULL
Returns
the entity or NULL on error.

◆ xmlAddID()

xmlID * xmlAddID ( xmlValidCtxt ctxt,
xmlDoc doc,
const xmlChar value,
xmlAttr attr 
)

Add an attribute to the docment's ID table.

Parameters
ctxtthe validation context (optional)
docpointer to the document, must equal attr->doc
valuethe attribute (ID) value
attrthe attribute holding the ID
Returns
the new xmlID or NULL on error.

◆ xmlAddIDSafe()

int xmlAddIDSafe ( xmlAttr attr,
const xmlChar value 
)

Add an attribute to the docment's ID table.

Since
2.13.0
Parameters
attrthe attribute holding the ID
valuethe attribute (ID) value
Returns
1 on success, 0 if the ID already exists, -1 if a memory allocation fails.

◆ xmlAddNotationDecl()

xmlNotation * xmlAddNotationDecl ( xmlValidCtxt ctxt,
xmlDtd dtd,
const xmlChar name,
const xmlChar publicId,
const xmlChar systemId 
)

Register a new notation declaration.

Deprecated:
Internal function, don't use.
Parameters
dtdpointer to the DTD
ctxtthe validation context
namethe entity name
publicIdthe public identifier or NULL
systemIdthe system identifier or NULL
Returns
the notation or NULL on error.

◆ xmlAddRef()

xmlRef * xmlAddRef ( xmlValidCtxt ctxt,
xmlDoc doc,
const xmlChar value,
xmlAttr attr 
)

Register a new ref declaration.

Deprecated:
Don't use. This function will be removed from the public API.
Parameters
ctxtthe validation context
docpointer to the document
valuethe value name
attrthe attribute holding the Ref
Returns
the new xmlRef or NULL o error.

◆ xmlCopyAttributeTable()

xmlAttributeTable * xmlCopyAttributeTable ( xmlAttributeTable *  table)

Build a copy of an attribute table.

Deprecated:
Internal function, don't use.
Parameters
tableAn attribute table
Returns
the new xmlAttributeTable or NULL in case of error.

◆ xmlCopyDocElementContent()

xmlElementContent * xmlCopyDocElementContent ( xmlDoc doc,
xmlElementContent cur 
)

Build a copy of an element content description.

Deprecated:
Internal function, don't use.
Parameters
docthe document owning the element declaration
curAn element content pointer.
Returns
the new xmlElementContent or NULL in case of error.

◆ xmlCopyElementContent()

xmlElementContent * xmlCopyElementContent ( xmlElementContent cur)

Build a copy of an element content description.

Deprecated, use xmlCopyDocElementContent() instead

Deprecated:
Internal function, don't use.
Parameters
curAn element content pointer.
Returns
the new xmlElementContent or NULL in case of error.

◆ xmlCopyElementTable()

xmlElementTable * xmlCopyElementTable ( xmlElementTable *  table)

Build a copy of an element table.

Deprecated:
Internal function, don't use.
Parameters
tableAn element table
Returns
the new xmlElementTable or NULL in case of error.

◆ xmlCopyEnumeration()

xmlEnumeration * xmlCopyEnumeration ( xmlEnumeration cur)

Copy an enumeration attribute node (recursive).

Deprecated:
Internal function, don't use.
Parameters
curthe tree to copy.
Returns
the xmlEnumeration just created or NULL in case of error.

◆ xmlCopyNotationTable()

xmlNotationTable * xmlCopyNotationTable ( xmlNotationTable *  table)

Build a copy of a notation table.

Deprecated:
Internal function, don't use.
Parameters
tableA notation table
Returns
the new xmlNotationTable or NULL in case of error.

◆ xmlCreateEnumeration()

xmlEnumeration * xmlCreateEnumeration ( const xmlChar name)

Create and initialize an enumeration attribute node.

Deprecated:
Internal function, don't use.
Parameters
namethe enumeration name or NULL
Returns
the xmlEnumeration just created or NULL in case of error.

◆ xmlDumpAttributeDecl()

void xmlDumpAttributeDecl ( xmlBuffer buf,
xmlAttribute attr 
)

This will dump the content of the attribute declaration as an XML DTD definition.

Deprecated:
Use xmlSaveTree().
Parameters
bufthe XML buffer output
attrAn attribute declaration

◆ xmlDumpAttributeTable()

void xmlDumpAttributeTable ( xmlBuffer buf,
xmlAttributeTable *  table 
)

This will dump the content of the attribute table as an XML DTD definition.

Deprecated:
Don't use.
Parameters
bufthe XML buffer output
tablean attribute table

◆ xmlDumpElementDecl()

void xmlDumpElementDecl ( xmlBuffer buf,
xmlElement elem 
)

This will dump the content of the element declaration as an XML DTD definition.

Deprecated:
Use xmlSaveTree().
Parameters
bufthe XML buffer output
elemAn element table

◆ xmlDumpElementTable()

void xmlDumpElementTable ( xmlBuffer buf,
xmlElementTable *  table 
)

This will dump the content of the element table as an XML DTD definition.

Deprecated:
Don't use.
Parameters
bufthe XML buffer output
tableAn element table

◆ xmlDumpNotationDecl()

void xmlDumpNotationDecl ( xmlBuffer buf,
xmlNotation nota 
)

This will dump the content the notation declaration as an XML DTD definition.

Deprecated:
Don't use.
Parameters
bufthe XML buffer output
notaA notation declaration

◆ xmlDumpNotationTable()

void xmlDumpNotationTable ( xmlBuffer buf,
xmlNotationTable *  table 
)

This will dump the content of the notation table as an XML DTD definition.

Deprecated:
Don't use.
Parameters
bufthe XML buffer output
tableA notation table

◆ xmlFreeAttributeTable()

void xmlFreeAttributeTable ( xmlAttributeTable *  table)

Deallocate the memory used by an entities hash table.

Deprecated:
Internal function, don't use.
Parameters
tableAn attribute table

◆ xmlFreeDocElementContent()

void xmlFreeDocElementContent ( xmlDoc doc,
xmlElementContent cur 
)

Free an element content structure.

The whole subtree is removed.

Deprecated:
Internal function, don't use.
Parameters
docthe document owning the element declaration
curthe element content tree to free

◆ xmlFreeElementContent()

void xmlFreeElementContent ( xmlElementContent cur)

Free an element content structure.

The whole subtree is removed. Deprecated, use xmlFreeDocElementContent() instead

Deprecated:
Internal function, don't use.
Parameters
curthe element content tree to free

◆ xmlFreeElementTable()

void xmlFreeElementTable ( xmlElementTable *  table)

Deallocate the memory used by an element hash table.

Deprecated:
Internal function, don't use.
Parameters
tableAn element table

◆ xmlFreeEnumeration()

void xmlFreeEnumeration ( xmlEnumeration cur)

Free an enumeration attribute node (recursive).

Parameters
curthe tree to free.

◆ xmlFreeIDTable()

void xmlFreeIDTable ( xmlIDTable *  table)

Deallocate the memory used by an ID hash table.

Parameters
tableAn id table

◆ xmlFreeNotationTable()

void xmlFreeNotationTable ( xmlNotationTable *  table)

Deallocate the memory used by an entities hash table.

Deprecated:
Internal function, don't use.
Parameters
tableAn notation table

◆ xmlFreeRefTable()

void xmlFreeRefTable ( xmlRefTable *  table)

Deallocate the memory used by an Ref hash table.

Deprecated:
Don't use. This function will be removed from the public API.
Parameters
tablea ref table

◆ xmlFreeValidCtxt()

void xmlFreeValidCtxt ( xmlValidCtxt cur)

Free a validation context structure.

Parameters
curthe validation context to free

◆ xmlGetDtdAttrDesc()

xmlAttribute * xmlGetDtdAttrDesc ( xmlDtd dtd,
const xmlChar elem,
const xmlChar name 
)

Search the DTD for the description of this attribute on this element.

Parameters
dtda pointer to the DtD to search
elemthe element name
namethe attribute name
Returns
the xmlAttribute or NULL if not found.

◆ xmlGetDtdElementDesc()

xmlElement * xmlGetDtdElementDesc ( xmlDtd dtd,
const xmlChar name 
)

Search the DTD for the description of this element.

NOTE: A NULL return value can also mean that a memory allocation failed.

Parameters
dtda pointer to the DtD to search
namethe element name
Returns
the xmlElement or NULL if not found.

◆ xmlGetDtdNotationDesc()

xmlNotation * xmlGetDtdNotationDesc ( xmlDtd dtd,
const xmlChar name 
)

Search the DTD for the description of this notation.

Parameters
dtda pointer to the DtD to search
namethe notation name
Returns
the xmlNotation or NULL if not found.

◆ xmlGetDtdQAttrDesc()

xmlAttribute * xmlGetDtdQAttrDesc ( xmlDtd dtd,
const xmlChar elem,
const xmlChar name,
const xmlChar prefix 
)

Search the DTD for the description of this qualified attribute on this element.

Parameters
dtda pointer to the DtD to search
elemthe element name
namethe attribute name
prefixthe attribute namespace prefix
Returns
the xmlAttribute or NULL if not found.

◆ xmlGetDtdQElementDesc()

xmlElement * xmlGetDtdQElementDesc ( xmlDtd dtd,
const xmlChar name,
const xmlChar prefix 
)

Search the DTD for the description of this element.

Parameters
dtda pointer to the DtD to search
namethe element name
prefixthe element namespace prefix
Returns
the xmlElement or NULL if not found.

◆ xmlGetID()

xmlAttr * xmlGetID ( xmlDoc doc,
const xmlChar ID 
)

Search the document's ID table for the attribute with the given ID.

Parameters
docpointer to the document
IDthe ID value
Returns
the attribute or NULL if not found.

◆ xmlGetRefs()

xmlList * xmlGetRefs ( xmlDoc doc,
const xmlChar ID 
)

Find the set of references for the supplied ID.

Deprecated:
Don't use. This function will be removed from the public API.
Parameters
docpointer to the document
IDthe ID value
Returns
the list of nodes matching the ID or NULL on error.

◆ xmlIsID()

int xmlIsID ( xmlDoc doc,
xmlNode elem,
xmlAttr 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 case of HTML documents parsed with the HTML parser, ID detection is done systematically.

Parameters
docthe document
elemthe element carrying the attribute
attrthe attribute
Returns
0 or 1 depending on the lookup result or -1 if a memory allocation failed.

◆ xmlIsMixedElement()

int xmlIsMixedElement ( xmlDoc doc,
const xmlChar name 
)

Search in the DTDs whether an element accepts mixed content or ANY (basically if it is supposed to accept text children).

Parameters
docthe document
namethe element name
Returns
0 if no, 1 if yes, and -1 if no element description is available.

◆ xmlIsRef()

int xmlIsRef ( xmlDoc doc,
xmlNode elem,
xmlAttr attr 
)

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).

Deprecated:
Don't use. This function will be removed from the public API.
Parameters
docthe document
elemthe element carrying the attribute
attrthe attribute
Returns
0 or 1 depending on the lookup result.

◆ xmlNewDocElementContent()

xmlElementContent * xmlNewDocElementContent ( xmlDoc doc,
const xmlChar name,
xmlElementContentType  type 
)

Allocate an element content structure for the document.

Deprecated:
Internal function, don't use.
Parameters
docthe document
namethe subelement name or NULL
typethe type of element content decl
Returns
the new element content structure or NULL on error.

◆ xmlNewElementContent()

xmlElementContent * xmlNewElementContent ( const xmlChar name,
xmlElementContentType  type 
)

Allocate an element content structure.

Deprecated in favor of xmlNewDocElementContent()

Deprecated:
Internal function, don't use.
Parameters
namethe subelement name or NULL
typethe type of element content decl
Returns
the new element content structure or NULL on error.

◆ xmlNewValidCtxt()

xmlValidCtxt * xmlNewValidCtxt ( void  )

The public function calls related to validity checking.

The public function calls related to validity checking.

Returns
the new validation context or NULL if a memory allocation failed.

◆ xmlRemoveID()

int xmlRemoveID ( xmlDoc doc,
xmlAttr attr 
)

Remove the given attribute from the document's ID table.

Parameters
docthe document
attrthe attribute
Returns
-1 if the lookup failed and 0 otherwise.

◆ xmlRemoveRef()

int xmlRemoveRef ( xmlDoc doc,
xmlAttr attr 
)

Remove the given attribute from the Ref table maintained internally.

Deprecated:
Don't use. This function will be removed from the public API.
Parameters
docthe document
attrthe attribute
Returns
-1 if the lookup failed and 0 otherwise.

◆ xmlSnprintfElementContent()

void xmlSnprintfElementContent ( char *  buf,
int  size,
xmlElementContent content,
int  englob 
)

This will dump the content of the element content definition Intended just for the debug routine.

Deprecated:
Internal function, don't use.
Parameters
bufan output buffer
sizethe buffer size
contentAn element table
englob1 if one must print the englobing parenthesis, 0 otherwise

◆ xmlSprintfElementContent()

void xmlSprintfElementContent ( char *  buf,
xmlElementContent content,
int  englob 
)

Deprecated, unsafe, use xmlSnprintfElementContent()

Deprecated:
Internal function, don't use.
Parameters
bufan output buffer
contentAn element table
englob1 if one must print the englobing parenthesis, 0 otherwise

◆ xmlValidateAttributeDecl()

int xmlValidateAttributeDecl ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlAttribute attr 
)

Try to validate a single attribute definition.

Performs the following checks as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: Attribute Default Legal ]
  • [ VC: Enumeration ]
  • [ VC: ID Attribute Default ]

The ID/IDREF uniqueness and matching are done separately.

Parameters
ctxtthe validation context
doca document instance
attran attribute definition
Returns
1 if valid or 0 otherwise.

◆ xmlValidateAttributeValue()

int xmlValidateAttributeValue ( xmlAttributeType  type,
const xmlChar value 
)

Validate that the given attribute value matches the proper production.

Deprecated:
Internal function, don't use.

[ 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.

Parameters
typean attribute type
valuean attribute value
Returns
1 if valid or 0 otherwise.

◆ xmlValidateDocument()

int xmlValidateDocument ( xmlValidCtxt vctxt,
xmlDoc doc 
)

Try to validate the document instance.

Deprecated:
This function can't report malloc or other failures. Use xmlCtxtValidateDocument().

Performs the all the checks described by the XML Rec, i.e. validates the internal and external subset (if present) and validates the document tree.

Parameters
vctxtthe validation context
doca document instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidateDocumentFinal()

int xmlValidateDocumentFinal ( xmlValidCtxt ctxt,
xmlDoc doc 
)

Performs the final step of document validation once all the incremental validation steps have been completed.

Deprecated:
Internal function, don't use.

Performs the following checks described by the XML Rec:

  • Check all the IDREF/IDREFS attributes definition for validity.
Parameters
ctxtthe validation context
doca document instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidateDtd()

int xmlValidateDtd ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlDtd dtd 
)

Try to validate the document against the DTD instance.

Note that the internal subset (if present) is de-coupled (i.e. not used), which could cause problems if ID or IDREF attributes are present.

Parameters
ctxtthe validation context
doca document instance
dtda DTD instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidateDtdFinal()

int xmlValidateDtdFinal ( xmlValidCtxt ctxt,
xmlDoc doc 
)

Performs the final validation steps of DTD content once all the subsets have been parsed.

Deprecated:
Internal function, don't use.

Performs 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.
Parameters
ctxtthe validation context
doca document instance
Returns
1 if valid or 0 if invalid and -1 if not well-formed.

◆ xmlValidateElement()

int xmlValidateElement ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode root 
)

Try to validate the subtree under an element.

Parameters
ctxtthe validation context
doca document instance
rootan element instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidateElementDecl()

int xmlValidateElementDecl ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlElement elem 
)

Try to validate a single element definition.

Performs the following checks as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: One ID per Element Type ]
  • [ VC: No Duplicate Types ]
  • [ VC: Unique Element Type Declaration ]
Parameters
ctxtthe validation context
doca document instance
eleman element definition
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNamesValue()

int xmlValidateNamesValue ( const xmlChar value)

Validate that the given value matches the Names production.

Parameters
valuean Names value
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNameValue()

int xmlValidateNameValue ( const xmlChar value)

Validate that the given value matches the Name production.

Parameters
valuean Name value
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNmtokensValue()

int xmlValidateNmtokensValue ( const xmlChar value)

Validate that the given value matches the Nmtokens production.

[ VC: Name Token ]

Parameters
valuean Nmtokens value
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNmtokenValue()

int xmlValidateNmtokenValue ( const xmlChar value)

Validate that the given value matches the Nmtoken production.

[ VC: Name Token ]

Parameters
valuean Nmtoken value
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNotationDecl()

int xmlValidateNotationDecl ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNotation nota 
)

Try to validate a single notation definition.

Deprecated:
Internal function, don't use.

It seems that no validity constraint exists on notation declarations. But this function gets called anyway ...

Parameters
ctxtthe validation context
doca document instance
notaa notation definition
Returns
1 if valid or 0 otherwise.

◆ xmlValidateNotationUse()

int xmlValidateNotationUse ( xmlValidCtxt ctxt,
xmlDoc doc,
const xmlChar notationName 
)

Validate that the given name match a notation declaration.

[ VC: Notation Declared ]

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
docthe document
notationNamethe notation name to check
Returns
1 if valid or 0 otherwise.

◆ xmlValidateOneAttribute()

int xmlValidateOneAttribute ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem,
xmlAttr attr,
const xmlChar value 
)

Try to validate a single attribute for an element.

Performs the following checks as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: Attribute Value Type ]
  • [ VC: Fixed Attribute Default ]
  • [ VC: Entity Name ]
  • [ VC: Name Token ]
  • [ VC: ID ]
  • [ VC: IDREF ]
  • [ VC: Entity Name ]
  • [ VC: Notation Attributes ]

ID/IDREF uniqueness and matching are handled separately.

Parameters
ctxtthe validation context
doca document instance
eleman element instance
attran attribute instance
valuethe attribute value (without entities processing)
Returns
1 if valid or 0 otherwise.

◆ xmlValidateOneElement()

int xmlValidateOneElement ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem 
)

Try to validate a single element and its attributes.

Performs the following checks as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: Element Valid ]
  • [ VC: Required Attribute ]

Then calls xmlValidateOneAttribute() for each attribute present.

ID/IDREF checks are handled separately.

Parameters
ctxtthe validation context
doca document instance
eleman element instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidateOneNamespace()

int xmlValidateOneNamespace ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem,
const xmlChar prefix,
xmlNs ns,
const xmlChar value 
)

Try to validate a single namespace declaration for an element.

Performs the following checks as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: Attribute Value Type ]
  • [ VC: Fixed Attribute Default ]
  • [ VC: Entity Name ]
  • [ VC: Name Token ]
  • [ VC: ID ]
  • [ VC: IDREF ]
  • [ VC: Entity Name ]
  • [ VC: Notation Attributes ]

ID/IDREF uniqueness and matching are handled separately.

Parameters
ctxtthe validation context
doca document instance
eleman element instance
prefixthe namespace prefix
nsan namespace declaration instance
valuethe attribute value (without entities processing)
Returns
1 if valid or 0 otherwise.

◆ xmlValidatePopElement()

int xmlValidatePopElement ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem,
const xmlChar qname 
)

Pop the element end from the validation stack.

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
doca document instance
eleman element instance
qnamethe qualified name as appearing in the serialization
Returns
1 if no validation problem was found or 0 otherwise.

◆ xmlValidatePushCData()

int xmlValidatePushCData ( xmlValidCtxt ctxt,
const xmlChar data,
int  len 
)

Check the CData parsed for validation in the current stack.

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
datasome character data read
lenthe length of the data
Returns
1 if no validation problem was found or 0 otherwise.

◆ xmlValidatePushElement()

int xmlValidatePushElement ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem,
const xmlChar qname 
)

Push a new element start on the validation stack.

Deprecated:
Internal function, don't use.
Parameters
ctxtthe validation context
doca document instance
eleman element instance
qnamethe qualified name as appearing in the serialization
Returns
1 if no validation problem was found or 0 otherwise.

◆ xmlValidateRoot()

int xmlValidateRoot ( xmlValidCtxt ctxt,
xmlDoc doc 
)

Try to validate the root element.

Performs the following check as described by the XML-1.0 recommendation:

Deprecated:
Internal function, don't use.
  • [ VC: Root Element Type ]

It doesn't try to recurse or apply other checks to the element.

Parameters
ctxtthe validation context
doca document instance
Returns
1 if valid or 0 otherwise.

◆ xmlValidBuildContentModel()

int xmlValidBuildContentModel ( xmlValidCtxt ctxt,
xmlElement elem 
)

(Re)Build the automata associated to the content model of this element

Deprecated:
Internal function, don't use.
Parameters
ctxta validation context
eleman element declaration node
Returns
1 in case of success, 0 in case of error

◆ xmlValidCtxtNormalizeAttributeValue()

xmlChar * xmlValidCtxtNormalizeAttributeValue ( xmlValidCtxt ctxt,
xmlDoc doc,
xmlNode elem,
const xmlChar name,
const xmlChar value 
)

Performs the validation-related extra step of the normalization of attribute values:

Deprecated:
Internal function, don't use.

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

Parameters
ctxtthe validation context
docthe document
elemthe parent
namethe attribute name
valuethe attribute value
Returns
a new normalized string if normalization is needed, NULL otherwise. The caller must free the returned value.

◆ xmlValidGetPotentialChildren()

int xmlValidGetPotentialChildren ( xmlElementContent ctree,
const xmlChar **  names,
int *  len,
int  max 
)

Build/extend a list of potential children allowed by the content tree.

Parameters
ctreean element content tree
namesan array to store the list of child names
lena pointer to the number of element in the list
maxthe size of the array
Returns
the number of element in the list, or -1 in case of error.

◆ xmlValidGetValidElements()

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.

Parameters
prevan element to insert after
nextan element to insert next
namesan array to store the list of child names
maxthe 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.

◆ xmlValidNormalizeAttributeValue()

xmlChar * xmlValidNormalizeAttributeValue ( xmlDoc doc,
xmlNode elem,
const xmlChar name,
const xmlChar value 
)

Performs the validation-related extra step of the normalization of attribute values:

Deprecated:
Internal function, don't use.

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.

Parameters
docthe document
elemthe parent
namethe attribute name
valuethe attribute value
Returns
a new normalized string if normalization is needed, NULL otherwise. The caller must free the returned value.