Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Marshaller.marshal()


    context.addMapping(mapping);
   
    StringWriter writer = new StringWriter();
      Marshaller marshaller = context.createMarshaller();
      marshaller.setWriter(writer);
      marshaller.marshal(urlSet);
      result = writer.toString();
     
      return result;
  }
 
View Full Code Here


            Boolean value = (Boolean)parameters.get("suppressXSIType");
            if (value != null) {
                suppressXSIType = value.booleanValue();
            }
            marshaller.setSuppressXSIType(suppressXSIType);
      marshaller.marshal(object);
      writer.close();
    } catch (MappingException e) {
      throw new ConverterException("Can't create Unmarshaller", e);
    } catch (Exception e) {
      throw new ConverterException(e.getMessage(), e);
View Full Code Here

                mapping.addClassMapping((ClassMapping) enumeration.nextElement());
            }
            marshal = new Marshaller(writer);
            marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
            marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
            marshal.marshal(mapping);
        } catch (Exception except) {
            throw new MappingException(except);
        }
    } // -- write
View Full Code Here

            // write back the history to file
            try {
                FileWriter writer = new FileWriter("queryhistory.xml");
                Marshaller marshaller = new Marshaller(writer);
                marshaller.setMapping(_mapping);
                marshaller.marshal(_qhistory);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

        test.setElement3(el3);
        test.setElementRef(elRef);
        StringWriter out = new StringWriter();
        Marshaller marshaller = new Marshaller(out);
        marshaller.setValidation(true);
        marshaller.marshal(test);
    }

    /**
     * test validate a null idref in an idrefs
     *
 
View Full Code Here

       
        try {
            StringWriter out = new StringWriter();
            Marshaller marshaller = new Marshaller(out);
            marshaller.setValidation(true);
            marshaller.marshal(test);
        } catch (Exception e) {
            // assertTrue(e.getCause() instanceof ValidationException);
        }
    }
   
View Full Code Here

       
        try {
            StringWriter out = new StringWriter();
            Marshaller marshaller = new Marshaller(out);
            marshaller.setValidation(true);
            marshaller.marshal(test);
        } catch (Exception e) {
            // assertTrue(e.getCause() instanceof ValidationException);
        }
    }   
}
View Full Code Here

            Marshaller marshaller = xmlContext.createMarshaller();
            marshaller.setWriter(writer);
           
            marshaller.setRootElement("changelog");
            marshaller.setSuppressXSIType(true);
            marshaller.marshal(changelog);
           
        }
        catch(Exception ex) {
          ex.printStackTrace();
        }
View Full Code Here

        Marshaller marshaller = new Marshaller(out);
        marshaller.setMapping(mapping);
       
        Bean bean = new Bean(new Integer(999), "element of 999", null);
       
        marshaller.marshal(bean);
       
        String output = out.toString();
       
        String expected
            = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
View Full Code Here

        marshaller.setMapping(mapping);
       
        Bean refered = new Bean(new Integer(999), "element of 999", null);
        Bean referer = new Bean(new Integer(100), "element of 100", refered);
       
        marshaller.marshal(referer);
       
        String output = out.toString();
       
        String expected
            = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
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.