|
libxml2
|
Regular expressions. More...
Typedefs | |
| typedef struct _xmlRegexp | xmlRegexp |
| A libxml regular expression. | |
| typedef struct _xmlRegExecCtxt | xmlRegExecCtxt |
| A libxml progressive regular expression evaluation context. | |
| typedef void(* | xmlRegExecCallbacks) (xmlRegExecCtxt *exec, const xmlChar *token, void *transdata, void *inputdata) |
| Callback function when doing a transition in the automata. | |
Functions | |
| xmlRegexp * | xmlRegexpCompile (const xmlChar *regexp) |
| Parses an XML Schemas regular expression. | |
| void | xmlRegFreeRegexp (xmlRegexp *regexp) |
| Free a regexp. | |
| int | xmlRegexpExec (xmlRegexp *comp, const xmlChar *value) |
| Check if the regular expression matches a string. | |
| void | xmlRegexpPrint (FILE *output, xmlRegexp *regexp) |
| No-op since 2.14.0. | |
| int | xmlRegexpIsDeterminist (xmlRegexp *comp) |
| Check if the regular expression is deterministic. | |
| xmlRegExecCtxt * | xmlRegNewExecCtxt (xmlRegexp *comp, xmlRegExecCallbacks callback, void *data) |
| Build a context used for progressive evaluation of a regexp. | |
| void | xmlRegFreeExecCtxt (xmlRegExecCtxt *exec) |
| Free the structures associated to a regular expression evaluation context. | |
| int | xmlRegExecPushString (xmlRegExecCtxt *exec, const xmlChar *value, void *data) |
| Push one input token in the execution context. | |
| int | xmlRegExecPushString2 (xmlRegExecCtxt *exec, const xmlChar *value, const xmlChar *value2, void *data) |
| Push one input token in the execution context. | |
| int | xmlRegExecNextValues (xmlRegExecCtxt *exec, int *nbval, int *nbneg, xmlChar **values, int *terminal) |
| Extract information from the regexp execution. | |
| int | xmlRegExecErrInfo (xmlRegExecCtxt *exec, const xmlChar **string, int *nbval, int *nbneg, xmlChar **values, int *terminal) |
| Extract error information from the regexp execution. | |
Regular expressions.
A regular expression engine used for DTD and XML Schema validation.
| typedef void(* xmlRegExecCallbacks) (xmlRegExecCtxt *exec, const xmlChar *token, void *transdata, void *inputdata) |
Callback function when doing a transition in the automata.
| exec | the regular expression context |
| token | the current token string |
| transdata | transition data |
| inputdata | input data |
| int xmlRegExecErrInfo | ( | xmlRegExecCtxt * | exec, |
| const xmlChar ** | string, | ||
| int * | nbval, | ||
| int * | nbneg, | ||
| xmlChar ** | values, | ||
| int * | terminal ) |
Extract error information 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 returned will be freed with the exec context and don't need to be deallocated.
| exec | a regexp execution context generating an error |
| string | return value for the error string |
| nbval | pointer to the number of accepted values IN/OUT |
| nbneg | return number of negative transitions |
| values | pointer to the array of acceptable values |
| terminal | return value if this was a terminal state |
| int xmlRegExecNextValues | ( | xmlRegExecCtxt * | exec, |
| int * | nbval, | ||
| int * | nbneg, | ||
| xmlChar ** | values, | ||
| int * | terminal ) |
Extract information 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 returned will be freed with the exec context and don't need to be deallocated.
| exec | a regexp execution context |
| nbval | pointer to the number of accepted values IN/OUT |
| nbneg | return number of negative transitions |
| values | pointer to the array of acceptable values |
| terminal | return value if this was a terminal state |
| int xmlRegExecPushString | ( | xmlRegExecCtxt * | exec, |
| const xmlChar * | value, | ||
| void * | data ) |
Push one input token in the execution context.
| exec | a regexp execution context or NULL to indicate the end |
| value | a string token input |
| data | data associated to the token to reuse in callbacks |
| int xmlRegExecPushString2 | ( | xmlRegExecCtxt * | exec, |
| const xmlChar * | value, | ||
| const xmlChar * | value2, | ||
| void * | data ) |
Push one input token in the execution context.
| exec | a regexp execution context or NULL to indicate the end |
| value | the first string token input |
| value2 | the second string token input |
| data | data associated to the token to reuse in callbacks |
Parses an XML Schemas regular expression.
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.
| regexp | a regular expression string |
Check if the regular expression matches a string.
| comp | the compiled regular expression |
| content | the value to check against the regular expression |
| int xmlRegexpIsDeterminist | ( | xmlRegexp * | comp | ) |
Check if the regular expression is deterministic.
DTD and XML Schemas require a deterministic content model, so the automaton compiled from the regex must be a DFA.
The runtime of this function is quadratic in the number of outgoing edges, causing serious worst-case performance issues.
| comp | the compiled regular expression |
| void xmlRegexpPrint | ( | FILE * | output, |
| xmlRegexp * | regexp ) |
No-op since 2.14.0.
| output | the file for the output debug |
| regexp | the compiled regexp |
| void xmlRegFreeExecCtxt | ( | xmlRegExecCtxt * | exec | ) |
Free the structures associated to a regular expression evaluation context.
| exec | a regular expression evaluation context |
| void xmlRegFreeRegexp | ( | xmlRegexp * | regexp | ) |
Free a regexp.
| regexp | the regexp |
| xmlRegExecCtxt * xmlRegNewExecCtxt | ( | xmlRegexp * | comp, |
| xmlRegExecCallbacks | callback, | ||
| void * | data ) |
Build a context used for progressive evaluation of a regexp.
| comp | a precompiled regular expression |
| callback | a callback function used for handling progresses in the automata matching phase |
| data | the context data associated to the callback in this context |