FileDocCategorySizeDatePackage
XmlBeanDeserializer.javaAPI DocApache Axis 1.42567Sat Apr 22 18:57:28 BST 2006org.apache.axis.encoding.ser.xbeans

XmlBeanDeserializer

public class XmlBeanDeserializer extends org.apache.axis.encoding.DeserializerImpl
Class XmlBeanDeserializer
author
Jonathan Colwell

Fields Summary
private Class
mJavaType
Constructors Summary
public XmlBeanDeserializer(Class javaType, QName xmlType)

        mJavaType = javaType;
    
Methods Summary
public voidonStartElement(java.lang.String namespace, java.lang.String localName, java.lang.String prefix, org.xml.sax.Attributes attributes, org.apache.axis.encoding.DeserializationContext context)

        try {
            MessageElement me = context.getCurElement();
            XmlOptions opts = new XmlOptions()
                    .setLoadReplaceDocumentElement(null);
            XmlObject xObj = XmlObject.Factory.parse(me, opts);
            SchemaType jt = (SchemaType) mJavaType.getField("type").get(null);
            XmlObject converted = xObj.changeType(jt);
            if (converted != null) {
                setValue(converted);
            } else {
                XmlObject[] children = xObj.selectChildren(QNameSet.ALL);
                for (int j = 0; j < children.length; j++) {
                    converted = xObj.changeType(jt);
                    if (converted != null) {
                        setValue(converted);
                        break;
                    }
                }
            }
        } catch (Exception xe) {
            throw new SAXException(xe);
        }