Skip to content

Preserve JSON scalar types on text nodes - #25

Merged
zhengchun merged 1 commit into
antchfx:masterfrom
rupayon123:contribution/typed-text-node-values-20260926
Sep 27, 2026
Merged

zhengchun merged 1 commit into
antchfx:masterfrom
rupayon123:contribution/typed-text-node-values-20260926

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

Fixes #20. Text nodes currently retain only a formatted string in their internal value, so Value() returns "12" for a JSON number and "true" for a JSON boolean. This differs from the typed value returned by their parent element and makes direct text-node selections lose JSON scalar types.

Keep the original decoded scalar as the text node's value while leaving Data as the display string. A regression first failed for numeric and boolean nodes, then passed with this change; it also checks that rendered text remains unchanged. Local go test ./..., go test -race ./..., go vet ./..., and diff check pass with Go 1.27.1. Remote CI is not yet verified. Prepared with AI assistance and reviewed against XPath navigation and rendering callers.

@zhengchun
zhengchun merged commit 0292060 into antchfx:master Sep 27, 2026
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.

Value() on text node is useless

2 participants