Package javax.xml.bind

Examples of javax.xml.bind.Marshaller.marshal()


      {
         logger.warn(e.getMessage(), e);
      }
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
      ObjectFactory factory = new ObjectFactory();
      marshaller.marshal(factory.createPurchaseOrder(po), System.out);
   }
}
View Full Code Here


   {
      try
      {
         Marshaller marshaller = getMarshaller(type, annotations, mediaType);
         marshaller = decorateMarshaller(type, annotations, mediaType, marshaller);
         marshaller.marshal(t, outputStream);
      }
      catch (JAXBException e)
      {
         throw new JAXBMarshalException(e);
      }
View Full Code Here

  }
   
  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

    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

  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")
  public static Object unmarshallFromElement(Element element, String thePackage) throws JAXBException {
View Full Code Here

     
      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);
      Assert.fail("unexpected");
    }
View Full Code Here

     
      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);
      Assert.fail("unexpected");
    }
View Full Code Here

  
   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

   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

        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);
    }

    /**
     * Method to unmarshall a node from XML into an object.
     * @param cls Type of object
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.