Package org.exolab.castor.xml

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


     
    Marshaller marshaller = new Marshaller(super.contentHandler);

    try
    {
      marshaller.marshal(throwable);
    }
    catch (MarshalException me)
    {
      throw new ProcessingException(me);
    }
View Full Code Here


  public void storeObject(OutputStream stream, Map parameters, Object object) throws ConverterException {
        Writer writer = new OutputStreamWriter(stream);
    try {
      Marshaller marshaller = new Marshaller( writer );
      marshaller.setMapping((Mapping)this.mappings.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

  public static final void writeXML(Object _response, HttpServletResponse _httpResponse) throws MarshalException, ValidationException, IOException, MappingException {
    _httpResponse.addHeader("Content-Type", "application/xml");
    StringWriter writer = new StringWriter();
    Marshaller marshaller = new Marshaller(writer);
    marshaller.setMapping(MAPPING);
    marshaller.marshal(_response);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Writing XML [" + writer.toString() + "]");
    }
    _httpResponse.getWriter().write(writer.toString());
  }
View Full Code Here

          }
                });
            marshaller.setResolver((XMLClassDescriptorResolver) classDescriptorResolver);
           
            marshaller.setValidation(false); // results in better performance
            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
View Full Code Here

    public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
        Writer writer = new OutputStreamWriter(outputStream, encoding);

        Marshaller marshaller = createMarshaller(exchange);
        marshaller.setWriter(writer);
        marshaller.marshal(body);
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        Reader reader = new InputStreamReader(inputStream, encoding);
        return createUnmarshaller(exchange).unmarshal(reader);
View Full Code Here

          }
                });
            marshaller.setResolver((XMLClassDescriptorResolver) classDescriptorResolver);
           
            marshaller.setValidation(false); // results in better performance
            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
View Full Code Here

            XMLSerializer serializer = new XMLSerializer(writer, of);
            try {
            Marshaller marshaller =
                new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(mappingWebXml);
            marshaller.marshal(webApp);
            } catch (Exception e) {
                writer.close();
                e.printStackTrace(System.out);
                throw new Exception();
            }
View Full Code Here

       
        Marshaller marshaller = new Marshaller(writer);
       
        marshaller.setMapping(this.mapping);
       
        marshaller.marshal(registry);
    }

    private void load() throws Exception
    {
        String filename = CONFIG_FILE;
View Full Code Here

          }
                });
            marshaller.setResolver((XMLClassDescriptorResolver) classDescriptorResolver);
           
            marshaller.setValidation(false); // results in better performance
            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + absolutePath, e);
            throw new FailedToUpdateDocumentException(e);
View Full Code Here

      mapping.loadMapping(mappingUrl);
      FileWriter writer = new FileWriter(outputFile);
      Marshaller marshaller = new Marshaller(writer);
      marshaller.setEncoding(ConsoleCst.MAPPING_ENCODING);
      marshaller.setMapping(mapping);
      marshaller.marshal(obj);
    } catch (Throwable th) {
      throw new MappingException("Marshall exception occured: "+th);
    }
  }
 
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.