try to fix duplicated fields in attribute and child element#96
try to fix duplicated fields in attribute and child element#96stzdzyhs wants to merge 2 commits intox-stream:masterfrom
Conversation
|
XStream actually works internally only on a parent-child-hierarchy. It is syntactic sugar, that you can setup XStream to read/write the value of a child as attribute instead. In fact, even if you have configured a child element to be an attribute, it is still read from a child element if the attribute is not present. XStream does not separate between child elements and attributes and does therefore not support mapping to different fields for the same identifier used for the attribute and element name. You can implement a workaround using a custom mapper (see XStream' acceptance test CustomMapperTest for some ideas) to circumvent the limitation for a specific case, but that will not be a general solution. |
|
Thanks for your suggestion ! in my testing (TestMapper.java), after apply the fix, it can get the resultMap.id in the mapper1.xml. Regards |
Hi, this pull request to try to fix duplicated name in attribute and child element like following xml:
resultMap has both attribute and child element named with "id".
this is mybatis(http://www.mybatis.org) mapper xml.
I know that the fix will fail some other testcases, because this is only fix using in annotation.
just not sure if the fix is right way to go.
Thanks!