[Simple-support] Using simple with generic intermediate XML elements
Brought to you by:
niallg
|
From: Jacob A. <ja...@av...> - 2011-11-03 10:53:49
|
Hi there, I need to connect to a backend with XML and decided to try out Simple for these purposes. Only, I've run into a problem. The problem is that the backend (XML autogenerated by .NET) defines a generic element "Table1", which includes an application key and is present in all calls to the server. For instance, take a look at these different documents: <AddUserLocation> <table1> <type>false</type> <city>Birkerød</city> <countrycode>DK</countrycode> <ticketcode>xxxxxxxxx</ticketcode> <longtitude>15.443104</longtitude> <latitude>35.839486</latitude> <ticketid>130</ticketid> <appkey>xxxxxxxx</appkey> </table1> </AddUserLocation> <GetAverageLocationsByAreal> <table1> <sorttype>5</sorttype> <type>34</type> <ticketcode>xxxxxxxxx</ticketcode> <longtitude>15.443107</longtitude> <latitude>35.839470</latitude> <ticketid>130</ticketid> <filter/> <count>20</count> <start>0</start> <appkey>xxxxxxxx</appkey> </table1> </GetAverageLocationsByAreal> * * Notice that while the root and leaf elements differ, the "table1"-element is present in both documents, and it always has the "appkey" element as a child. How can I model this in Simple? If I create a class called "Table1" and extend from it, the XML element "table1" will have a "class" attribute added to it (makes good sense, too, for the de-serialization), which I cannot get past the schema (and which will not be sent back to me in the response, where the problem will arise again). I've tried messing around with Element Unions, but that doesn't seem to fix the problem either, though I may have missed something. Best of all, Jacob Avlund |