You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Kuketayev, Argyn (Contractor)" <ar...@fanniemae.com> on 2005/09/23 16:31:38 UTC
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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org