We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm trying to parse an xml file like this:
<?xml version='1.0'?> <replacements xml:space='preserve' incomplete_format='false'> <replacement offset='106' length='8'> </replacement> </replacements>
This xml is generated by clang-format -output-replacements-xml, so it is critical that whitespaces are correctly parsed as string values.
clang-format -output-replacements-xml
However, when I parse it with XmlMapper, the returned value is null
assertEquals(" ", response.replacements[0].value) // value is null
build.gradle.kts:
dependencies { implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.1") }
@JacksonXmlRootElement(localName = "replacements") public class ClangFormatResponse { public static ClangFormatResponse unmarshal(@NotNull String stdout) { try { XmlMapper xmlMapper = new XmlMapper(); return xmlMapper.readValue(stdout, ClangFormatResponse.class); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } @JacksonXmlProperty(localName = "space", isAttribute = true) public String space; @JacksonXmlProperty(localName = "incomplete_format", isAttribute = true) public boolean incompleteFormat; @JacksonXmlProperty(localName = "replacement") @JacksonXmlElementWrapper(useWrapping = false) public final List<ClangFormatReplacement> replacements = new ArrayList<>(); } public class ClangFormatReplacement { @JacksonXmlProperty(isAttribute = true) public int offset; @JacksonXmlProperty(isAttribute = true) public int length; @JacksonXmlText(false) public String value; }
From my analysis, I found that the text value is ignored due to this check
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, I'm trying to parse an xml file like this:
This xml is generated by
clang-format -output-replacements-xml
, so it is critical that whitespaces are correctly parsed as string values.However, when I parse it with XmlMapper, the returned value is null
My setup
build.gradle.kts:
My debug
From my analysis, I found that the text value is ignored due to this check
The text was updated successfully, but these errors were encountered: