[Simple-support] Supporting different root elements
Brought to you by:
niallg
|
From: Jarrod S. <ja...@co...> - 2011-11-02 01:37:58
|
I have to parse server responses that where the body of the document is the
same, but the document root node can change depending on whether the
request resulted in errors:
e.g. Success response:
*<OK>*
<ELEM1>Data</ELEM1>
<ELEM2>Data</ELEM2>
...
*</OK>*
Error response:
*<FAIL>*
<ELEM1>Error information for ELEM1</ELEM1>
<ELEM2>Error information for ELEM2</ELEM2>
...
*</FAIL>*
*
*
How can I support this using Simple? I don't want to have to sniff the
input stream and switch classes based on whether I find an <OK> or <FAIL>
element. I just want to do the same persister.read(MyDocClass) with the
same MyDocClass in both cases.
* *
Thanks for an awesome XML lib, it rocks.
|