Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Marshaller


        if (portlets != null)
        {
            format.setEncoding(encoding);
            Serializer serializer = new XMLSerializer(writer, format);
            Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(this.mapping);
            marshaller.marshal(portlets);
        }
    }
View Full Code Here


            // create the serializer output format
            OutputFormat format = new OutputFormat();
            format.setIndenting(true);
            format.setIndent(4);
            Serializer serializer = new XMLSerializer(writer,format);
            Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(this.loadMapping());
            marshaller.marshal(doc.getPortlets());

            success = true;
        }
        catch (MarshalException e)
        {
View Full Code Here

            // create the serializer output format
            OutputFormat format = new OutputFormat();
            format.setIndenting(true);
            format.setIndent(4);
            Serializer serializer = new XMLSerializer(writer,format);
            Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(this.loadMapping());
            marshaller.marshal(doc.getPortlets());

            success = true;
        }
        catch (MarshalException e)
        {
View Full Code Here

            // create the serializer output format
            OutputFormat format = new OutputFormat();
            format.setIndenting(true);
            format.setIndent(4);
            Serializer serializer = new XMLSerializer(writer,format);
            Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(this.loadMapping());
            marshaller.marshal(doc.getPortlets());

            success = true;
        }
        catch (MarshalException e)
        {
View Full Code Here

  }

  @Override
  protected final void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
      throws XmlMappingException {
    Marshaller marshaller = xmlContext.createMarshaller();
    marshaller.setContentHandler(contentHandler);
    marshal(graph, marshaller);
  }
View Full Code Here

    marshalWriter(graph, new OutputStreamWriter(outputStream, encoding));
  }

  @Override
  protected final void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
    Marshaller marshaller = xmlContext.createMarshaller();
    marshaller.setWriter(writer);
    marshal(graph, marshaller);
  }
View Full Code Here

  @Override
  public void saveData(final GWESM gwesm, final String name)
      throws DAOException {
    try {
      Marshaller marshaller = this.context.createMarshaller();
      marshaller.setValidation(false);
      marshaller.setProperty("org.exolab.castor.indent", "true");
      marshaller.setWriter(new FileWriter(name));
      marshaller.marshal(gwesm);
    } catch (Exception e) {
      throw new DAOException("Error saving data", e);
    }

  }
View Full Code Here

        }

        // writer response
        StringWriter writer = new StringWriter();
//        PrintWriter writer = response.getWriter();
        Marshaller marshaller = new Marshaller(writer);
        try {
            marshaller.marshal(flexResponse);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        writer.close();
        String responseStr = writer.getBuffer().toString();
View Full Code Here

            // handler, you can't set call marshaller.setDocType(String, String)

            // See Also:
            //  https://issues.apache.org/jira/browse/PLUTO-312
            //  http://castor.org/javadoc/org/exolab/castor/xml/Marshaller.html#setDoctype(java.lang.String,%20java.lang.String)
            Marshaller marshaller = new Marshaller(writer);
            marshaller.setMapping(getCastorMapping());
           
            // Use JAXP if we are instructed to do so.
            LocalConfiguration castorConfig = LocalConfiguration.getInstance();
            if (USING_JAXP) {               
                // empty string means "use JAXP" for Castor
                castorConfig.getProperties().setProperty("org.exolab.castor.parser", "" );               
                castorConfig.getProperties().setProperty("org.exolab.castor.xml.serializer.factory",
                        "org.exolab.castor.xml.XercesJDK5XMLSerializerFactory" );
            }
           
            if (LOG.isDebugEnabled()) {
                LOG.debug("Pluto descriptor service implementation using JAXP: [" + USING_JAXP + "]");                       
            }
           
            castorConfig.getProperties().setProperty("org.exolab.castor.indent", "true");
            setCastorMarshallerOptions(marshaller, object);
            marshaller.marshal(object);
        } catch (IOException e) {
            LOG.error(e.getMessage(), e);
            throw e;
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
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

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.