Blame doc/html/libxml-xmlregexp.html

Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
Packit Service a31ea6
TD {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
Packit Service a31ea6
H1 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H2 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H3 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
A:link, A:visited, A:active { text-decoration: underline }
Packit Service a31ea6
</style><style type="text/css">
Packit Service a31ea6
      div.deprecated pre.programlisting {border-style: double;border-color:red}
Packit Service a31ea6
      pre.programlisting {border-style: double;background: #EECFA1}
Packit Service a31ea6
    </style><title>Module xmlregexp from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlregexp from libxml2

<center>API Menu</center>
<form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form>
<center>API Indexes</center>
<center>Related links</center>

basic API for libxml regular expressions handling used for XML Schemas and validation.

Table of Contents

Structure xmlExpCtxt
struct _xmlExpCtxt
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
Typedef xmlExpCtxt * xmlExpCtxtPtr
Packit Service a31ea6
Structure xmlExpNode
struct _xmlExpNode
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
Typedef xmlExpNode * xmlExpNodePtr
Packit Service a31ea6
Enum xmlExpNodeType
Packit Service a31ea6
Structure xmlRegExecCtxt
struct _xmlRegExecCtxt
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
Typedef xmlRegExecCtxt * xmlRegExecCtxtPtr
Packit Service a31ea6
Structure xmlRegexp
struct _xmlRegexp
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
Typedef xmlRegexp * xmlRegexpPtr
Packit Service a31ea6
int	xmlExpCtxtNbCons		(xmlExpCtxtPtr ctxt)
Packit Service a31ea6
int	xmlExpCtxtNbNodes		(xmlExpCtxtPtr ctxt)
Packit Service a31ea6
void	xmlExpDump			(xmlBufferPtr buf, 
xmlExpNodePtr expr)
Packit Service a31ea6
xmlExpNodePtr	xmlExpExpDerive		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
xmlExpNodePtr sub)
Packit Service a31ea6
void	xmlExpFree			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp)
Packit Service a31ea6
void	xmlExpFreeCtxt			(xmlExpCtxtPtr ctxt)
Packit Service a31ea6
int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar ** langList,
int len)
Packit Service a31ea6
int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar ** tokList,
int len)
Packit Service a31ea6
int	xmlExpIsNillable		(xmlExpNodePtr exp)
Packit Service a31ea6
int	xmlExpMaxToken			(xmlExpNodePtr expr)
Packit Service a31ea6
xmlExpNodePtr	xmlExpNewAtom		(xmlExpCtxtPtr ctxt, 
const xmlChar * name,
int len)
Packit Service a31ea6
xmlExpCtxtPtr	xmlExpNewCtxt		(int maxNodes, 
xmlDictPtr dict)
Packit Service a31ea6
xmlExpNodePtr	xmlExpNewOr		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
Packit Service a31ea6
xmlExpNodePtr	xmlExpNewRange		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr subset,
int min,
int max)
Packit Service a31ea6
xmlExpNodePtr	xmlExpNewSeq		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
Packit Service a31ea6
xmlExpNodePtr	xmlExpParse		(xmlExpCtxtPtr ctxt, 
const char * expr)
Packit Service a31ea6
void	xmlExpRef			(xmlExpNodePtr exp)
Packit Service a31ea6
xmlExpNodePtr	xmlExpStringDerive	(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar * str,
int len)
Packit Service a31ea6
int	xmlExpSubsume			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
xmlExpNodePtr sub)
Packit Service a31ea6
Function type: xmlRegExecCallbacks
Packit Service a31ea6
void	xmlRegExecCallbacks		(xmlRegExecCtxtPtr exec, 
const xmlChar * token,
void * transdata,
void * inputdata)
Packit Service a31ea6
Packit Service a31ea6
int	xmlRegExecErrInfo		(xmlRegExecCtxtPtr exec, 
const xmlChar ** string,
int * nbval,
int * nbneg,
xmlChar ** values,
int * terminal)
Packit Service a31ea6
int	xmlRegExecNextValues		(xmlRegExecCtxtPtr exec, 
int * nbval,
int * nbneg,
xmlChar ** values,
int * terminal)
Packit Service a31ea6
int	xmlRegExecPushString		(xmlRegExecCtxtPtr exec, 
const xmlChar * value,
void * data)
Packit Service a31ea6
int	xmlRegExecPushString2		(xmlRegExecCtxtPtr exec, 
const xmlChar * value,
const xmlChar * value2,
void * data)
Packit Service a31ea6
void	xmlRegFreeExecCtxt		(xmlRegExecCtxtPtr exec)
Packit Service a31ea6
void	xmlRegFreeRegexp		(xmlRegexpPtr regexp)
Packit Service a31ea6
xmlRegExecCtxtPtr	xmlRegNewExecCtxt	(xmlRegexpPtr comp, 
xmlRegExecCallbacks callback,
void * data)
Packit Service a31ea6
xmlRegexpPtr	xmlRegexpCompile	(const xmlChar * regexp)
Packit Service a31ea6
int	xmlRegexpExec			(xmlRegexpPtr comp, 
const xmlChar * content)
Packit Service a31ea6
int	xmlRegexpIsDeterminist		(xmlRegexpPtr comp)
Packit Service a31ea6
void	xmlRegexpPrint			(FILE * output, 
xmlRegexpPtr regexp)
Packit Service a31ea6

