pattern.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  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. #ifndef __XML_PATTERN_H__
  11. #define __XML_PATTERN_H__
  12. #include <libxml/xmlversion.h>
  13. #include <libxml/tree.h>
  14. #include <libxml/dict.h>
  15. #ifdef LIBXML_PATTERN_ENABLED
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * xmlPattern:
  21. *
  22. * A compiled (XPath based) pattern to select nodes
  23. */
  24. typedef struct _xmlPattern xmlPattern;
  25. typedef xmlPattern *xmlPatternPtr;
  26. /**
  27. * xmlPatternFlags:
  28. *
  29. * This is the set of options affecting the behaviour of pattern
  30. * matching with this module
  31. *
  32. */
  33. typedef enum {
  34. XML_PATTERN_DEFAULT = 0, /* simple pattern match */
  35. XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
  36. XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
  37. XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
  38. } xmlPatternFlags;
  39. XMLPUBFUN void XMLCALL
  40. xmlFreePattern (xmlPatternPtr comp);
  41. XMLPUBFUN void XMLCALL
  42. xmlFreePatternList (xmlPatternPtr comp);
  43. XMLPUBFUN xmlPatternPtr XMLCALL
  44. xmlPatterncompile (const xmlChar *pattern,
  45. xmlDict *dict,
  46. int flags,
  47. const xmlChar **namespaces);
  48. XMLPUBFUN int XMLCALL
  49. xmlPatternMatch (xmlPatternPtr comp,
  50. xmlNodePtr node);
  51. /* streaming interfaces */
  52. typedef struct _xmlStreamCtxt xmlStreamCtxt;
  53. typedef xmlStreamCtxt *xmlStreamCtxtPtr;
  54. XMLPUBFUN int XMLCALL
  55. xmlPatternStreamable (xmlPatternPtr comp);
  56. XMLPUBFUN int XMLCALL
  57. xmlPatternMaxDepth (xmlPatternPtr comp);
  58. XMLPUBFUN int XMLCALL
  59. xmlPatternMinDepth (xmlPatternPtr comp);
  60. XMLPUBFUN int XMLCALL
  61. xmlPatternFromRoot (xmlPatternPtr comp);
  62. XMLPUBFUN xmlStreamCtxtPtr XMLCALL
  63. xmlPatternGetStreamCtxt (xmlPatternPtr comp);
  64. XMLPUBFUN void XMLCALL
  65. xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
  66. XMLPUBFUN int XMLCALL
  67. xmlStreamPushNode (xmlStreamCtxtPtr stream,
  68. const xmlChar *name,
  69. const xmlChar *ns,
  70. int nodeType);
  71. XMLPUBFUN int XMLCALL
  72. xmlStreamPush (xmlStreamCtxtPtr stream,
  73. const xmlChar *name,
  74. const xmlChar *ns);
  75. XMLPUBFUN int XMLCALL
  76. xmlStreamPushAttr (xmlStreamCtxtPtr stream,
  77. const xmlChar *name,
  78. const xmlChar *ns);
  79. XMLPUBFUN int XMLCALL
  80. xmlStreamPop (xmlStreamCtxtPtr stream);
  81. XMLPUBFUN int XMLCALL
  82. xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif /* LIBXML_PATTERN_ENABLED */
  87. #endif /* __XML_PATTERN_H__ */