Package javax.xml.bind

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


    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));

    FileWriter fw = null;
    try {
      fw = new FileWriter(dsXml);
      marshaller.marshal(group, fw);
    } finally {
      if (fw != null) {
        fw.close();
      }
    }
View Full Code Here


      try {
        JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {PlanNode.class});
      Marshaller marshaller = jc.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE); //$NON-NLS-1$
      StringWriter writer = new StringWriter();
      marshaller.marshal(this, writer);
      return writer.toString();
      } catch (JAXBException e) {
        //shouldn't happen
        throw new TeiidRuntimeException(e);
      }
View Full Code Here

    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {TranslatorMetaDataGroup.class});
    Marshaller marshell = jc.createMarshaller();
    marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
   
    StringWriter sw = new StringWriter();
    marshell.marshal(group, sw);
       
    System.out.println(sw.toString());   
   
    Unmarshaller un = jc.createUnmarshaller();
    group = (TranslatorMetaDataGroup)un.unmarshal(new StringReader(sw.toString()));
View Full Code Here

    Marshaller marshell = jc.createMarshaller();
    marshell.setSchema(schema);
    marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
   
    StringWriter sw = new StringWriter();
    marshell.marshal(vdb, sw);
       
    //System.out.println(sw.toString());

    // UnMarshell
    Unmarshaller un = jc.createUnmarshaller();
View Full Code Here

        EasyMock.expectLastCall();
        IArgumentMatcher matcher = new JAXBEltMatcher();
        for (int i = 0; i < expectedValues.length; i++) {
            EasyMock.reportMatcher(matcher);
            EasyMock.eq(header);
            marshaller.marshal(null, header);
            //marshaller.marshal(expectedJAXBElements[i],
            //                   header);
            EasyMock.expectLastCall();
        }
        MimeHeaders mimeHeaders = control.createMock(MimeHeaders.class);
View Full Code Here

                u.setProperty(Marshaller.JAXB_ENCODING , "UTF-8");
                u.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                u.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE)
               
                DOMResult domResult = new DOMResult();
                u.marshal(obj, domResult);
                dest.addDocument((Document)domResult.getNode());               
               
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
View Full Code Here

            } else {
                mObj = JAXBElement.class.getConstructor(new Class[] {QName.class, Class.class, Object.class})
                    .newInstance(elNname, mObj.getClass(), mObj);
            }
            u.setSchema(schema);
            u.marshal(mObj, destNode);
        } catch (MarshalException me) {
            // It's helpful to include the cause in the case of
            // schema validation exceptions.
            String message = "Marshalling error ";
            if (me.getCause() != null) {
View Full Code Here

        String name = obj.getClass().getPackage().getName();
        JAXBContext context = JAXBContext.newInstance(name);
        JAXBElement<Object> el = new JAXBElement<Object>(new QName("test"), Object.class, obj);
        Marshaller m = context.createMarshaller();
        StringWriter writer = new StringWriter();
        m.marshal(el, writer);

        return writer.toString();      
    }
}
View Full Code Here

                public Iterator getPrefixes(String arg) {
                    return wsdl.getNamespaces().keySet().iterator();
                }
            });
           
            u.marshal(mObj, writer);
            writer.flush();           
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "",
                                    ex);
View Full Code Here

      Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class, ManagedConnectionFactoryDeploymentMetaData.class, LocalDataSourceDeploymentMetaData.class, NonXADataSourceDeploymentMetaData.class, DataSourceDeploymentMetaData.class};     
      JAXBContext context = JAXBContext.newInstance(classes);     
      Marshaller m = context.createMarshaller();     
      JAXBElement element = new JAXBElement(new QName("", "datasources"), group.getClass(), group);
      StringWriter w = new StringWriter();
      m.marshal(element, w);     
      return w.toString();     
   }
  
   public static ManagedConnectionFactoryDeploymentGroup unmarshalSource(String content) throws Exception
   {
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.