  
    
    
    
    
    
    
    
  
  
    
      
        
          
libxml2-parserInternals.html            
Prev          
        
        
          
general.html            
Up          
        
        
          
index.html            
Home          
        
        
          
libxml2-relaxng.html            
Next          
        
        
libxml2 Reference Manual      
    
    
      
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 libxml2-pattern.html#xmlStreamCtxtxmlStreamCtxt  * #xmlStreamCtxtPtrxmlStreamCtxtPtr ;
typedef enum 
#xmlPatternFlagsxmlPatternFlags ;
typedef struct _xmlStreamCtxt 
#xmlStreamCtxtxmlStreamCtxt ;
typedef struct _xmlPattern 
#xmlPatternxmlPattern ;
typedef 
libxml2-pattern.html#xmlPatternxmlPattern  * #xmlPatternPtrxmlPatternPtr ;
int	
#xmlPatternMinDepthxmlPatternMinDepth 		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr 	#xmlPatternGetStreamCtxtxmlPatternGetStreamCtxt 	( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
int	
#xmlPatternFromRootxmlPatternFromRoot 		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
void	
#xmlFreePatternListxmlFreePatternList 		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
int	
#xmlPatternStreamablexmlPatternStreamable 		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
int	
#xmlStreamPushAttrxmlStreamPushAttr 		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * ns);
int	
#xmlPatternMatchxmlPatternMatch 			( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp, 					 libxml2-tree.html#xmlNodePtrxmlNodePtr  node);
int	
#xmlStreamWantsAnyNodexmlStreamWantsAnyNode 		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  streamCtxt);
int	
#xmlStreamPopxmlStreamPop 			( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream);
void	
#xmlFreePatternxmlFreePattern 			( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
int	
#xmlStreamPushxmlStreamPush 			( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * ns);
int	
#xmlPatternMaxDepthxmlPatternMaxDepth 		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp);
libxml2-pattern.html#xmlPatternPtrxmlPatternPtr 	#xmlPatterncompilexmlPatterncompile 	(const libxml2-xmlstring.html#xmlCharxmlChar  * pattern, 					 libxml2-dict.html#xmlDictxmlDict  * dict, 					 int flags, 					 const libxml2-xmlstring.html#xmlCharxmlChar  ** namespaces);
int	
#xmlStreamPushNodexmlStreamPushNode 		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * ns, 					 int nodeType);
void	
#xmlFreeStreamCtxtxmlFreeStreamCtxt 		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream);
    
    
      
Description
    
    
      
Details
      
        
Structure xmlPattern
struct _xmlPattern {
The content of this structure is not made public by the API.
} xmlPattern;
        
        
Enum xmlPatternFlags
enum #xmlPatternFlagsxmlPatternFlags  {
    
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
libxml2-pattern.html#xmlPatternxmlPattern  * xmlPatternPtr;
        
        
Structure xmlStreamCtxt
struct _xmlStreamCtxt {
The content of this structure is not made public by the API.
} xmlStreamCtxt;
        
        
Typedef xmlStreamCtxtPtr
libxml2-pattern.html#xmlStreamCtxtxmlStreamCtxt  * xmlStreamCtxtPtr;
        
        
xmlFreePattern ()
void	xmlFreePattern			( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp)Free up the memory allocated by @comp
comp: an XSLT comp         
        
xmlFreePatternList ()
void	xmlFreePatternList		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp)Free up the memory allocated by all the elements of @comp
comp: an XSLT comp list         
        
xmlFreeStreamCtxt ()
void	xmlFreeStreamCtxt		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream)Free the stream context
stream: the stream context         
        
xmlPatternFromRoot ()
int	xmlPatternFromRoot		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  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 ()
libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr 	xmlPatternGetStreamCtxt	( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp)Get a streaming context for that pattern Use libxml2-pattern.html#xmlFreeStreamCtxtxmlFreeStreamCtxt  to free the context.
comp: the precompiled pattern Returns: a pointer to the context or NULL in case of failure         
        
xmlPatternMatch ()
int	xmlPatternMatch			( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  comp, 					 libxml2-tree.html#xmlNodePtrxmlNodePtr  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		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  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		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  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		( libxml2-pattern.html#xmlPatternPtrxmlPatternPtr  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 ()
libxml2-pattern.html#xmlPatternPtrxmlPatternPtr 	xmlPatterncompile	(const libxml2-xmlstring.html#xmlCharxmlChar  * pattern, 					 libxml2-dict.html#xmlDictxmlDict  * dict, 					 int flags, 					 const libxml2-xmlstring.html#xmlCharxmlChar  ** namespaces)Compile a pattern.
pattern: the pattern to compile dict: an optional dictionary for interned strings flags: compilation flags, see libxml2-pattern.html#xmlPatternFlagsxmlPatternFlags 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			( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream)push one level from the stream.
stream: the stream context Returns: -1 in case of error, 0 otherwise.         
        
xmlStreamPush ()
int	xmlStreamPush			( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * 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		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * ns)Push new libxml2-SAX.html#attributeattribute  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		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  stream, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * name, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * 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 document. This can also act as a reset. Different from xmlStreamPush() this function can be fed with nodes of type: element-, attribute-, text-, cdata-section-, comment- and processing-instruction-node.
stream: the stream context name: the current name ns: the namespace name nodeType: the type of the node being pushed Returns: -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.         
        
xmlStreamWantsAnyNode ()
int	xmlStreamWantsAnyNode		( libxml2-pattern.html#xmlStreamCtxtPtrxmlStreamCtxtPtr  streamCtxt)Query if the streaming pattern additionally needs to be fed with text-, cdata-section-, comment- and processing-instruction-nodes. If the result is 0 then only element-nodes and attribute-nodes need to be pushed.
streamCtxt: the stream context Returns: 1 in case of need of nodes of the above described types, 0 otherwise. -1 on API errors.         
      
    
  
