* xmlXPathNewParserContext: * @str: the XPath expression * @ctxt: the XPath context * * Create a new xmlXPathParserContext * * Returns the xmlXPathParserContext just allocated. */
| 5193 | * Returns the xmlXPathParserContext just allocated. |
| 5194 | */ |
| 5195 | xmlXPathParserContextPtr |
| 5196 | xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) { |
| 5197 | xmlXPathParserContextPtr ret; |
| 5198 | |
| 5199 | ret = (xmlXPathParserContextPtr) xmlMalloc(sizeof(xmlXPathParserContext)); |
| 5200 | if (ret == NULL) { |
| 5201 | xmlXPathErrMemory(ctxt); |
| 5202 | return(NULL); |
| 5203 | } |
| 5204 | memset(ret, 0 , sizeof(xmlXPathParserContext)); |
| 5205 | ret->cur = ret->base = str; |
| 5206 | ret->context = ctxt; |
| 5207 | |
| 5208 | ret->comp = xmlXPathNewCompExpr(); |
| 5209 | if (ret->comp == NULL) { |
| 5210 | xmlXPathErrMemory(ctxt); |
| 5211 | xmlFree(ret->valueTab); |
| 5212 | xmlFree(ret); |
| 5213 | return(NULL); |
| 5214 | } |
| 5215 | if ((ctxt != NULL) && (ctxt->dict != NULL)) { |
| 5216 | ret->comp->dict = ctxt->dict; |
| 5217 | xmlDictReference(ret->comp->dict); |
| 5218 | } |
| 5219 | |
| 5220 | return(ret); |
| 5221 | } |
| 5222 | |
| 5223 | /** |
| 5224 | * xmlXPathCompParserContext: |
no test coverage detected