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
xmlNotation * | xmlAddNotationDecl (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.
xmlElementContent * | xmlNewElementContent (const xmlChar *name, xmlElementContentType type)
| Allocate an element content structure.
xmlElementContent * | xmlCopyElementContent (xmlElementContent *content)
| Build a copy of an element content description.
void | xmlFreeElementContent (xmlElementContent *cur)
| Free an element content structure.
xmlElementContent * | xmlNewDocElementContent (xmlDoc *doc, const xmlChar *name, xmlElementContentType type)
| Allocate an element content structure for the document.
xmlElementContent * | xmlCopyDocElementContent (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.
xmlElement * | xmlAddElementDecl (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.
xmlEnumeration * | xmlCreateEnumeration (const xmlChar *name)
| Create and initialize an enumeration attribute node.
void | xmlFreeEnumeration (xmlEnumeration *cur)
| Free an enumeration attribute node (recursive).
xmlEnumeration * | xmlCopyEnumeration (xmlEnumeration *cur)
| Copy an enumeration attribute node (recursive).
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.
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.
xmlID * | xmlAddID (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.
xmlAttr * | xmlGetID (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.
xmlValidCtxt * | xmlNewValidCtxt (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.
xmlChar * | xmlValidNormalizeAttributeValue (xmlDoc *doc, xmlNode *elem, const xmlChar *name, const xmlChar *value)
| Performs the validation-related extra step of the normalization of attribute values:
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:
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).
xmlAttribute * | xmlGetDtdAttrDesc (xmlDtd *dtd, const xmlChar *elem, const xmlChar *name)
| Search the DTD for the description of this attribute on this element.
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.
xmlNotation * | xmlGetDtdNotationDesc (xmlDtd *dtd, const xmlChar *name)
| Search the DTD for the description of this notation.
xmlElement * | xmlGetDtdQElementDesc (xmlDtd *dtd, const xmlChar *name, const xmlChar *prefix)
| Search the DTD for the description of this element.
xmlElement * | xmlGetDtdElementDesc (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.

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Typedef Documentation

## ◆ xmlValidityErrorFunc

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

Report a validity error.

Parameters

  ctx | user data (usually an xmlValidCtxt)
  msg | printf-like format string
  ... | arguments to format

## ◆ xmlValidityWarningFunc

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

Report a validity warning.

Parameters

  ctx | user data (usually an xmlValidCtxt)
  msg | printf-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.

Parameters

  ctxt | the validation context (optional)
  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
  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.

Parameters

  ctxt | the validation context (optional)
  dtd | pointer to the DTD
  name | the entity name
  type | the element type
  content | the 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

  ctxt | the validation context (optional)
  doc | pointer to the document, must equal attr->doc
  value | the attribute (ID) value
  attr | the 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

  attr | the attribute holding the ID
  value | the 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.

Parameters

  ctxt | the validation context (optional)
  dtd | pointer to the DTD
  name | the entity name
  publicId | the public identifier or NULL
  systemId | the 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

  ctxt | the validation context
  doc | pointer to the document
  value | the value name
  attr | the 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

  table | An 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

  doc | the document owning the element declaration
  cur | An 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

  cur | An 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

  table | An 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

  cur | the 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

  table | A 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

  name | the 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

  buf | the XML buffer output
  attr | An 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

  buf | the XML buffer output
  table | an 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

  buf | the XML buffer output
  elem | An 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

  buf | the XML buffer output
  table | An 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

  buf | the XML buffer output
  nota | A 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

  buf | the XML buffer output
  table | A notation table

## ◆ xmlFreeAttributeTable()

void xmlFreeAttributeTable | ( | xmlAttributeTable * | table | ) |

Deallocate the memory used by an entities hash table.

Deprecated
  Internal function, don't use.

Parameters

  table | An 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

  doc | the document owning the element declaration
  cur | the 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

  cur | the 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

  table | An element table

## ◆ xmlFreeEnumeration()

void xmlFreeEnumeration | ( | xmlEnumeration * | cur | ) |

Free an enumeration attribute node (recursive).

Parameters

  cur | the tree to free.

## ◆ xmlFreeIDTable()

void xmlFreeIDTable | ( | xmlIDTable * | table | ) |

Deallocate the memory used by an ID hash table.

Parameters

  table | An id table

## ◆ xmlFreeNotationTable()

void xmlFreeNotationTable | ( | xmlNotationTable * | table | ) |

Deallocate the memory used by an entities hash table.

Deprecated
  Internal function, don't use.

Parameters

  table | An 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

  table | a ref table

## ◆ xmlFreeValidCtxt()

void xmlFreeValidCtxt | ( | xmlValidCtxt * | cur | ) |

Free a validation context structure.

Parameters

  cur | the 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

  dtd | a pointer to the DtD to search
  elem | the element name
  name | the 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

  dtd | a pointer to the DtD to search
  name | the 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

  dtd | a pointer to the DtD to search
  name | the 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

  dtd | a pointer to the DtD to search
  elem | the element name
  name | the attribute name
  prefix | the 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

  dtd | a pointer to the DtD to search
  name | the element name
  prefix | the 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

  doc | pointer to the document
  ID | the 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

  doc | pointer to the document
  ID | the 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

  doc | the document
  elem | the element carrying the attribute
  attr | the 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).

Deprecated
  Internal function, don't use.

Parameters

  doc | the document
  name | the 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

  doc | the document
  elem | the element carrying the attribute
  attr | the 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

  doc | the document
  name | the subelement name or NULL
  type | the 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

  name | the subelement name or NULL
  type | the 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

  doc | the document
  attr | the 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

  doc | the document
  attr | the 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

  buf | an output buffer
  size | the buffer size
  content | An element table
  englob | 1 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

  buf | an output buffer
  content | An element table
  englob | 1 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

  ctxt | the validation context
  doc | a document instance
  attr | an 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

  type | an attribute type
  value | an 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

  vctxt | the validation context
  doc | a 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

  ctxt | the validation context
  doc | a 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

  ctxt | the validation context
  doc | a document instance
  dtd | a 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

  ctxt | the validation context
  doc | a 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

  ctxt | the validation context
  doc | a document instance
  root | an 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

  ctxt | the validation context
  doc | a document instance
  elem | an 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

  value | an 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

  value | an 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

  value | an 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

  value | an 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

  ctxt | the validation context
  doc | a document instance
  nota | a 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

  ctxt | the validation context
  doc | the document
  notationName | the 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

  ctxt | the validation context
  doc | a document instance
  elem | an element instance
  attr | an attribute instance
  value | the 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

  ctxt | the validation context
  doc | a document instance
  elem | an 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

  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.

## ◆ 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

  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.

## ◆ 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

  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.

## ◆ 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

  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.

## ◆ 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

  ctxt | the validation context
  doc | a 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

  ctxt | a validation context
  elem | an 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

  ctxt | the validation context
  doc | the document
  elem | the parent
  name | the attribute name
  value | the 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

  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.

## ◆ 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.

Deprecated
  This feature will be removed.

Parameters

  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.

## ◆ 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

  doc | the document
  elem | the parent
  name | the attribute name
  value | the attribute value

Returns
  a new normalized string if normalization is needed, NULL otherwise. The caller must free the returned value.