Description

Packit Service a31ea6

Structure xmlExpCtxt

Structure xmlExpCtxt
struct _xmlExpCtxt {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
}

Structure xmlExpNode

Structure xmlExpNode
struct _xmlExpNode {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
}

Enum xmlExpNodeType

Enum xmlExpNodeType {
Packit Service a31ea6
    XML_EXP_EMPTY = 0
Packit Service a31ea6
    XML_EXP_FORBID = 1
Packit Service a31ea6
    XML_EXP_ATOM = 2
Packit Service a31ea6
    XML_EXP_SEQ = 3
Packit Service a31ea6
    XML_EXP_OR = 4
Packit Service a31ea6
    XML_EXP_COUNT = 5
Packit Service a31ea6
}
Packit Service a31ea6

Structure xmlRegExecCtxt

Structure xmlRegExecCtxt
struct _xmlRegExecCtxt {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
}
Packit Service a31ea6
      A libxml progressive regular expression evaluation context
Packit Service a31ea6
    

Structure xmlRegexp

Structure xmlRegexp
struct _xmlRegexp {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
}
Packit Service a31ea6
      A libxml regular expression, they can actually be far more complex thank the POSIX regex expressions.
Packit Service a31ea6
    

Function: xmlExpCtxtNbCons

int	xmlExpCtxtNbCons		(xmlExpCtxtPtr ctxt)
Packit Service a31ea6

Debugging facility provides the number of allocated nodes over lifetime

Packit Service a31ea6
<tt>ctxt</tt>:an expression context
<tt>Returns</tt>:the number of nodes ever allocated or -1 in case of error

Function: xmlExpCtxtNbNodes

int	xmlExpCtxtNbNodes		(xmlExpCtxtPtr ctxt)
Packit Service a31ea6

Debugging facility provides the number of allocated nodes at a that point

Packit Service a31ea6
<tt>ctxt</tt>:an expression context
<tt>Returns</tt>:the number of nodes in use or -1 in case of error

Function: xmlExpDump

void	xmlExpDump			(xmlBufferPtr buf, 
xmlExpNodePtr expr)
Packit Service a31ea6

Serialize the expression as compiled to the buffer

Packit Service a31ea6
<tt>buf</tt>:a buffer to receive the output
<tt>expr</tt>:the compiled expression

Function: xmlExpExpDerive

xmlExpNodePtr	xmlExpExpDerive		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
xmlExpNodePtr sub)
Packit Service a31ea6

Evaluates the expression resulting from @exp consuming a sub expression @sub Based on algebraic derivation and sometimes direct Brzozowski derivation it usually tatkes less than linear time and can handle expressions generating infinite languages.

