Package org.apache.xmlbeans.unmarshal

Examples of org.apache.xmlbeans.unmarshal.MessagePlan


public class Unmarshal
{
    public static void main(String args[]) throws Exception
    {
        MessagePlan messagePlan = new MessagePlan(2);

        SimpleTypePlan param1Plan = new SimpleTypePlan(SimpleTypePlan.JAVA_FLOAT, true, SchemaType.BTC_DOUBLE, null, 0);

        StructurePlan param2Plan = new StructurePlan();

        param2Plan.setTargetClass(com.bea.test.TestStructure.class);
        param2Plan.setInfoForElement(new QName("varInt"), new StructurePlan.FieldInfo("varInt", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_INT, true, SchemaType.BTC_INTEGER, null, 0)));
        param2Plan.setInfoForElement(new QName("varFloat"), new StructurePlan.FieldInfo("varFloat", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_FLOAT, true, SchemaType.BTC_FLOAT, null, 0)));
        param2Plan.setInfoForElement(new QName("varString"), new StructurePlan.FieldInfo("varString", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_STRING, false, SchemaType.BTC_STRING, null, 0)));

        messagePlan.setInfoForElement(new QName("LastTradePrice"), new MessagePlan.ParamInfo(0, MessagePlan.ParamInfo.SINGLETON, param1Plan));
        messagePlan.setInfoForElement(new QName("inputStruct"), new MessagePlan.ParamInfo(1, MessagePlan.ParamInfo.SINGLETON, param2Plan));

        XmlObject xobj = XmlObject.Factory.parse(new File(args[0]));
        XMLInputStream xinput = xobj.newXMLInputStream();
        while (xinput.hasNext())
        {
            if (xinput.peek().isStartElement())
                break;
            xinput.skip();
        }

        UnmarshalContext context = new UnmarshalContext();
        Object[] result = (Object[])messagePlan.unmarshal(xinput, context);
        context.complete();

        for (int i = 0; i < result.length; i++)
        {
            System.out.println("Result " + i + " = " + result[i]);
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.unmarshal.MessagePlan

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.