Skip to content

QName (de)serialization ignores prefix #4771

Description

@jpraet

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

QName (de)serialization ignores prefix, because it uses QName#toString() and QName#valueOf(java.lang.String).

Version Information

2.17.2

Reproduction

        QName qname = new QName("http://test.com", "test", "p");
        System.out.println(qname.getPrefix()); // <- p
        ObjectMapper mapper = new ObjectMapper();
        String ser = mapper.writeValueAsString(writer, qname);
        System.out.println(ser); // <- "{http://test.com}test"
        QName result = mapper.readValue(ser, QName.class);
        System.out.println(result.getPrefix()); // <- empty string

Expected behavior

QName prefix is preserved.

Additional context

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.19Issues planned at 2.19 or later

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions