Debian Codegraph @

include/libxml/pattern.h

raw
1 /**
2 * @file
3 *
4 * @brief pattern expression handling
5 *
6 * allows to compile and test pattern expressions for nodes
7 * either in a tree or based on a parser state.
8 *
9 * @copyright See Copyright for the status of this software.
10 *
11 * @author Daniel Veillard
12 */
13
14 #ifndef __XML_PATTERN_H__
15 #define __XML_PATTERN_H__
16
17 #include <libxml/xmlversion.h>
18 #include <libxml/tree.h>
19 #include <libxml/dict.h>
20
21 #ifdef LIBXML_PATTERN_ENABLED
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28 * A compiled (XPath based) pattern to select nodes
29 */
30 typedef struct _xmlPattern xmlPattern;
31 typedef xmlPattern *xmlPatternPtr;
32
33 /**
34 * Internal type. This is the set of options affecting the behaviour
35 * of pattern matching with this module.
36 */
37 typedef enum {
38 XML_PATTERN_DEFAULT = 0, /* simple pattern match */
39 XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
40 XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
41 XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
42 } xmlPatternFlags;
43
44 XMLPUBFUN void
45 xmlFreePattern (xmlPattern *comp);
46
47 XMLPUBFUN void
48 xmlFreePatternList (xmlPattern *comp);
49
50 XMLPUBFUN xmlPattern *
51 xmlPatterncompile (const xmlChar *pattern,
52 xmlDict *dict,
53 int flags,
54 const xmlChar **namespaces);
55 XMLPUBFUN int
56 xmlPatternCompileSafe (const xmlChar *pattern,
57 xmlDict *dict,
58 int flags,
59 const xmlChar **namespaces,
60 xmlPattern **patternOut);
61 XMLPUBFUN int
62 xmlPatternMatch (xmlPattern *comp,
63 xmlNode *node);
64
65 /** State object for streaming interface */
66 typedef struct _xmlStreamCtxt xmlStreamCtxt;
67 typedef xmlStreamCtxt *xmlStreamCtxtPtr;
68
69 XMLPUBFUN int
70 xmlPatternStreamable (xmlPattern *comp);
71 XMLPUBFUN int
72 xmlPatternMaxDepth (xmlPattern *comp);
73 XMLPUBFUN int
74 xmlPatternMinDepth (xmlPattern *comp);
75 XMLPUBFUN int
76 xmlPatternFromRoot (xmlPattern *comp);
77 XMLPUBFUN xmlStreamCtxt *
78 xmlPatternGetStreamCtxt (xmlPattern *comp);
79 XMLPUBFUN void
80 xmlFreeStreamCtxt (xmlStreamCtxt *stream);
81 XMLPUBFUN int
82 xmlStreamPushNode (xmlStreamCtxt *stream,
83 const xmlChar *name,
84 const xmlChar *ns,
85 int nodeType);
86 XMLPUBFUN int
87 xmlStreamPush (xmlStreamCtxt *stream,
88 const xmlChar *name,
89 const xmlChar *ns);
90 XMLPUBFUN int
91 xmlStreamPushAttr (xmlStreamCtxt *stream,
92 const xmlChar *name,
93 const xmlChar *ns);
94 XMLPUBFUN int
95 xmlStreamPop (xmlStreamCtxt *stream);
96 XMLPUBFUN int
97 xmlStreamWantsAnyNode (xmlStreamCtxt *stream);
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif /* LIBXML_PATTERN_ENABLED */
103
104 #endif /* __XML_PATTERN_H__ */