Hi All,

I am using castor source generator to parse xml files. I used different xsd's to generate the source. When I need to parse an xml file I need to know which castor generated source to try and unmarshall the xml file to. It would be very inefficient to iterate through all types.

For example, I have 2 xml documents that I need to unmarshall which have the following castor generated source :

1) MgmtTree
2) WapProvisioningDoc

The xml documents are passed to my code via a file upload and I don't know xml document type is being passed to me.

At the moment I am attaempting to unmarshall the document to a WapProvisioningDoc and if this fails I catch the validation or marshalling exception I then attempt to unmarshall it to a MgmtTree object.

Can anyone please suggest a better approach than this?

For example, within the xml file there is a doctype which I can use to distinguish which type to marshall it to. Is it possible to marshall the xml file to a generic object to determine which doc type was used? I would then marshall the xml file to the correct castor generated source object.

Thanks in advance,

Colin Foy

--
***************************************************************
* Colin Foy                 * Email: [EMAIL PROTECTED]     *
* Software Engineer         * WWW  : www.aepona.com           *
* Aepona Ltd.,              * Phone: +44 (0)28 90 275230      *
* Interpoint Building,      * Fax  : +44 (0)28 90 269111      *
* 20-24 York Street,        *                                 *
* Belfast. BT15 1AQ         *                                 *
* N. Ireland                *                                 *
***************************************************************



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user

Reply via email to