Examples of createMarshaller()


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

    {
        super.setUp();
        random = new Random();

        JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
        marshaller = context.createMarshaller();
        unmarshaller = context.createUnmarshaller();
        objectFactory = new ObjectFactory();

    }
View Full Code Here

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

  
   }
  
   public void writeFile(File output) throws JAXBException {
    JAXBContext context = JAXBContext.newInstance( AutomatedInstallation.class );
     Marshaller m = context.createMarshaller();
    m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
    m.marshal( automatedInstallation, output );   
   }
  
}
View Full Code Here

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

   }
  
   public void writeFile(File output) throws JAXBException, ParseException {
    JAXBContext context = JAXBContext.newInstance( Installations.class );

     Marshaller m = context.createMarshaller();
     m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
    m.marshal( installations, output );   
   
   }
  
View Full Code Here

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

        JAXBRuntimeBinder annReader = new JAXBRuntimeBinder(mmgr, clr);
        //jaxbConfig.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, "DefaultNamespace");
        jaxbConfig.put(JAXBRIContext.ANNOTATION_READER, annReader);

        JAXBContext jaxbContext = JAXBContext.newInstance(new Class[]{obj.getClass()}, jaxbConfig);
        Marshaller marshaller = jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(obj, node);
    }

    /**
 
View Full Code Here

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

 
  private boolean roundTripValidate(JaxbEventBase event, Schema s, Errors errors) {
      try {
      ValidationMonitor monitor = new ValidationMonitor();
      JAXBContext context = JAXBContext.newInstance(event.getClass().getPackage().getName());
      Marshaller marshaller = context.createMarshaller();
      marshaller.setSchema(s);
      marshaller.setEventHandler(monitor);
      Document doc = getTargetDocument();
     
      marshaller.marshal(event.getMarshallableType(), doc);
View Full Code Here

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

    if ((obj != null) && obj instanceof Element) {
      result = (Element) obj;
    } else if (obj != null) {
      try {
        JAXBContext jcontext = JAXBContext.newInstance(this.eventPkg);
        Marshaller marshaller = jcontext.createMarshaller();

        Document doc = getTargetDocument();
       
        if (obj instanceof JaxbEventBase) {
          JaxbEventBase jeb = (JaxbEventBase)obj;
View Full Code Here

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

        String evtName = this.getEventName();
        this.setEventName(null);
        try {
      ValidationMonitor monitor = new ValidationMonitor();
      JAXBContext context = JAXBContext.newInstance(this.getClass().getPackage().getName());
      Marshaller marshaller = context.createMarshaller();
      marshaller.setSchema(this.validatingSchema);
      marshaller.setEventHandler(monitor);
      marshaller.marshal(getMarshallableType(), getTargetDocument());
     
      monitor.populate(errors);
View Full Code Here

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

  static public OutputStream marshall(Object obj, String pkg,
      ClassLoader loader) throws Exception {
    LOGGER.debug("Marshalling " + obj + " in package " + pkg); //$NON-NLS-1$ //$NON-NLS-2$
    JAXBContext jc = JAXBContext.newInstance(pkg, loader);
    Marshaller m = jc.createMarshaller();
    OutputStream ostream = new ByteArrayOutputStream();

    m.marshal(obj, ostream);

    return ostream;
View Full Code Here

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

    return ostream;
  }
 
  static public Document marshall(Object obj, String pkg, Document targetDoc, ClassLoader loader) throws Exception {
    JAXBContext jc = JAXBContext.newInstance(pkg, loader);
    Marshaller m = jc.createMarshaller();

    m.marshal(obj, targetDoc);

    return targetDoc;
  }
View Full Code Here

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

//        JAXBElement element =  (JAXBElement) object;
        unmarshaller.setEventHandler(new TestValidationEventHandler());
//        T app = (T) element.getValue();
//        System.out.println("unmarshalled");

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

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(object, baos);
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.