Packit Service a31ea6
<tt>ctxt</tt>:the expressions context
<tt>exp</tt>:the englobing expression
<tt>sub</tt>:the subexpression
<tt>Returns</tt>:the resulting expression or NULL in case of internal error, the result must be freed

Function: xmlExpFree

void	xmlExpFree			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp)
Packit Service a31ea6

Dereference the expression

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>exp</tt>:the expression

Function: xmlExpFreeCtxt

void	xmlExpFreeCtxt			(xmlExpCtxtPtr ctxt)
Packit Service a31ea6

Free an expression context

Packit Service a31ea6
<tt>ctxt</tt>:an expression context

Function: xmlExpGetLanguage

int	xmlExpGetLanguage		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar ** langList,
int len)
Packit Service a31ea6

Find all the strings used in @exp and store them in @list

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>exp</tt>:the expression
<tt>langList</tt>:where to store the tokens
<tt>len</tt>:the allocated length of @list
<tt>Returns</tt>:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

Function: xmlExpGetStart

int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar ** tokList,
int len)
Packit Service a31ea6

Find all the strings that appears at the start of the languages accepted by @exp and store them in @list. E.g. for (a, b) | c it will return the list [a, c]

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>exp</tt>:the expression
<tt>tokList</tt>:where to store the tokens
<tt>len</tt>:the allocated length of @list
<tt>Returns</tt>:the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings

Function: xmlExpIsNillable

int	xmlExpIsNillable		(xmlExpNodePtr exp)
Packit Service a31ea6

Finds if the expression is nillable, i.e. if it accepts the empty sequqnce

Packit Service a31ea6
<tt>exp</tt>:the expression
<tt>Returns</tt>:1 if nillable, 0 if not and -1 in case of error

Function: xmlExpMaxToken

int	xmlExpMaxToken			(xmlExpNodePtr expr)
Packit Service a31ea6

Indicate the maximum number of input a expression can accept

Packit Service a31ea6
<tt>expr</tt>:a compiled expression
<tt>Returns</tt>:the maximum length or -1 in case of error

Function: xmlExpNewAtom

xmlExpNodePtr	xmlExpNewAtom		(xmlExpCtxtPtr ctxt, 
const xmlChar * name,
int len)
Packit Service a31ea6

Get the atom associated to this name from that context

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>name</tt>:the atom name
<tt>len</tt>:the atom name length in byte (or -1);
<tt>Returns</tt>:the node or NULL in case of error

Function: xmlExpNewCtxt

xmlExpCtxtPtr	xmlExpNewCtxt		(int maxNodes, 
xmlDictPtr dict)
Packit Service a31ea6

Creates a new context for manipulating expressions

Packit Service a31ea6
<tt>maxNodes</tt>:the maximum number of nodes
<tt>dict</tt>:optional dictionary to use internally
<tt>Returns</tt>:the context or NULL in case of error

Function: xmlExpNewOr

xmlExpNodePtr	xmlExpNewOr		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
Packit Service a31ea6

Get the atom associated to the choice @left | @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL).

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>left</tt>:left expression
<tt>right</tt>:right expression
<tt>Returns</tt>:the node or NULL in case of error

Function: xmlExpNewRange

xmlExpNodePtr	xmlExpNewRange		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr subset,
int min,
int max)
Packit Service a31ea6

Get the atom associated to the range (@subset){@min, @max} Note that @subset is consumed in the operation, to keep an handle on it use xmlExpRef() and use xmlExpFree() to release it, this is true even in case of failure (unless ctxt == NULL).

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>subset</tt>:the expression to be repeated
<tt>min</tt>:the lower bound for the repetition
<tt>max</tt>:the upper bound for the repetition, -1 means infinite
<tt>Returns</tt>:the node or NULL in case of error

Function: xmlExpNewSeq

xmlExpNodePtr	xmlExpNewSeq		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
Packit Service a31ea6

