< prev index next >

modules/javafx.web/src/main/native/Source/ThirdParty/libxslt/src/libxslt/documents.c

Print this page
rev 11102 : 8227402: Improve XSLT processing
Reviewed-by: kcr, rhalade


 279  * Try to load a document (not a stylesheet)
 280  * within the XSLT transformation context
 281  *
 282  * Returns the new xsltDocumentPtr or NULL in case of error
 283  */
 284 xsltDocumentPtr
 285 xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
 286     xsltDocumentPtr ret;
 287     xmlDocPtr doc;
 288 
 289     if ((ctxt == NULL) || (URI == NULL))
 290     return(NULL);
 291 
 292     /*
 293      * Security framework check
 294      */
 295     if (ctxt->sec != NULL) {
 296     int res;
 297 
 298     res = xsltCheckRead(ctxt->sec, ctxt, URI);
 299     if (res == 0) {

 300         xsltTransformError(ctxt, NULL, NULL,
 301          "xsltLoadDocument: read rights for %s denied\n",
 302                  URI);
 303         return(NULL);
 304     }
 305     }
 306 
 307     /*
 308      * Walk the context list to find the document if preparsed
 309      */
 310     ret = ctxt->docList;
 311     while (ret != NULL) {
 312     if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
 313         (xmlStrEqual(ret->doc->URL, URI)))
 314         return(ret);
 315     ret = ret->next;
 316     }
 317 
 318     doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions,
 319                                (void *) ctxt, XSLT_LOAD_DOCUMENT);


 355  *
 356  * Returns the new xsltDocumentPtr or NULL in case of error
 357  */
 358 xsltDocumentPtr
 359 xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
 360     xsltDocumentPtr ret;
 361     xmlDocPtr doc;
 362     xsltSecurityPrefsPtr sec;
 363 
 364     if ((style == NULL) || (URI == NULL))
 365     return(NULL);
 366 
 367     /*
 368      * Security framework check
 369      */
 370     sec = xsltGetDefaultSecurityPrefs();
 371     if (sec != NULL) {
 372     int res;
 373 
 374     res = xsltCheckRead(sec, NULL, URI);
 375     if (res == 0) {

 376         xsltTransformError(NULL, NULL, NULL,
 377          "xsltLoadStyleDocument: read rights for %s denied\n",
 378                  URI);
 379         return(NULL);
 380     }
 381     }
 382 
 383     /*
 384      * Walk the context list to find the document if preparsed
 385      */
 386     ret = style->docList;
 387     while (ret != NULL) {
 388     if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
 389         (xmlStrEqual(ret->doc->URL, URI)))
 390         return(ret);
 391     ret = ret->next;
 392     }
 393 
 394     doc = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS,
 395                                (void *) style, XSLT_LOAD_STYLESHEET);




 279  * Try to load a document (not a stylesheet)
 280  * within the XSLT transformation context
 281  *
 282  * Returns the new xsltDocumentPtr or NULL in case of error
 283  */
 284 xsltDocumentPtr
 285 xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
 286     xsltDocumentPtr ret;
 287     xmlDocPtr doc;
 288 
 289     if ((ctxt == NULL) || (URI == NULL))
 290     return(NULL);
 291 
 292     /*
 293      * Security framework check
 294      */
 295     if (ctxt->sec != NULL) {
 296     int res;
 297 
 298     res = xsltCheckRead(ctxt->sec, ctxt, URI);
 299     if (res <= 0) {
 300             if (res == 0)
 301                 xsltTransformError(ctxt, NULL, NULL,
 302                      "xsltLoadDocument: read rights for %s denied\n",
 303                                  URI);
 304         return(NULL);
 305     }
 306     }
 307 
 308     /*
 309      * Walk the context list to find the document if preparsed
 310      */
 311     ret = ctxt->docList;
 312     while (ret != NULL) {
 313     if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
 314         (xmlStrEqual(ret->doc->URL, URI)))
 315         return(ret);
 316     ret = ret->next;
 317     }
 318 
 319     doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions,
 320                                (void *) ctxt, XSLT_LOAD_DOCUMENT);


 356  *
 357  * Returns the new xsltDocumentPtr or NULL in case of error
 358  */
 359 xsltDocumentPtr
 360 xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
 361     xsltDocumentPtr ret;
 362     xmlDocPtr doc;
 363     xsltSecurityPrefsPtr sec;
 364 
 365     if ((style == NULL) || (URI == NULL))
 366     return(NULL);
 367 
 368     /*
 369      * Security framework check
 370      */
 371     sec = xsltGetDefaultSecurityPrefs();
 372     if (sec != NULL) {
 373     int res;
 374 
 375     res = xsltCheckRead(sec, NULL, URI);
 376     if (res <= 0) {
 377             if (res == 0)
 378                 xsltTransformError(NULL, NULL, NULL,
 379                      "xsltLoadStyleDocument: read rights for %s denied\n",
 380                                  URI);
 381         return(NULL);
 382     }
 383     }
 384 
 385     /*
 386      * Walk the context list to find the document if preparsed
 387      */
 388     ret = style->docList;
 389     while (ret != NULL) {
 390     if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
 391         (xmlStrEqual(ret->doc->URL, URI)))
 392         return(ret);
 393     ret = ret->next;
 394     }
 395 
 396     doc = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS,
 397                                (void *) style, XSLT_LOAD_STYLESHEET);


< prev index next >