236 Commits

Author SHA1 Message Date
Nick Wellnhofer
b349225952 include: Change some return types from int to enum
This also affects some new functions from 2.13.
2025-03-14 02:31:01 +01:00
Nick Wellnhofer
fd1b939168 include: Convert some macros to enums 2025-03-14 00:35:40 +01:00
Nick Wellnhofer
03a8f1dd75 doc: Document SAX handlers a little more 2025-03-11 18:53:59 +01:00
Nick Wellnhofer
ba9148d8a5 parser: Undeprecate input->consumed
Should be deprecated after fixing #762.
2025-03-09 20:30:49 +01:00
Nick Wellnhofer
a0dbf030ee parser: Undeprecate ctxt->loadsubset
Should be deprecated after fixing #873.
2025-03-09 20:24:06 +01:00
Nick Wellnhofer
d96911f100 doc: Documentation fixes 2025-03-08 23:03:26 +01:00
Nick Wellnhofer
5f0b1378d7 parser: Add more parser context accessors
Fixes #763.
2025-03-08 22:36:06 +01:00
Nick Wellnhofer
696572248f globals: Remove unused globals
- xmlBufferAllocScheme
- xmlDefaultBufferSize
- xmlParserDebugEntities
2025-03-05 12:24:38 +01:00
Nick Wellnhofer
3d37ff84c3 globals: Also use global state struct if threads are disabled 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
a15ad9b268 parser: Remove compatibility symbols 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
8e871162a6 parser: Remove oldXMLWDcompatibility 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
cdc5cfed0b legacy: Remove legacy symbols 2025-03-04 16:54:05 +01:00
Nick Wellnhofer
e50d314a27 build: Add separate configuration option for RELAX NG
Support for RELAX NG used to be enabled together with XML Schema support
(--with-schemas). Now there's a separate option and a new feature macro
LIBXML_RELAXNG_ENABLED.
2025-03-01 15:18:20 +01:00
Nick Wellnhofer
93506d41cb parser: Make catalog PIs opt-in
This is an obscure feature that shouldn't be enabled by default.
2025-01-29 00:50:47 +01:00
Nick Wellnhofer
1082d813e8 parser: Prepare to make decompression opt-in
Add a new parser option XML_PARSE_UNZIP that enables decompression.
xmlReadFile, xmlCtxtReadFile and xmlCreateURLParserCtxt always set
this option currently, but downstream users should start to set the
option if they really need it.
2025-01-29 00:49:57 +01:00
Nick Wellnhofer
0dc26910c1 parser: Deprecate more internal functions 2024-11-21 22:31:20 +01:00
Nick Wellnhofer
5a51f08517 valid: Implement xmlCtxtValidateDocument
This allows to use the error handler or resource loader of a parser
context.
2024-11-19 00:03:37 +01:00
Nick Wellnhofer
7f8c436c75 parser: Implement xmlCtxtParseDtd and xmlCtxtValidateDtd
This allows to use the context's error handler, options and other
settings.

Fixes #808.
2024-11-15 16:30:52 +01:00
Nick Wellnhofer
eb66d03ef7 io: Deprecate a few functions 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
69f12d6d47 encoding: Deprecate xmlByteConsumed
This was only used by Chromium/WebKit to detect whether xmlParseContent
really succeeded. It's a horrible, overcomplicated hack.

See 8c5848bd and #767.
2024-07-13 15:42:02 +02:00
Nick Wellnhofer
8af55c8d20 parser: Rename new input API functions
These weren't made public yet.
2024-07-11 01:33:29 +02:00
Nick Wellnhofer
4f329dc524 parser: Implement xmlCtxtParseContent
This implements xmlCtxtParseContent, a better alternative to
xmlParseInNodeContext or xmlParseBalancedChunkMemory. It accepts a
parser context and a parser input, making it a lot more versatile.

xmlParseInNodeContext is now implemented in terms of
xmlCtxtParseContent. This makes sure that xmlParseInNodeContext never
modifies the target document, improving thread safety.
xmlParseInNodeContext is also more lenient now with regard to undeclared
entities.

Fixes #727.
2024-07-11 01:26:32 +02:00
Nick Wellnhofer
82e0455cf6 Undeprecate some symbols for now
- xmlKeepBlanksDefault is needed as a work-around for
  xmlParseBalancedChunk, see issue #727.
- ctxt->options already has an accessor and will be deprecated
  later.
- input->cur, input->base, input->end: See #762.
2024-07-06 20:19:51 +02:00
Nick Wellnhofer
205e56dafe parser: Undeprecate ctxt->directory 2024-07-02 22:32:43 +02:00
Nick Wellnhofer
606f410891 parser: Allow to disable catalogs with parser options
Implement XML_PARSE_NO_SYS_CATALOG and XML_PARSE_NO_CATALOG_PI.

