Actually, I still am a bit confused but let me tell you a couple of
things to see if they are of any help:
 
- if the root element of your document is "known" by XmlBeans, the the
returned XmlObject is of the correct instance class, you don't need to
do anything else: xobj.getClass() should return
MyKnownDocumentImpl.class
- you can find out which document SchemaType it is by doing
"xobj.schemaType()"
 
Beyond this, in Java in general, if you want to write a cast like
"(MyKnownDocument) xobj" then you must of course know at the time you
write your code about MyKnownDocument...
 
Radu

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 22, 2007 2:10 PM
To: [email protected]
Subject: XmlBeans processing - brick wall


I will rephrase my earlier question as it may have been a bit much:
 
 
I have seen this...
 
 XmlObject xobj = XmlObject.Factory.parse(myDocument);

 if (xobj instanceof MyKnownDocument )  {

     MyKnownDocument mydoc = (MyKnownDocument )xobj;
    
 if (!xobj.validate())
         System.out.println("Not a valid my-order document");
}
 
...which is fine if you have knowledge of MyKnownDocument to begin with.
If you do not know it, is it possible to extract the document type
associated with myDocument/xobj, and then cast xobj to that? The
myDocument is an instance of 
_some_ kind of Document, I just need to find out _which_ Document, then
cast it similar to the above so I can then pass xobj along for further
processing.
 
Are there examples of this?
 
Thanks,
 
AJ

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

Reply via email to