Peter-Paul,
You can use XmlObject.Factory.parse() if you don't know the type of the message 
beforehand. The runtime type of the resulting object will be that of the class 
associated with the document, as determined by looking at the root element (as 
long as the appropriate scomp-generated jar is on the classpath).
You can then use instanceof to check what the returned class was or get back 
the SchemaType using XmlObject.schemaType() (which you can then check using 
'==' against some known types).

Radu

-----Original Message-----
From: Peter-Paul Rang [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 30, 2005 12:13 AM
To: user@xmlbeans.apache.org
Subject: How to parse the XML file with the correct 'document' class?


Hi All,

Perhaps anyone can help me with the following.

I have several XML messages definitions to process. To parse the file 
with XMLBeans I have to know what message it is beforehand.

Example:
Here I know that it's a MCCIMT000100HT02MessageDocument, so I use that 
class to parse the inputFile.
    MCCIMT000100HT02MessageDocument document = 
MCCIMT000100HT02MessageDocument.Factory.parse(inputFile);

But what Class should I use when I don't know yet the XML message 
definition of the inputFile?
Can XMLBeans decide for me what Class to use?
How can I check what type the inputFile is and what class to use to 
parse it with?

Thanks for any hints, tips or suggestions.

Peter-Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to