Fixes #735.
2024-07-02 22:06:53 +02:00
Nick Wellnhofer
221df37529 parser: Support custom charset conversion implementations
Implement xmlCtxtSetCharEncConvImpl. I agree that the name is terrible.
2024-07-01 18:05:40 +02:00
Nick Wellnhofer
044ddf07b9 parser: Undeprecate some parser context members 2024-06-29 01:22:15 +02:00
Nick Wellnhofer
193f4653a5 parser: Implement xmlCtxtGetStatus
This allows access to ctxt->wellFormed, ctxt->nsWellFormed and
ctxt->valid. It also detects several fatal non-parser errors which
really should be another error level.
2024-06-27 15:17:40 +02:00
Nick Wellnhofer
cc0cc2d3b7 parser: Add more parser context accessors 2024-06-27 14:45:33 +02:00
Nick Wellnhofer
eca972e682 parser: Add getters for XML declaration to parser context
Access to struct members will be deprecated.
2024-06-27 14:44:49 +02:00
Nick Wellnhofer
f9c33a5519 parser: Undeprecate some xmlParserInput members 2024-06-21 18:25:11 +02:00
Nick Wellnhofer
1228b4e0e7 parser: Deprecate xmlParserCtxt->lastError
We alredy have xmlCtxtGetLastError().
2024-06-21 18:22:04 +02:00
Nick Wellnhofer
f82ca02bf5 parser: Undeprecate some xmlParserCtxt members
These are essential for SAX parsers.
2024-06-21 18:17:11 +02:00
Mike Dalessio
bbbbbb4649 parser: implement xmlCtxtGetOptions
In 712a31ab, the `options` struct member was deprecated. To allow
callers to check the status of options bits, introduce
xmlCtxtGetOptions.
2024-06-20 20:39:54 +00:00
Nick Wellnhofer
1112699cfa legacy: Remove most legacy functions from public headers
Also remove warning messages.
2024-06-17 15:47:42 +02:00
Nick Wellnhofer
5fca9498fd doc: Hide internal macro 2024-06-16 19:56:08 +02:00
Nick Wellnhofer
387f0c784f include: Readd circular dependency between tree.h and parser.h
There are dozens of downstream projects that only include tree.h but use
declarations from parser.h. This broke after the recent cleanup of
circular dependencies.

Make tree.h include parser.h again. This is a hack but doesn't change
the include directory struture.

This commit only made it into the 2.12 branch but wasn't applied to
master, so the issue turned up in 2.13.0 again.

Should fix #734.
2024-06-15 16:27:54 +02:00
Nick Wellnhofer
712a31abe4 parser: Deprecate most public struct members
This will probably cause many warnings in downstream code abusing
libxml2 internals, but we can always undeprecate some members later.
2024-06-13 18:04:34 +02:00
Nick Wellnhofer
5238404325 parser: Pass resource type to resource loader 2024-06-12 16:36:12 +02:00
Nick Wellnhofer
64ad272525 parser: Introduce per-context resource loader 2024-06-12 16:22:52 +02:00
Nick Wellnhofer
ff3b091910 parser: Implement XML_PARSE_NO_UNZIP option 2024-06-12 16:14:15 +02:00
Nick Wellnhofer
5b1d7ff0b2 parser: Remove redefinitions for legacy globals 2024-05-20 23:59:55 +02:00
Nick Wellnhofer
8961056f9b parser: Make experimental input API private
This needs to be reworked.
2024-01-23 00:47:44 +01:00
Nick Wellnhofer
02cc5c3609 parser: Add XML_PARSE_NO_XXE parser option 2024-01-05 20:39:40 +01:00
Nick Wellnhofer
12f0bb9478 parser: Synchronize more options 2024-01-05 20:39:40 +01:00
Nick Wellnhofer
3efbe916a1 parser: Mark 'token' member as unused in xmlParserCtxt 2024-01-05 20:39:40 +01:00
Nick Wellnhofer
b82fd81d06 parser: Rework xmlCtxtParseDocument
Make xmlCtxtParseDocument take a parser input which can be popped after
parsing.
2024-01-05 20:39:40 +01:00
Nick Wellnhofer
d7d300ba04 parser: Remove remnants of runtime debugging feature
Apparently, this feature was remove long ago.

Fixes #651.
2024-01-04 17:50:11 +01:00
Nick Wellnhofer
875bb08489 parser: Implement xmlCtxtSetOptions
Surprisingly, some options can only be enabled with xmlCtxtUseOptions
and it's impossible to unset them. Add a new API function
xmlCtxtSetOptions which sets or clears all options.

Finally document all parser options.

Make sure to synchronize option bits and struct members.
2024-01-02 19:42:06 +01:00
Nick Wellnhofer
2b79f106ff parser: Simplify entity size accounting 2024-01-02 14:17:27 +01:00