Does your document actually validate -- I strongly suspect not? I suspect that the XML that you're parsing is probably not compliant with the schema you have. (usually this comes down to a namespace issue, but I can't tell without seeing the whole schema).
You should make sure that the validate method returns true, and in fact, you might want to look at the validate method that takes an XmlOptions parameter so you can pass an error listener and see the exact problem. -----Original Message----- From: Kuketayev, Argyn (Contractor) [mailto:[EMAIL PROTECTED] Sent: Friday, September 23, 2005 7:32 AM To: user@xmlbeans.apache.org Subject: XmlObject.Factory.parse(...) return XmlAnyTypeImpl contrary to what javadoc states Hello I was reading Javadoc for XmlObject, it says this: =========== Type inference. When using XmlObject.Factory to parse XML documents, the actual document type is not type itself, but a subtype based on the contents of the parsed document. If the parsed document contains a recognized root document element, then the actual type of the loaded instance will be the matching Document type. For example: XmlObject xobj = XmlObject.Factory.parse(myDocument); if (xobj instanceof MyOrderDocument) // starts w/ <my-order> { MyOrderDocument mydoc = (MyOrderDocument)xobj; if (!xobj.validate()) System.out.println("Not a valid my-order document"); } else { System.out.println("Not a my-order document"); } =========== When I run this code against my XMLs, then it xobj's type is XmlAnyTypeImpl. I can have one of the two root elemets Policy and PolicySet. I expected that xobj would be either PolicyDocument or PolicySetDocument, as it's stated in Javadoc. Can someone help me with this? Thanks, Argyn --------------------------------------------------------------------- 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]