~ubuntu-branches/ubuntu/trusty/libxml-libxml-perl/trusty-security

« back to all changes in this revision

Viewing changes to xpath.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-10-16 14:10:26 UTC
  • mfrom: (1.2.26)
  • Revision ID: package-import@ubuntu.com-20121016141026-3x0th9su7cue9hl0
Tags: 2.0006+dfsg-1
* New upstream release
* Refresh patches
* Bump Standards-Version to 3.9.4 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    }
42
42
 
43
43
 
44
 
    /* first assure the XML::LibXML error handler is deactivated 
 
44
    /* first assure the XML::LibXML error handler is deactivated
45
45
       otherwise strange things might happen
46
46
     */
47
47
 
143
143
 
144
144
 
145
145
/**
146
 
 * Most of the code is stolen from testXPath. 
 
146
 * Most of the code is stolen from testXPath.
147
147
 * The almost only thing I added, is the storeing of the data, so
148
148
 * we can access the data easily - or say more easiely than through
149
149
 * libxml2.
165
165
xmlXPathObjectPtr
166
166
domXPathCompFind( xmlNodePtr refNode, xmlXPathCompExprPtr comp, int to_bool ) {
167
167
    xmlXPathObjectPtr res = NULL;
168
 
  
 
168
 
169
169
    if ( refNode != NULL && comp != NULL ) {
170
170
        xmlXPathContextPtr ctxt;
171
171
 
175
175
        if ( comp == NULL ) {
176
176
            return NULL;
177
177
        }
178
 
        
 
178
 
179
179
        if ( refNode->doc == NULL ) {
180
180
            /* if one XPaths a node from a fragment, libxml2 will
181
181
               refuse the lookup. this is not very useful for XML
260
260
domXPathSelect( xmlNodePtr refNode, xmlChar * path ) {
261
261
    xmlNodeSetPtr rv = NULL;
262
262
    xmlXPathObjectPtr res = NULL;
263
 
  
 
263
 
264
264
    res = domXPathFind( refNode, path, 0 );
265
 
    
 
265
 
266
266
    if (res != NULL) {
267
267
            /* here we have to transfer the result from the internal
268
268
               structure to the return value */
269
269
                /* get the result from the query */
270
 
                /* we have to unbind the nodelist, so free object can 
 
270
                /* we have to unbind the nodelist, so free object can
271
271
                   not kill it */
272
 
        rv = res->nodesetval;  
 
272
        rv = res->nodesetval;
273
273
        res->nodesetval = 0 ;
274
274
    }
275
275
 
283
283
domXPathCompSelect( xmlNodePtr refNode, xmlXPathCompExprPtr comp ) {
284
284
    xmlNodeSetPtr rv = NULL;
285
285
    xmlXPathObjectPtr res = NULL;
286
 
  
 
286
 
287
287
    res = domXPathCompFind( refNode, comp, 0 );
288
 
    
 
288
 
289
289
    if (res != NULL) {
290
290
            /* here we have to transfer the result from the internal
291
291
               structure to the return value */
292
292
                /* get the result from the query */
293
 
                /* we have to unbind the nodelist, so free object can 
 
293
                /* we have to unbind the nodelist, so free object can
294
294
                   not kill it */
295
 
        rv = res->nodesetval;  
 
295
        rv = res->nodesetval;
296
296
        res->nodesetval = 0 ;
297
297
    }
298
298
 
302
302
}
303
303
 
304
304
/**
305
 
 * Most of the code is stolen from testXPath. 
 
305
 * Most of the code is stolen from testXPath.
306
306
 * The almost only thing I added, is the storeing of the data, so
307
307
 * we can access the data easily - or say more easiely than through
308
308
 * libxml2.
387
387
domXPathSelectCtxt( xmlXPathContextPtr ctxt, xmlChar * path ) {
388
388
    xmlNodeSetPtr rv = NULL;
389
389
    xmlXPathObjectPtr res = NULL;
390
 
  
 
390
 
391
391
    res = domXPathFindCtxt( ctxt, path, 0 );
392
 
    
 
392
 
393
393
    if (res != NULL) {
394
394
            /* here we have to transfer the result from the internal
395
395
               structure to the return value */
396
396
                /* get the result from the query */
397
 
                /* we have to unbind the nodelist, so free object can 
 
397
                /* we have to unbind the nodelist, so free object can
398
398
                   not kill it */
399
 
        rv = res->nodesetval;  
 
399
        rv = res->nodesetval;
400
400
        res->nodesetval = 0 ;
401
401
    }
402
402