We are designing a system for processing XML messages.
The processing Java class needs to split out various attributes and values from a largish XML and pass these as parameters to individual handler classes for varied operations.
We have thought of following options:
A)
Pass the entire XML to each handler and let it extract the relevant bits - but feel this might be inefficient to pass the XML around each time
B)
Convert the XML into a DTO or set of smaller DTOs and pass each DTO to relevant handler
C)
Cut the XML into snippets and pass these to each handler method
We're not happy with each of these, so any suggestions which way to go?
Example XML
<IdAction>supplied</IdAction>
<RegId>true</RegId>
<DeRegId>false</DeRegId>
<SaveMessage>false</SaveMessage>
<ServiceName>abcRequest</ServiceName>
<timeToPerform>3600</timeToPerform>
<timeToReceipt/>
<SendToBES>true</SendToBES>
<BESQueueName>com.abc.gateway.JMSQueue.forAddRequest</BESQueueName>
<BESTransform/>
<BESJMSProperties>
<property>
<propName>stateCode</propName>
<propValue>OK</propValue>
</property>
<property>
<propName>stateResponse</propName>
<propValue>OK</propValue>
</property>
</BESJMSProperties>
This contains 4 blocks processed by 4 handlers one does
<IdAction>supplied</IdAction>
<RegId>true</RegId>
<DeRegId>false</DeRegId>
another does
<timeToPerform>3600</timeToPerform>
<timeToReceipt/>
next does
<SendToBES>true</SendToBES>
<BESQueueName>com.abc.gateway.JMSQueue.forAddRequest</BESQueueName>
<BESTransform/>
<BESJMSProperties>
<property>
<propName>stateCode</propName>
<propValue>OK</propValue>
</property>
<property>
<propName>stateResponse</propName>
<propValue>OK</propValue>
</property>
</BESJMSProperties>
and so on