When using the map policy to map an XML input to a JSON output, you should map leaf elements and not upper level objects. That is because the XML is converted internally to a JSON format using the badgerfish convention. For example, the element
<name>value</name>
is represented in JSON as
"name": {"$": "value"}
If your XML had an attribute
<name attr="attrvalue">value</name>
the JSON equivalent would be
"name": {"$": "value", "@attr":"attrvalue"}
The map policy handles this for leaf nodes, but if you wire up higher level objects, then the mapping will pull those artifacts along.
Object mappings will also allow output to be created that does not match the output schema regardless of whether the source is XML or JSON, but assuming the input data is well behaved and matches the output schema, there is an map policy option to "post process" the JSON output. Enabling this option will compare the final mapping result to the output schema and will "de-bagerfish" the result and match the results to have the datatype specified by the schema, but again, any XML input element that wasn't in the output schema that would continue to have the badgerfish notation as the map policy wouldn't not know how to handle this JSON property that isn't in the schema.
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------