Examples of IUnmarshallingContext


Examples of org.jibx.runtime.IUnmarshallingContext

            //  which case you need to use the getFactory() call that takes the
            //  binding name as the first parameter
            IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);
           
            // unmarshal customer information from file
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
            FileInputStream in = new FileInputStream(args[0]);
            Customer customer = (Customer)uctx.unmarshalDocument(in, null);
           
            // you can add code here to alter the unmarshalled customer
           
      // marshal object back out to file (with nice indentation, as UTF-8)
      IMarshallingContext mctx = bfact.createMarshallingContext();
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

        // load or create customization information
        m_global = new GlobalCustom(loc);
        m_global.setNamespaceStyle(new Integer(CustomBase.DERIVE_FIXED));
        if (path != null) {
            IBindingFactory fact = BindingDirectory.getFactory("class-customs-binding", GlobalCustom.class);
            IUnmarshallingContext ictx = fact.createUnmarshallingContext();
            FileInputStream is = new FileInputStream(path);
            ictx.setDocument(is, null);
            ictx.setUserContext(vctx);
            ((IUnmarshallable)m_global).unmarshal(ictx);
        }
        setLocator(loc);
    }
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

     */
    protected SchemaElement readSchema(ValidationContext vctx,
        ISchemaResolver resolver) throws JiBXException, IOException {
        IBindingFactory factory = BindingDirectory.getFactory
            (SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class);
        IUnmarshallingContext uctx = factory.createUnmarshallingContext();
        uctx.setDocument(resolver.getContent(), resolver.getId(), null);
        uctx.setUserContext(vctx);
        SchemaElement schema = new SchemaElement();
        ((IUnmarshallable)schema).unmarshal(uctx);
        return schema;
    }
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

     * @return root element
     * @throws Exception
     */
    protected GlobalCustom readCustom(InputStream is)
        throws Exception {
        IUnmarshallingContext ictx =
            m_bindingFactory.createUnmarshallingContext();
        ValidationContext vctx = new ValidationContext();
        ictx.setDocument(is, null);
        ictx.setUserContext(vctx);
        GlobalCustom global = (GlobalCustom)ictx.unmarshalElement();
        List problems = vctx.getProblems();
        if (problems.size() > 0) {
            StringBuffer buff = new StringBuffer();
            for (int i = 0; i < problems.size(); i++) {
                ValidationProblem prob = (ValidationProblem)problems.get(i);
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

        // load or create customization information
        setLocator(loc);
        m_global = new GlobalCustom(loc);
        if (path != null) {
            IBindingFactory fact = BindingDirectory.getFactory("class_customs_binding", GlobalCustom.class);
            IUnmarshallingContext ictx = fact.createUnmarshallingContext();
            FileInputStream is = new FileInputStream(path);
            ictx.setDocument(is, null);
            ictx.setUserContext(vctx);
            ((IUnmarshallable)m_global).unmarshal(ictx);
        }
    }
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

            File file = files[i];
            if (!file.isDirectory()) {
                try {
                   
                    // unmarshal document into object
                    IUnmarshallingContext uctx = factory.createUnmarshallingContext();
                    uctx.setDocument(new FileInputStream(file), null);
                    Object object = uctx.unmarshalElement();
                    String encoding = ((UnmarshallingContext)uctx).getInputEncoding();
                   
                    // marshal object back out to document in memory
                    IMarshallingContext mctx = factory.createMarshallingContext();
                    mctx.setIndent(2);
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

    public Object readObject(MessageReader reader, MessageContext context)
        throws XFireFault
    {
        try
        {
            IUnmarshallingContext mctx = bfact.createUnmarshallingContext();
            ElementReader r = (ElementReader) reader;
            FragmentStreamReader fsr = new FragmentStreamReader(r.getXMLStreamReader());
            fsr.next();
            StAXReaderWrapper wrapper = new StAXReaderWrapper(
                    fsr,
                    getSchemaType().getLocalPart(),
                    true);

            UnmarshallingContext ctx = (UnmarshallingContext) mctx;
            ctx.setDocument(wrapper);
            Object obj = mctx.unmarshalElement();
            return obj;
        }
        catch (JiBXException e)
        {
            throw new XFireRuntimeException("Could not read Jibx type.", e);
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

          if (sColName.equalsIgnoreCase(DB.tx_journal)) {
        try {
        Reader oRdr = oRSet.getCharacterStream(c);
              if (!oRSet.wasNull()) {
            IBindingFactory bfact = BindingDirectory.getFactory(NewsGroupJournal.class);
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
                oJournal = (NewsGroupJournal) uctx.unmarshalDocument (oRdr);
            oRdr.close();
                put(DB.tx_journal, oRSet.getString(c));
          } else {
              oJournal = null;
              } // fi
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

    }

    if (sEnc==null) sEnc="UTF-8";

    IBindingFactory bfact = BindingDirectory.getFactory(Menu.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

    final int BUFFER_SIZE = 28000;
    FileInputStream oFileStream = new FileInputStream(sXMLDocPath);
    BufferedInputStream oXMLStream = new BufferedInputStream(oFileStream, BUFFER_SIZE);

    Object obj = uctx.unmarshalDocument (oXMLStream, sEnc);

    oXMLStream.close();
    oFileStream.close();

    if (DebugFile.trace) {
View Full Code Here

Examples of org.jibx.runtime.IUnmarshallingContext

    String sResponse = readfilestr(sUrl,"UTF-8");

  StringBufferInputStream oResponse = new StringBufferInputStream(sResponse);

    IBindingFactory bfact = BindingDirectory.getFactory(CalendarResponse.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

    oCalRsp = (CalendarResponse) uctx.unmarshalDocument (oResponse, "UTF-8");

  return oCalRsp;
  } // get
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.