Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-26 09:13:46

0001 /**
0002  * @file
0003  * 
0004  * @brief pattern expression handling
0005  * 
0006  * allows to compile and test pattern expressions for nodes
0007  *              either in a tree or based on a parser state.
0008  *
0009  * @copyright See Copyright for the status of this software.
0010  *
0011  * @author Daniel Veillard
0012  */
0013 
0014 #ifndef __XML_PATTERN_H__
0015 #define __XML_PATTERN_H__
0016 
0017 #include <libxml/xmlversion.h>
0018 #include <libxml/tree.h>
0019 #include <libxml/dict.h>
0020 
0021 #ifdef LIBXML_PATTERN_ENABLED
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 /**
0028  * A compiled (XPath based) pattern to select nodes
0029  */
0030 typedef struct _xmlPattern xmlPattern;
0031 typedef xmlPattern *xmlPatternPtr;
0032 
0033 /**
0034  * Internal type. This is the set of options affecting the behaviour
0035  * of pattern matching with this module.
0036  */
0037 typedef enum {
0038     XML_PATTERN_DEFAULT     = 0,    /* simple pattern match */
0039     XML_PATTERN_XPATH       = 1<<0, /* standard XPath pattern */
0040     XML_PATTERN_XSSEL       = 1<<1, /* XPath subset for schema selector */
0041     XML_PATTERN_XSFIELD     = 1<<2  /* XPath subset for schema field */
0042 } xmlPatternFlags;
0043 
0044 XMLPUBFUN void
0045             xmlFreePattern      (xmlPattern *comp);
0046 
0047 XMLPUBFUN void
0048             xmlFreePatternList  (xmlPattern *comp);
0049 
0050 XMLPUBFUN xmlPattern *
0051             xmlPatterncompile   (const xmlChar *pattern,
0052                          xmlDict *dict,
0053                          int flags,
0054                          const xmlChar **namespaces);
0055 XMLPUBFUN int
0056             xmlPatternCompileSafe   (const xmlChar *pattern,
0057                          xmlDict *dict,
0058                          int flags,
0059                          const xmlChar **namespaces,
0060                          xmlPattern **patternOut);
0061 XMLPUBFUN int
0062             xmlPatternMatch     (xmlPattern *comp,
0063                          xmlNode *node);
0064 
0065 /** State object for streaming interface */
0066 typedef struct _xmlStreamCtxt xmlStreamCtxt;
0067 typedef xmlStreamCtxt *xmlStreamCtxtPtr;
0068 
0069 XMLPUBFUN int
0070             xmlPatternStreamable    (xmlPattern *comp);
0071 XMLPUBFUN int
0072             xmlPatternMaxDepth  (xmlPattern *comp);
0073 XMLPUBFUN int
0074             xmlPatternMinDepth  (xmlPattern *comp);
0075 XMLPUBFUN int
0076             xmlPatternFromRoot  (xmlPattern *comp);
0077 XMLPUBFUN xmlStreamCtxt *
0078             xmlPatternGetStreamCtxt (xmlPattern *comp);
0079 XMLPUBFUN void
0080             xmlFreeStreamCtxt   (xmlStreamCtxt *stream);
0081 XMLPUBFUN int
0082             xmlStreamPushNode   (xmlStreamCtxt *stream,
0083                          const xmlChar *name,
0084                          const xmlChar *ns,
0085                          int nodeType);
0086 XMLPUBFUN int
0087             xmlStreamPush       (xmlStreamCtxt *stream,
0088                          const xmlChar *name,
0089                          const xmlChar *ns);
0090 XMLPUBFUN int
0091             xmlStreamPushAttr   (xmlStreamCtxt *stream,
0092                          const xmlChar *name,
0093                          const xmlChar *ns);
0094 XMLPUBFUN int
0095             xmlStreamPop        (xmlStreamCtxt *stream);
0096 XMLPUBFUN int
0097             xmlStreamWantsAnyNode   (xmlStreamCtxt *stream);
0098 #ifdef __cplusplus
0099 }
0100 #endif
0101 
0102 #endif /* LIBXML_PATTERN_ENABLED */
0103 
0104 #endif /* __XML_PATTERN_H__ */