Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Marshaller


                new FileWriter(webAppsDir + webModule +
                                               System.getProperty("file.separator") + "WEB-INF"+
                                               System.getProperty("file.separator") + "web.xml");
            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


    return 0;
  }

  public void toSAX(ContentHandler handler, boolean withConstraints) throws SAXException {
    try {
      Marshaller marshaller = new Marshaller(new DocumentHandlerAdapter(handler));
      if (mapping != null) {
        marshaller.setMapping(mapping);
      }
      marshaller.marshal(bean);
    }
    catch (ValidationException e) {
      throw new SAXException(e);
    }
    catch (MappingException e) {
View Full Code Here

        OutputStreamWriter writer =
            new OutputStreamWriter(out);

        try {
            Marshaller marshaller =
                new Marshaller(new DefaultHandler()); //serializer.asDocumentHandler());
            marshaller.setMapping(getCastorMapping());
            marshaller.marshal(object);
        } catch(IOException io) {
            throw io;
        } catch (Exception e) {
            throw new IOException(e.getMessage());
        }
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(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

    return result;
  }
 
  private String marhsall(TxnRequest order) throws IOException, MarshalException, ValidationException {
    StringWriter writer = new StringWriter();
      Marshaller marshaller = xmlContext.createMarshaller();
      marshaller.setNamespaceMapping("","ns1");
      marshaller.setWriter(writer);
      marshaller.marshal(order);
      return writer.toString();
  }
View Full Code Here

    return result;
  }
 
  private String marhsall(Order order) throws IOException, MarshalException, ValidationException {
    StringWriter writer = new StringWriter();
      Marshaller marshaller = xmlContext.createMarshaller();
      marshaller.setNamespaceMapping("","ns1");
      marshaller.setWriter(writer);
      marshaller.marshal(order);
      return writer.toString();
  }
View Full Code Here

            // workaround:
            // temporarily set Default TZ to UTC
            // //TimeZone tz = TimeZone.getDefault();
            // //TimeZone.setDefault(UTC);
            try {
                Marshaller marshaller = new Marshaller();
                marshaller.setWriter(new OutputStreamWriter(bout, "UTF-8"));
                marshaller.marshal(gpx);
            } catch (Exception ex) {
                IOException ioex = new IOException("Error writing GPX.");
                ioex.initCause(ex);
                throw ioex;
            } finally {
View Full Code Here

    return null;
  }

  public String toExport(ItemSimple itemSimple) throws Exception {
    StringWriter writer = new StringWriter();
      Marshaller marshaller = xmlContext.createMarshaller();
      marshaller.setWriter(writer);
      if (!isValid(itemSimple.getItemSellable())) {
        itemSimple.setItemSellable(Constants.VALUE_NO);
      }
      if (!isValid(itemSimple.getPublished())) {
        itemSimple.setPublished(Constants.VALUE_NO);
      }
    for (ItemSimple i : itemSimple.getItemsUpSell()) {
      i.setItemSellable(' ');
      i.setPublished(' ');
    }
    marshaller.marshal(itemSimple);
    return writer.toString().replaceFirst("\n", "") + System.getProperty("line.separator");
  }
View Full Code Here

   
    XMLContext context = new XMLContext();
    context.addMapping(mapping);
   
    StringWriter writer = new StringWriter();
      Marshaller marshaller = context.createMarshaller();
      marshaller.setWriter(writer);
      marshaller.marshal(urlSet);
      result = writer.toString();
     
      return result;
  }
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(ProfileLS.PARAMETER_PROFILETYPE)));
            boolean suppressXSIType = this.defaultSuppressXSIType;
            Boolean value = (Boolean)parameters.get("suppressXSIType");
            if (value != null) {
                suppressXSIType = value.booleanValue();
            }
            marshaller.setSuppressXSIType(suppressXSIType);
      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

TOP

Related Classes of org.exolab.castor.xml.Marshaller

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.