[Simple-support] Dynamic element name
Brought to you by:
niallg
|
From: Nugroho S. <nug...@gm...> - 2011-06-14 04:58:35
|
Hi,
Simple XML is a great framework, it support most of our requirements but I
have a question regarding dynamic element name.
I have some am working with XML that has dynamic element name. Please see
the sample below, in this case custom fields are dynamic:
<person>
<name>Nugroho</name>
.....
<custom_fields>
<birthdate>1976-12-26</birthdate>
<opted-out>true</opted-out>
</custom_fields>
</person>
It is possible to map custom fields in the above XML to a Map with element
name as map key ?
so the java class will be
class Person {
String name;
Map<String, String> customFields;
}
I have tried creating Converted for it. I can convert
from <custom_fields> InputNode to a Map but I am unable to convert Map to
OutputNode in write() method, because there are no method I can use to add a
child element in OutputNode.
Thank you.
Regards,
Nugroho
|