You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/04/13 00:31:00 UTC

[jira] [Updated] (GROOVY-11927) Add toMap() and typed parsing support to XmlParser

     [ https://issues.apache.org/jira/browse/GROOVY-11927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-11927:
-------------------------------
    Summary: Add toMap() and typed parsing support to XmlParser  (was: GROOVY-11927: Add toMap() and typed parsing support to XmlParser)

> Add toMap() and typed parsing support to XmlParser
> --------------------------------------------------
>
>                 Key: GROOVY-11927
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11927
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>
> Add `Node.toMap()` for converting XML node trees to nested Maps, and `XmlParser.parseTextAs()`/`parseAs()` for typed XML parsing via Jackson databinding.
> Three levels of support:
> - `node.toMap()` — zero-dependency conversion to `Map<String, Object>`, usable standalone
> - `node as MyType` — coercion via `toMap()` + Groovy's named-param constructor (works for String-typed properties, no additional deps)
> - `parser.parseTextAs(Type, xml)` — full typed conversion (String→int, boolean, etc.) plus `@JsonProperty`/`@JsonFormat` support; requires `jackson-databind` at runtime, throws clear error if absent
> Also adds `XmlRuntimeException` and an internal `JacksonHelper` utility using reflective access to avoid a compile-time Jackson dependency on `groovy-xml`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)