Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext.createMarshaller()


        if (parentTypeConverter != null) {
            // lets convert the object to a JAXB source and try convert that to
            // the required source
            JAXBContext context = createContext(value.getClass());
            // must create a new instance of marshaller as its not thread safe
            Marshaller marshaller = context.createMarshaller();
            Writer buffer = new StringWriter();
            boolean prettyPrint = isPrettyPrint();
            // check the camel context property to decide the value of PrettyPrint
            if (exchange != null) {
                String property = exchange.getContext().getProperty(PRETTY_PRINT);
View Full Code Here


        return (Book)u.unmarshal(is);
    }
   
    private String writeBook(Book b) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Marshaller m = c.createMarshaller();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        m.marshal(b, bos);
        return bos.toString();
    }
   
View Full Code Here

        producer.close();
    }
   
    private String writeBook(Book b) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Marshaller m = c.createMarshaller();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        m.marshal(b, bos);
        return bos.toString();
    }
}
View Full Code Here

      throws Exception {

    StringWriter writer = new StringWriter();
    JAXBContext context =
        JAXBContext.newInstance(ApplicationSubmissionContextInfo.class);
    Marshaller m = context.createMarshaller();
    m.marshal(appInfo, writer);
    return writer.toString();
  }

  static void setupConn(HttpURLConnection conn, String method,
View Full Code Here

     * @return A marhsaller for JAXB-annotated classes
     */
    public static Marshaller getMarshaller(ScannedClassLoader classLoader) {
        try {
            JAXBContext context = getContext(classLoader);
            Marshaller m = context.createMarshaller();
            m.setProperty("jaxb.formatted.output", true);
            return m;

        } catch (JAXBException ex) {
            logger.log(Level.SEVERE, null, ex);
View Full Code Here

    String cat7Clan = "Clan Wars Campaigns Achievements (medals)";
   
    ObjectFactory objFactory = null;
    try {
      JAXBContext context = JAXBContext.newInstance(XmlWiki.class);
      Marshaller m = context.createMarshaller();
      m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
      objFactory = new ObjectFactory();
     
      //création WIKI
      XmlWiki wiki = objFactory.createXmlWiki();
View Full Code Here

     */
    public <T> String marshalDocument(T value, String schema) {
        try {
            JAXBContext context = this.getJaxbContext(value.getClass());

            Marshaller marshaller = context.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            marshaller.setProperty(Marshaller.JAXB_FRAGMENT, false);

            if (schema != null) {
                marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schema);
View Full Code Here


    private String toString(EntityMappings entityMappings) throws JAXBException {
        JAXBContext entityMappingsContext = JAXBContextFactory.newInstance(EntityMappings.class);

        Marshaller marshaller = entityMappingsContext.createMarshaller();
        marshaller.setProperty("jaxb.formatted.output", true);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(entityMappings, baos);
View Full Code Here


    private String toString(EntityMappings entityMappings) throws JAXBException {
        JAXBContext entityMappingsContext = JAXBContextFactory.newInstance(EntityMappings.class);

        Marshaller marshaller = entityMappingsContext.createMarshaller();
        marshaller.setProperty("jaxb.formatted.output", true);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(entityMappings, baos);
View Full Code Here

        return new String(baos.toByteArray());
    }

    public static <T> void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException {
        JAXBContext jaxbContext = getContext(type);
        Marshaller marshaller = jaxbContext.createMarshaller();

        marshaller.setProperty("jaxb.formatted.output", true);

        marshaller.marshal(object, out);
    }
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.