summaryrefslogtreecommitdiff
path: root/LibXML.xs
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-07-25 08:44:28 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-07-25 08:44:28 +0900
commit386653a5f530a4e00811bacc50ae734d5610695d (patch)
treec6f6c4e3d74f202bd65a80e06992debe83e4e1ab /LibXML.xs
parentbed2f52e9348362135cc7cc4e6cedfe306744b20 (diff)
downloadperl-XML-LibXML-386653a5f530a4e00811bacc50ae734d5610695d.tar.gz
perl-XML-LibXML-386653a5f530a4e00811bacc50ae734d5610695d.tar.bz2
perl-XML-LibXML-386653a5f530a4e00811bacc50ae734d5610695d.zip
Imported Upstream version 2.0202upstream/2.0202
Diffstat (limited to 'LibXML.xs')
-rw-r--r--LibXML.xs83
1 files changed, 73 insertions, 10 deletions
diff --git a/LibXML.xs b/LibXML.xs
index efca0b6..51bb3be 100644
--- a/LibXML.xs
+++ b/LibXML.xs
@@ -7337,11 +7337,14 @@ DESTROY( self )
xmlRelaxNGPtr
-parse_location( self, url )
+parse_location( self, url, parser_options = 0, recover = FALSE )
char * url
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7357,20 +7360,33 @@ parse_location( self, url )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlRelaxNGPtr
-parse_buffer( self, perlstring )
+parse_buffer( self, perlstring, parser_options = 0, recover = FALSE )
SV * perlstring
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
char * string = NULL;
STRLEN len = 0;
PREINIT_SAVED_ERROR
@@ -7393,20 +7409,33 @@ parse_buffer( self, perlstring )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlRelaxNGPtr
-parse_document( self, doc )
+parse_document( self, doc, parser_options = 0, recover = FALSE )
xmlDocPtr doc
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7422,10 +7451,20 @@ parse_document( self, doc )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
@@ -7487,11 +7526,14 @@ DESTROY( self )
xmlSchemaPtr
-parse_location( self, url )
+parse_location( self, url, parser_options = 0, recover = FALSE )
char * url
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::Schema";
xmlSchemaParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7509,20 +7551,32 @@ parse_location( self, url )
(xmlSchemaValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlSchemaParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlSchemaFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlSchemaPtr
-parse_buffer( self, perlstring )
+parse_buffer( self, perlstring, parser_options = 0, recover = FALSE )
SV * perlstring
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::Schema";
xmlSchemaParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
char * string = NULL;
STRLEN len = 0;
PREINIT_SAVED_ERROR
@@ -7547,10 +7601,19 @@ parse_buffer( self, perlstring )
(xmlSchemaValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlSchemaParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlSchemaFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL