Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Marshaller.marshal()


        Writer writer = new OutputStreamWriter(stream);
    try {
      Marshaller marshaller = new Marshaller( writer );
      Mapping mapping = new Mapping();
      marshaller.setMapping((Mapping)this.mappings.get(parameters.get(parameters.get("profiletype"))));
      marshaller.marshal(object);
      writer.close();
    } catch (MappingException e) {
      throw new ConverterException("can't create Unmarshaller", e);
    } catch (Exception e) {
      throw new ConverterException(e.getMessage(), e);
View Full Code Here


      StringWriter stringWriter = new StringWriter();

      Marshaller marshaller = new Marshaller(stringWriter);
      marshaller.setMapping(mapping);
      marshaller.setEncoding("ISO-8859-15");
      marshaller.marshal(object);
      stringWriter.close();

      return stringWriter.getBuffer().toString();
    }
    catch (CastorException e)
View Full Code Here

    FileUtils.forceMkdir(directory);
    fileOut.createNewFile();
    FileWriter writer = new FileWriter(fileOut);

    Marshaller marshaller = new Marshaller(writer);
    marshaller.marshal(request);
  }

  /*
    public void testReadXML()
    {
View Full Code Here

            //2 DOCTYPE defined in the document. The XML fragment is included in
            //an XML document containing already a DOCTYPE
            marshaller.setMarshalAsDocument(false);

            // Marshall the Castor object into the stream (sink)
            marshaller.marshal(value);

            context.writeString(writer.toString());
        } catch (MarshalException me) {
            log.error(Messages.getMessage("castorMarshalException00"), me);
            throw new IOException(Messages.getMessage("castorMarshalException00")
View Full Code Here

            // write back the history to file
            try{
                FileWriter writer = new FileWriter("queryhistory.xml");
                Marshaller marshaller = new Marshaller(writer);
                marshaller.setMapping(mapping);
                marshaller.marshal(qhistory);
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

            while ( enumeration.hasMoreElements() )
                mapping.addClassMapping( (ClassMapping) enumeration.nextElement() );
            marshal = new Marshaller( writer );
            marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
            marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
            marshal.marshal( mapping );
        } catch ( Exception except ) {
            throw new MappingException( except );
        }
    } //-- write
View Full Code Here

    // Fixed in v1.2. We are using castor-xml-1.3
    DateFieldHandler.setDefaultTimeZone(UTC);

    try {
      Marshaller m = new Marshaller(new BufferedWriter(out));
      m.marshal(gpx);
    } catch (Exception ex) {
      IOException ioex = new IOException("Error writing GPX.");
      ioex.initCause(ex);
      throw ioex;
    } finally {
View Full Code Here

            if (arrayDims != -1) {
                localPart = localPart.substring(0, arrayDims);
            }
            marshaller.setRootElement(localPart);
            // Marshall the Castor object into the stream (sink)
            marshaller.marshal(value);
        } catch (MarshalException me) {
            log.error(Messages.getMessage("castorMarshalException00"), me);
            throw new IOException(Messages.getMessage(
                    "castorMarshalException00")
                    + me.getLocalizedMessage());
View Full Code Here

            marshaller.setMapping(this.mapping);

            registry.preStore(null);

            marshaller.marshal(registry);

            registry.postStore(null);
        }
        catch (org.exolab.castor.mapping.MappingException e)
        {
View Full Code Here

        Marshaller marshaller = new Marshaller(writer);

        marshaller.setMapping(this.mapping);

        marshaller.marshal(apps);
    }

    public PortletApplicationEntityListImpl load() throws Exception
    {
      final String METHOD_NAME = "load()";
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.