|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
How to represent nodes that have same element name, but different structureI've looked through the Tutorials and found no obvious answer to this. I use an SMS provider which has a RESTful API for sending text and voice SMS messages. The XML posted differs as follows, depending on the type of SMS you want to send: An example voice send would look something like: <?xml version='1.0' encoding='UTF-8'?> <message> <to>0123456789</to> <type>Voice</type> <body> <lang>en-GB</lang> <text>This is a Voice message</text> </body> </message> An example SMS send would look something like: <?xml version='1.0' encoding='UTF-8'?> <message> <to>0123456789</to> <type>SMS</type> <body> This is a SMS message </body> </message> How could this be represented in a single Java class, given the <body> element differs depending on the type? Whilst I could see how you could put this into two classes and get the serialised result (XML) you wanted, how would you know how to deserialise it out of the XML without knowing in advance which type of message you were dealing with? I'm new to this, so please forgive me if there is an obvious answer in the online documentation!
Regards,
Andy Barlow The information in this email or facsimile is confidential and is intended solely for the addressee(s) and access to this email or facsimile by anyone else is unauthorised. If you are not the intended recipient then any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Information expressed in this email or facsimile is not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independent of this message.
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|||||||||||||||||||||||||
|
|
Re: How to represent nodes that have same element name, but different structure
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
| Free embeddable forum powered by Nabble | Forum Help |