Get the atom associated to the sequence @left , @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL).

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>left</tt>:left expression
<tt>right</tt>:right expression
<tt>Returns</tt>:the node or NULL in case of error

Function: xmlExpParse

xmlExpNodePtr	xmlExpParse		(xmlExpCtxtPtr ctxt, 
const char * expr)
Packit Service a31ea6

Minimal parser for regexps, it understand the following constructs - string terminals - choice operator | - sequence operator , - subexpressions (...) - usual cardinality operators + * and ? - finite sequences { min, max } - infinite sequences { min, * } There is minimal checkings made especially no checking on strings values

Packit Service a31ea6
<tt>ctxt</tt>:the expressions context
<tt>expr</tt>:the 0 terminated string
<tt>Returns</tt>:a new expression or NULL in case of failure

Function: xmlExpRef

void	xmlExpRef			(xmlExpNodePtr exp)
Packit Service a31ea6

Increase the reference count of the expression

Packit Service a31ea6
<tt>exp</tt>:the expression

Function: xmlExpStringDerive

xmlExpNodePtr	xmlExpStringDerive	(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar * str,
int len)
Packit Service a31ea6

Do one step of Brzozowski derivation of the expression @exp with respect to the input string

Packit Service a31ea6
<tt>ctxt</tt>:the expression context
<tt>exp</tt>:the expression
<tt>str</tt>:the string
<tt>len</tt>:the string len in bytes if available
<tt>Returns</tt>:the resulting expression or NULL in case of internal error

Function: xmlExpSubsume

int	xmlExpSubsume			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
xmlExpNodePtr sub)
Packit Service a31ea6

Check whether @exp accepts all the languages accexpted by @sub the input being a subexpression.

Packit Service a31ea6
<tt>ctxt</tt>:the expressions context
<tt>exp</tt>:the englobing expression
<tt>sub</tt>:the subexpression
<tt>Returns</tt>:1 if true 0 if false and -1 in case of failure.

Function type: xmlRegExecCallbacks

Function type: xmlRegExecCallbacks
Packit Service a31ea6
void	xmlRegExecCallbacks		(xmlRegExecCtxtPtr exec, 
const xmlChar * token,
void * transdata,
void * inputdata)
Packit Service a31ea6

Callback function when doing a transition in the automata

<tt>exec</tt>:the regular expression context
<tt>token</tt>:the current token string
<tt>transdata</tt>:transition data
<tt>inputdata</tt>:input data

Packit Service a31ea6

Function: xmlRegExecErrInfo

int	xmlRegExecErrInfo		(xmlRegExecCtxtPtr exec, 
const xmlChar ** string,
int * nbval,
int * nbneg,
xmlChar ** values,
int * terminal)
Packit Service a31ea6

Extract error informations from the regexp execution, the parameter @string will be updated with the value pushed and not accepted, the parameter @values must point to an array of @nbval string pointers on return nbval will contain the number of possible strings in that state and the @values array will be updated with them. The string values

Packit Service a31ea6
<tt>exec</tt>:a regexp execution context generating an error
<tt>string</tt>:return value for the error string
<tt>nbval</tt>:pointer to the number of accepted values IN/OUT
<tt>nbneg</tt>:return number of negative transitions
<tt>values</tt>:pointer to the array of acceptable values
<tt>terminal</tt>:return value if this was a terminal state
<tt>Returns</tt>:will be freed with the @exec context and don't need to be deallocated. Returns: 0 in case of success or -1 in case of error.

Function: xmlRegExecNextValues

int	xmlRegExecNextValues		(xmlRegExecCtxtPtr exec, 
int * nbval,
int * nbneg,
xmlChar ** values,
int * terminal)
Packit Service a31ea6

Extract informations from the regexp execution, the parameter @values must point to an array of @nbval string pointers on return nbval will contain the number of possible strings in that state and the @values array will be updated with them. The string values

