Examples of createMarshaller()


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

         Customer cust = new Customer("bill");

         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         StringWriter writer = new StringWriter();
         ctx.createMarshaller().marshal(cust, writer);
         entry.setContent(writer.toString(), "application/xml");
         return feed;

      }
View Full Code Here

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

         Customer cust = new Customer("bill");

         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         StringWriter writer = new StringWriter();
         ctx.createMarshaller().marshal(cust, writer);
         entry.setContent(writer.toString(), "application/xml");
         return entry;

      }
View Full Code Here

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

      JAXBContext ctx = JAXBContext.newInstance(RealFoo.class);
      StringWriter writer = new StringWriter();
      RealFoo foo = new RealFoo();
      foo.setName("bill");

      ctx.createMarshaller().marshal(foo, writer);

      String s = writer.getBuffer().toString();
      System.out.println(s);

      PostMethod method = new PostMethod(url);
View Full Code Here

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

      JAXBElement<JaxbMap> element = new JAXBElement<JaxbMap>(new QName("http://jboss.org/resteasy", "map", "resteasy"), JaxbMap.class, map);


      StringWriter writer = new StringWriter();
      ctx.createMarshaller().marshal(element, writer);
      String s = writer.toString();
      System.out.println(s);

      ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
      StreamSource source = new StreamSource(is);
View Full Code Here

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

    return obj;
  }
   
  public static void outputEntity(Object obj, String thePackage) throws JAXBException {
    JAXBContext jc = JAXBContext.newInstance(thePackage);
    Marshaller marshaller = jc.createMarshaller();
    marshaller.marshal( new JAXBElement<Object>(new javax.xml.namespace.QName("uri","local"), Object.class, obj), System.out);
   
  }
 
}
View Full Code Here

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

  public static String marshallToString(Object object, String thePackage) throws JAXBException {
    String rawObject = null;

    JAXBContext jc = JAXBContexts.get(thePackage);
    Marshaller marshaller = jc.createMarshaller();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    marshaller.marshal(object, baos);
    rawObject = baos.toString();
   
    return rawObject;
View Full Code Here

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

  }

  public static Element marshallToElement(Object object, String thePackage, Element element) throws JAXBException {
   
    JAXBContext jc = JAXBContexts.get(thePackage);
    Marshaller marshaller = jc.createMarshaller();
    marshaller.marshal(object, element)
    return element;
  }
 
  @SuppressWarnings("unchecked")
View Full Code Here

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

      juddiUsers.getUser().add(new User("bozo","clown"));
      juddiUsers.getUser().add(new User("sviens","password"));
     
      StringWriter writer = new StringWriter();
      JAXBContext context = JAXBContext.newInstance(juddiUsers.getClass());
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      marshaller.marshal(juddiUsers, writer);
      logger.info("\n" +  writer.toString());
    } catch (Exception e) {
      logger.error(e.getMessage(),e);
View Full Code Here

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

      juddiUsers.getUser().add(new User("bozo",cryptor.encrypt("clown")));
      juddiUsers.getUser().add(new User("sviens",cryptor.encrypt("password")));
     
      StringWriter writer = new StringWriter();
      JAXBContext context = JAXBContext.newInstance(juddiUsers.getClass());
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      marshaller.marshal(juddiUsers, writer);
      logger.info("\n" +  writer.toString());
    } catch (Exception e) {
      logger.error(e.getMessage(),e);
View Full Code Here

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

   private String createCustomerData(String name) throws JAXBException
   {
      JAXBContext context = JAXBContext.newInstance(Customer.class);
      StringWriter writer = new StringWriter();
      context.createMarshaller().marshal(new Customer(name), writer);
      String data = writer.toString();
      return data;
   }

   @Test
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.