empty json field name when xml node has attributes
See original GitHub issueWhen i’m trying to read an xml like :
<toto>
<tata>toto</tata>
<foo bar="youhou">nodeValue</foo>
</toto>
new XmlMapper().readTree(xmlStream);
the result is :
{"tata":"toto","foo":{"bar":"youhou","":"nodeValue"}}
with jettison i have this result :
{"tata":"toto","foo":{"@bar":"youhou","$": "nodeValue"}}
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Can't parse empty xml property with attribute - Stack Overflow
It works perfectly with com.fasterxml.jackson of version 2.7.4 . But it fails with various errors if some of libraries has another version ...
Read more >Handling JSON null and empty arrays and objects - IBM
Empty property The JSON empty concept applies for arrays and objects as shown below. In the case of address, an empty address...
Read more >Limitations for JSON to XML Conversion - SAP Help Portal
The XML element and attribute names must not contain any delimiter characters, because the delimiter is used in JSON to separate the prefix...
Read more >XML Schema Complex Type - Empty Elements - W3Schools
XSD Empty Elements An empty complex element cannot have contents, only attributes.
Read more >Controlling XML Serialization Using Attributes - Microsoft Learn
By default, an XML element name is determined by the class or member name. In a class named Book , a field named...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
xmlMapper.setXMLTextElementName("$");
isn’t applicable because this method has a protected scope. But i can handle it withxmlMapper.getFactory().setXMLTextElementName("$");
Ah yes. Protected access due to
JacksonXmlModule
being the intended mechanism, avoiding adding setters in mapper itself. Although if you really want to, can sub-classXmlMapper
, open up access.