Skip to content

Add XMLElement::QueryText convenience method - #1109

Open
neeldj wants to merge 1 commit into
leethomason:masterfrom
neeldj:add-querytext
Open

neeldj wants to merge 1 commit into
leethomason:masterfrom
neeldj:add-querytext

Conversation

@neeldj

@neeldj neeldj commented Nov 10, 2026

Copy link
Copy Markdown

Closes #1046.

Add XMLElement::QueryText(const char**) so callers can initialize a text value
with a default and preserve it when the element has no eligible text node. The
method follows GetText() semantics, returns XML_SUCCESS or
XML_NO_TEXT_NODE, and uses document-owned text without allocating a separate
buffer. The header documents the returned pointer's lifetime.

Tests cover ordinary and missing text, a nested element preceding text, leading
comments, CDATA, UTF-8/entity decoding, and an empty programmatic text node.
Verification on Windows with MinGW GCC/G++ 15.2.0: Debug static, Release static,
and Release shared builds and CTest runs passed; xmltest reported 543 passed
checks and zero failures. Test configurations were run separately because they
share fixture output files.

AI assistance: ByteAsk assisted with investigation, implementation, test authoring,
and verification. Codex assisted with repository selection, review, and independent
build/test verification.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance 'GetText()' to return a default value and/or add a convenience function ' XMLError QueryText(const char **)'

1 participant