blob: c058bd9f977c6088219bae26676f7b669cb6d487 [file] [log] [blame]
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001/*
2 * Summary: pattern expression handling
3 * Description: allows to compile and test pattern expressions for nodes
4 * either in a tree or based on a parser state.
5 *
6 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Daniel Veillard
9 */
10
11#ifndef __XML_PATTERN_H__
12#define __XML_PATTERN_H__
13
14#include <libxml/xmlversion.h>
15#include <libxml/tree.h>
16#include <libxml/dict.h>
17
Daniel Veillarda2351322004-06-27 12:08:10 +000018#ifdef LIBXML_PATTERN_ENABLED
19
Daniel Veillardb3de70c2003-12-02 22:32:15 +000020#ifdef __cplusplus
21extern "C" {
22#endif
23
24/**
25 * xmlPattern:
26 *
27 * A compiled (XPath based) pattern to select nodes
28 */
29typedef struct _xmlPattern xmlPattern;
30typedef xmlPattern *xmlPatternPtr;
31
William M. Brackea152c02005-06-09 18:12:28 +000032/**
33 * xmlPatternFlags:
34 *
35 * This is the set of options affecting the behaviour of pattern
36 * matching with this module
37 *
38 */
39typedef enum {
40 XML_PATTERN_DEFAULT = 0, /* simple pattern match */
41 XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
42 XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
43 XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
44} xmlPatternFlags;
45
Daniel Veillardb3de70c2003-12-02 22:32:15 +000046XMLPUBFUN void XMLCALL
47 xmlFreePattern (xmlPatternPtr comp);
48
49XMLPUBFUN void XMLCALL
50 xmlFreePatternList (xmlPatternPtr comp);
51
52XMLPUBFUN xmlPatternPtr XMLCALL
53 xmlPatterncompile (const xmlChar *pattern,
Daniel Veillard1e906612003-12-05 14:57:46 +000054 xmlDict *dict,
Daniel Veillarded6c5492005-07-23 15:00:22 +000055 int flags,
Daniel Veillardffa7b7e2003-12-05 16:10:21 +000056 const xmlChar **namespaces);
Daniel Veillardb3de70c2003-12-02 22:32:15 +000057XMLPUBFUN int XMLCALL
58 xmlPatternMatch (xmlPatternPtr comp,
59 xmlNodePtr node);
60
Daniel Veillard2fc6df92005-01-30 18:42:55 +000061/* streaming interfaces */
62typedef struct _xmlStreamCtxt xmlStreamCtxt;
63typedef xmlStreamCtxt *xmlStreamCtxtPtr;
64
Daniel Veillard56de87e2005-02-16 00:22:29 +000065XMLPUBFUN int XMLCALL
66 xmlPatternStreamable (xmlPatternPtr comp);
67XMLPUBFUN int XMLCALL
68 xmlPatternMaxDepth (xmlPatternPtr comp);
69XMLPUBFUN int XMLCALL
70 xmlPatternFromRoot (xmlPatternPtr comp);
Daniel Veillard2fc6df92005-01-30 18:42:55 +000071XMLPUBFUN xmlStreamCtxtPtr XMLCALL
72 xmlPatternGetStreamCtxt (xmlPatternPtr comp);
73XMLPUBFUN void XMLCALL
74 xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
75XMLPUBFUN int XMLCALL
76 xmlStreamPush (xmlStreamCtxtPtr stream,
77 const xmlChar *name,
78 const xmlChar *ns);
79XMLPUBFUN int XMLCALL
Kasimier T. Buchcik2a0fdd92005-02-17 21:34:45 +000080 xmlStreamPushAttr (xmlStreamCtxtPtr stream,
81 const xmlChar *name,
82 const xmlChar *ns);
83XMLPUBFUN int XMLCALL
Daniel Veillard2fc6df92005-01-30 18:42:55 +000084 xmlStreamPop (xmlStreamCtxtPtr stream);
Daniel Veillardb3de70c2003-12-02 22:32:15 +000085#ifdef __cplusplus
86}
87#endif
Daniel Veillarda2351322004-06-27 12:08:10 +000088
89#endif /* LIBXML_PATTERN_ENABLED */
90
Daniel Veillardb3de70c2003-12-02 22:32:15 +000091#endif /* __XML_PATTERN_H__ */