\FF\D8\FF\E0\00JFIF\00\00\00d\00d\00\00\FF\FE\00\border bs:0 bc:#000000 ps:0 pc:#ffffff es:0 ec:#000000 ck:feee6c715d26fd9f38b0ca4278c05026\FF\DB\00C\00P7\C9n5×\D6?\BDê\9Ds\EBp\9F[`8m\B7)o\B5\E8\E6I\99\FE3]]A2\BA\8Cw\D6E\93\\DEv\C8\009\F2\F1NI?uc\\F5\EA\96k\xN<~buv\EA\C8\D7 \8B\84\CEcxI\BBg\AE\9E=\D6+n\EC\80\C8A\8C\AE\EB\CF\D5\DA\E9"2\A4\B9j5\EB\F3W\B63\96\B30Yu\DA\FC8\ED\DF\E7Ms\FB\F1\8E\B3\FA\EA\E8\E6(\883zs\F2_\8DFk\8Bh \00\8C\DCw\D3R\B5+6X\BA\B2\C4j\AB0\B4\FCMw\C2I\8E\9B\E3\A9~9u\FA\D3l\80\C8%p\EE\FDn2€ \00 $\FEj\C4e\A9\DB\~\95\A7\A5\80EK\BB\8DDsP\00@@AD'k\CF\E8\DB\D2(\80\9AK\D3\85\D6lb\F2\BA\8C*\80\00)\95 59\A3R:\F3\CE"\B6\80\88\00\00i1u4ê\E9\F2á\A6\A2\FACM\93WMb*\E0*\00\00\00\00\00(\A8\80\00\00\80\00\00\00\00\00\00\00\00\00\FF\D9 C/// pattern: pattern expression handling

pattern

pattern - pattern expression handling

allows to compile and test pattern expressions for nodes either in a tree or based on a parser state.

Author(s): Daniel Veillard

Synopsis

typedef struct _xmlPattern xmlPattern;
typedef enum xmlPatternFlags;
typedef xmlPattern * xmlPatternPtr;
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt * xmlStreamCtxtPtr;
void	xmlFreePattern			(xmlPatternPtr comp);
void	xmlFreePatternList		(xmlPatternPtr comp);
void	xmlFreeStreamCtxt		(xmlStreamCtxtPtr stream);
int	xmlPatternFromRoot		(xmlPatternPtr comp);
xmlStreamCtxtPtr	xmlPatternGetStreamCtxt	(xmlPatternPtr comp);
int	xmlPatternMatch			(xmlPatternPtr comp, 
xmlNodePtr node); int xmlPatternMaxDepth (xmlPatternPtr comp); int xmlPatternMinDepth (xmlPatternPtr comp); int xmlPatternStreamable (xmlPatternPtr comp); xmlPatternPtr xmlPatterncompile (const xmlChar * pattern,
xmlDict * dict,
int flags,
const xmlChar ** namespaces); int xmlStreamPop (xmlStreamCtxtPtr stream); int xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns); int xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns); int xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns,
int nodeType); int xmlStreamWantsAnyNode (xmlStreamCtxtPtr streamCtxt);

Description

Details

Structure xmlPattern

struct _xmlPattern {
The content of this structure is not made public by the API.
} xmlPattern;


Enum xmlPatternFlags

enum xmlPatternFlags {
    XML_PATTERN_DEFAULT = 0 /* simple pattern match */
    XML_PATTERN_XPATH = 1 /* standard XPath pattern */
    XML_PATTERN_XSSEL = 2 /* XPath subset for schema selector */
    XML_PATTERN_XSFIELD = 4 /*  XPath subset for schema field */
};


Typedef xmlPatternPtr

xmlPattern * xmlPatternPtr;


Structure xmlStreamCtxt

struct _xmlStreamCtxt {
The content of this structure is not made public by the API.
} xmlStreamCtxt;


Typedef xmlStreamCtxtPtr

xmlStreamCtxt * xmlStreamCtxtPtr;


xmlFreePattern ()

void	xmlFreePattern			(xmlPatternPtr comp)

Free up the memory allocated by @comp

comp: an XSLT comp

xmlFreePatternList ()

void	xmlFreePatternList		(xmlPatternPtr comp)

Free up the memory allocated by all the elements of @comp

comp: an XSLT comp list

xmlFreeStreamCtxt ()

void	xmlFreeStreamCtxt		(xmlStreamCtxtPtr stream)

Free the stream context

stream: the stream context

xmlPatternFromRoot ()

int	xmlPatternFromRoot		(xmlPatternPtr comp)

Check if the pattern must be looked at from the root.

comp: the precompiled pattern
Returns: 1 if true, 0 if false and -1 in case of error

xmlPatternGetStreamCtxt ()

xmlStreamCtxtPtr	xmlPatternGetStreamCtxt	(xmlPatternPtr comp)

Get a streaming context for that pattern Use xmlFreeStreamCtxt to free the context.

comp: the precompiled pattern
Returns: a pointer to the context or NULL in case of failure

xmlPatternMatch ()

int	xmlPatternMatch			(xmlPatternPtr comp, 
xmlNodePtr node)

Test whether the node matches the pattern

comp: the precompiled pattern
node: a node
Returns: 1 if it matches, 0 if it doesn't and -1 in case of failure

xmlPatternMaxDepth ()

int	xmlPatternMaxDepth		(xmlPatternPtr comp)

Check the maximum depth reachable by a pattern

comp: the precompiled pattern
Returns: -2 if no limit (using //), otherwise the depth, and -1 in case of error

xmlPatternMinDepth ()

int	xmlPatternMinDepth		(xmlPatternPtr comp)

Check the minimum depth reachable by a pattern, 0 mean the / or . are part of the set.

comp: the precompiled pattern
Returns: -1 in case of error otherwise the depth,

xmlPatternStreamable ()

int	xmlPatternStreamable		(xmlPatternPtr comp)

Check if the pattern is streamable i.e. xmlPatternGetStreamCtxt() should work.

comp: the precompiled pattern
Returns: 1 if streamable, 0 if not and -1 in case of error.

xmlPatterncompile ()

xmlPatternPtr	xmlPatterncompile	(const xmlChar * pattern, 
xmlDict * dict,
int flags,
const xmlChar ** namespaces)

Compile a pattern.

pattern: the pattern to compile
dict: an optional dictionary for interned strings
flags: compilation flags, see xmlPatternFlags
namespaces: the prefix definitions, array of [URI, prefix] or NULL
Returns: the compiled form of the pattern or NULL in case of error

xmlStreamPop ()

int	xmlStreamPop			(xmlStreamCtxtPtr stream)

push one level from the stream.

stream: the stream context
Returns: -1 in case of error, 0 otherwise.

xmlStreamPush ()

int	xmlStreamPush			(xmlStreamCtxtPtr stream, 
const xmlChar * name,
const xmlChar * ns)

Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an element-node.

stream: the stream context
name: the current name
ns: the namespace name
Returns: -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

xmlStreamPushAttr ()

int	xmlStreamPushAttr		(xmlStreamCtxtPtr stream, 
const xmlChar * name,
const xmlChar * ns)

Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an attribute-node.

stream: the stream context
name: the current name
ns: the namespace name
Returns: -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.

xmlStreamPushNode ()

int	xmlStreamPushNode		(xmlStreamCtxtPtr stream, 
const xmlChar * name,
const xmlChar * ns,
int nodeType)

Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the doc