Packit Service a31ea6
<tt>exec</tt>:a regexp execution context
<tt>nbval</tt>:pointer to the number of accepted values IN/OUT
<tt>nbneg</tt>:return number of negative transitions
<tt>values</tt>:pointer to the array of acceptable values
<tt>terminal</tt>:return value if this was a terminal state
<tt>Returns</tt>:will be freed with the @exec context and don't need to be deallocated. Returns: 0 in case of success or -1 in case of error.

Function: xmlRegExecPushString

int	xmlRegExecPushString		(xmlRegExecCtxtPtr exec, 
const xmlChar * value,
void * data)
Packit Service a31ea6

Push one input token in the execution context

Packit Service a31ea6
<tt>exec</tt>:a regexp execution context or NULL to indicate the end
<tt>value</tt>:a string token input
<tt>data</tt>:data associated to the token to reuse in callbacks
<tt>Returns</tt>:1 if the regexp reached a final state, 0 if non-final, and a negative value in case of error.

Function: xmlRegExecPushString2

int	xmlRegExecPushString2		(xmlRegExecCtxtPtr exec, 
const xmlChar * value,
const xmlChar * value2,
void * data)
Packit Service a31ea6

Push one input token in the execution context

Packit Service a31ea6
<tt>exec</tt>:a regexp execution context or NULL to indicate the end
<tt>value</tt>:the first string token input
<tt>value2</tt>:the second string token input
<tt>data</tt>:data associated to the token to reuse in callbacks
<tt>Returns</tt>:1 if the regexp reached a final state, 0 if non-final, and a negative value in case of error.

Function: xmlRegFreeExecCtxt

void	xmlRegFreeExecCtxt		(xmlRegExecCtxtPtr exec)
Packit Service a31ea6

Free the structures associated to a regular expression evaulation context.

Packit Service a31ea6
<tt>exec</tt>:a regular expression evaulation context

Function: xmlRegFreeRegexp

void	xmlRegFreeRegexp		(xmlRegexpPtr regexp)
Packit Service a31ea6

Free a regexp

Packit Service a31ea6
<tt>regexp</tt>:the regexp

Function: xmlRegNewExecCtxt

xmlRegExecCtxtPtr	xmlRegNewExecCtxt	(xmlRegexpPtr comp, 
xmlRegExecCallbacks callback,
void * data)
Packit Service a31ea6

Build a context used for progressive evaluation of a regexp.

Packit Service a31ea6
<tt>comp</tt>:a precompiled regular expression
<tt>callback</tt>:a callback function used for handling progresses in the automata matching phase
<tt>data</tt>:the context data associated to the callback in this context
<tt>Returns</tt>:the new context

Function: xmlRegexpCompile

xmlRegexpPtr	xmlRegexpCompile	(const xmlChar * regexp)
Packit Service a31ea6

Parses a regular expression conforming to XML Schemas Part 2 Datatype Appendix F and builds an automata suitable for testing strings against that regular expression

Packit Service a31ea6
<tt>regexp</tt>:a regular expression string
<tt>Returns</tt>:the compiled expression or NULL in case of error

Function: xmlRegexpExec

int	xmlRegexpExec			(xmlRegexpPtr comp, 
const xmlChar * content)
Packit Service a31ea6

Check if the regular expression generates the value

Packit Service a31ea6
<tt>comp</tt>:the compiled regular expression
<tt>content</tt>:the value to check against the regular expression
<tt>Returns</tt>:1 if it matches, 0 if not and a negative value in case of error

Function: xmlRegexpIsDeterminist

int	xmlRegexpIsDeterminist		(xmlRegexpPtr comp)
Packit Service a31ea6

Check if the regular expression is determinist

Packit Service a31ea6
<tt>comp</tt>:the compiled regular expression
<tt>Returns</tt>:1 if it yes, 0 if not and a negative value in case of error

Function: xmlRegexpPrint

void	xmlRegexpPrint			(FILE * output, 
xmlRegexpPtr regexp)
Packit Service a31ea6

Print the content of the compiled regular expression

Packit Service a31ea6
<tt>output</tt>:the file for the output debug
<tt>regexp</tt>:the compiled regexp

Daniel Veillard

</body></html>