1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

parser: Add XML_INPUT_USE_SYS_CATALOG

Also clean up catalog resolution and add error handling using the
global error.

Don't try to look up the resolved URI a second time.

Add some comments. Fix documentation.
This commit is contained in:
Nick Wellnhofer
2025-05-26 01:13:24 +02:00
parent 34bafa14fe
commit 30cf6d0980
2 changed files with 175 additions and 106 deletions

View File

@@ -87,7 +87,9 @@ typedef enum {
/** Uncompress gzipped file input */
XML_INPUT_UNZIP = (1 << 3),
/** Allow network access. Unused internally. */
XML_INPUT_NETWORK = (1 << 4)
XML_INPUT_NETWORK = (1 << 4),
/** Allow system catalog to resolve URIs. */
XML_INPUT_USE_SYS_CATALOG = (1 << 5)
} xmlParserInputFlags;
/* Deprecated */
@@ -216,11 +218,14 @@ typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
*
* `flags` can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK.
*
* The URL is resolved using XML catalogs before being passed to
* the callback.
*
* On success, `out` should be set to a new parser input object and
* XML_ERR_OK should be returned.
*
* @param ctxt parser context
* @param url URL to load
* @param url URL or system ID to load
* @param publicId publid ID from DTD (optional)
* @param type resource type
* @param flags flags
@@ -1215,15 +1220,18 @@ struct _xmlSAXHandlerV1 {
/**
* External entity loader.
* Callback for external entity loader.
*
* @param URL The System ID of the resource requested
* @param ID The Public ID of the resource requested
* The URL is not resolved using XML catalogs before being passed
* to the callback.
*
* @param URL The URL or system ID of the resource requested
* @param publicId The public ID of the resource requested (optional)
* @param context the XML parser context
* @returns the entity input parser.
* @returns the entity input parser or NULL on error.
*/
typedef xmlParserInput *(*xmlExternalEntityLoader) (const char *URL,
const char *ID,
const char *publicId,
xmlParserCtxt *context);
/*