deps/src/libxml2-2.9.1/doc/html/libxml-pattern.html
| |
|
|
|
|
|
|
|
|
|
| API Menu | |
|
| API Indexes | |
|
| Related links | |
|
|
|
|
|
|
| | parserInternals | | API documentation | | The XML C parser and toolkit of Gnome | relaxng | |
allows to compile and test pattern expressions for nodes either in a tree or based on a parser state.
Structure[xmlPattern](#xmlPattern)
struct _xmlPattern
The content of this structure is not made public by the API.
Enum[xmlPatternFlags](#xmlPatternFlags)
Typedef[xmlPattern](libxml-pattern.html#xmlPattern)*xmlPatternPtr
Structure[xmlStreamCtxt](#xmlStreamCtxt)
struct _xmlStreamCtxt
The content of this structure is not made public by the API.
Typedef[xmlStreamCtxt](libxml-pattern.html#xmlStreamCtxt)*xmlStreamCtxtPtr
void[xmlFreePattern](#xmlFreePattern)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
void[xmlFreePatternList](#xmlFreePatternList)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
void[xmlFreeStreamCtxt](#xmlFreeStreamCtxt)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream)
int[xmlPatternFromRoot](#xmlPatternFromRoot)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
[xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)[xmlPatternGetStreamCtxt](#xmlPatternGetStreamCtxt)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
int[xmlPatternMatch](#xmlPatternMatch)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp,
[xmlNodePtr](libxml-tree.html#xmlNodePtr)node)
int[xmlPatternMaxDepth](#xmlPatternMaxDepth)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
int[xmlPatternMinDepth](#xmlPatternMinDepth)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
int[xmlPatternStreamable](#xmlPatternStreamable)([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
[xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)[xmlPatterncompile](#xmlPatterncompile)(const[xmlChar](libxml-xmlstring.html#xmlChar)* pattern,
[xmlDict](libxml-dict.html#xmlDict)* dict,
int flags,
const[xmlChar](libxml-xmlstring.html#xmlChar)** namespaces)
int[xmlStreamPop](#xmlStreamPop)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream)
int[xmlStreamPush](#xmlStreamPush)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* ns)
int[xmlStreamPushAttr](#xmlStreamPushAttr)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* ns)
int[xmlStreamPushNode](#xmlStreamPushNode)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* ns,
int nodeType)
int[xmlStreamWantsAnyNode](#xmlStreamWantsAnyNode)([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)streamCtxt)
Structure xmlPattern
struct _xmlPattern {
The content of this structure is not made public by the API.
}
Enum xmlPatternFlags {XML\_PATTERN\_DEFAULT= 0 : simple pattern matchXML\_PATTERN\_XPATH= 1 : standard XPath patternXML\_PATTERN\_XSSEL= 2 : XPath subset for schema selectorXML\_PATTERN\_XSFIELD= 4 : XPath subset for schema field
}
Structure xmlStreamCtxt
struct _xmlStreamCtxt {
The content of this structure is not made public by the API.
}
void xmlFreePattern ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
Free up the memory allocated by @comp
| comp: | an XSLT comp |
void xmlFreePatternList ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
Free up the memory allocated by all the elements of @comp
| comp: | an XSLT comp list |
void xmlFreeStreamCtxt ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream)
Free the stream context
| stream: | the stream context |
int xmlPatternFromRoot ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)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 |
[xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)xmlPatternGetStreamCtxt ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp)
Get a streaming context for that pattern Use xmlFreeStreamCtxt to free the context.
| comp: | the precompiled pattern | | Returns: | a pointer to the context or NULL in case of failure |
int xmlPatternMatch ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)comp,
[xmlNodePtr](libxml-tree.html#xmlNodePtr)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 |
int xmlPatternMaxDepth ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)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 |
int xmlPatternMinDepth ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)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, |
int xmlPatternStreamable ([xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)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. |
[xmlPatternPtr](libxml-pattern.html#xmlPatternPtr)xmlPatterncompile (const[xmlChar](libxml-xmlstring.html#xmlChar)* pattern,
[xmlDict](libxml-dict.html#xmlDict)* dict,
int flags,
const[xmlChar](libxml-xmlstring.html#xmlChar)** namespaces)
Compile a pattern.
| pattern: | the pattern to compile | | dict: | an optional dictionary for interned strings | | flags: | compilation flags, see xmlPatternFlags | | namespaces: | the prefix definitions, array of [URI, prefix] or NULL | | Returns: | the compiled form of the pattern or NULL in case of error |
int xmlStreamPop ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream)
push one level from the stream.
| stream: | the stream context | | Returns: | -1 in case of error, 0 otherwise. |
int xmlStreamPush ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* 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. |
int xmlStreamPushAttr ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* ns)
Push new attribute 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. |
int xmlStreamPushNode ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)stream,
const[xmlChar](libxml-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml-xmlstring.html#xmlChar)* 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. |
int xmlStreamWantsAnyNode ([xmlStreamCtxtPtr](libxml-pattern.html#xmlStreamCtxtPtr)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. |
|
|
|
|
|