Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Unmarshaller.unmarshal()


        }
        try {
            Unmarshaller stream = new Unmarshaller(DefaultConfiguration.class);
            AttributeExpander handler = new AttributeExpander(
                    new InputStreamReader(source));
            result = (DefaultConfiguration) stream.unmarshal(handler);
        } finally {
            try {
                source.close();
            } catch (IOException ignore) {
            }
View Full Code Here


        //do not use the static method to ensure validation is turned on
        Unmarshaller unmarshaller = new Unmarshaller(Binding.class);
        unmarshaller.setValidation(true);

        try {
            loaded = (Binding) unmarshaller.unmarshal(source);

            //--Copy one by one the components loaded in the root binding
            _binding.setDefaultBindingType(loaded.getDefaultBindingType());

            //--packages
View Full Code Here

     */
    public void testMarshallChangeHref() throws Exception {
        Unmarshaller unmarshaller = new Unmarshaller (PartialTermination.class);
       
        try {
            PartialTermination entity = (PartialTerminationunmarshaller.unmarshal(new InputSource(this.getClass().getResource("input-ok.xml").toExternalForm()));
           
            AssignmentNotification[] assignmentNotification = entity.getAssignmentNotification();
            // assertEquals(assignmentNotification[0].getPartyReference().getHref(), entity.getPartyTwo());
            assignmentNotification[0].getPartyReference().setHref(entity.getPartyOne());
           
View Full Code Here

     */
    public void testMarshallInexistentHref() throws Exception {
        Unmarshaller unmarshaller = new Unmarshaller (PartialTermination.class);
       
        try {
            PartialTermination entity = (PartialTerminationunmarshaller.unmarshal(new InputSource(getClass().getResource("input-ok.xml").toExternalForm()));
           
            AssignmentNotification[] assignmentNotification = entity.getAssignmentNotification();
            // assertEquals(assignmentNotification[0].getPartyReference().getHref(), entity.getPartyTwo());
           
            PartyTwo partyTwo = new PartyTwo();
View Full Code Here

     */
    public void testMarshallNullHref() throws Exception {
        Unmarshaller unmarshaller = new Unmarshaller (PartialTermination.class);
       
        try {
            PartialTermination entity = (PartialTerminationunmarshaller.unmarshal(new InputSource(getClass().getResource("input-ok.xml").toExternalForm()));
           
            AssignmentNotification[] assignmentNotification = entity.getAssignmentNotification();
            assignmentNotification[0].getPartyReference().setHref(null);
           
            StringWriter out = new StringWriter();
View Full Code Here

     */
    public void testMarshallWrongHref() throws Exception {
        Unmarshaller unmarshaller = new Unmarshaller (PartialTermination.class);
       
        try {
            PartialTermination entity = (PartialTerminationunmarshaller.unmarshal(new InputSource(getClass().getResource("input-ok.xml").toExternalForm()));
           
            AssignmentNotification[] assignmentNotification = entity.getAssignmentNotification();
            assignmentNotification[0].getPartyReference().setHref("bla");
           
            StringWriter out = new StringWriter();
View Full Code Here

       
        CpactfConf cpactfconf = null;
        try {
            Unmarshaller unmarshaller = new Unmarshaller(CpactfConf.class);
            unmarshaller.setEntityResolver(new DTDResolver(null));
            cpactfconf = (CpactfConf) unmarshaller.unmarshal(source);
        } catch (MarshalException e) {
            throw new CPAConfigException(e);
        } catch (ValidationException e) {
            throw new CPAConfigException(e);
        }
View Full Code Here

                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_ONE_TO_MANY))) {
              XMLContext context = new XMLContext();
              context.addPackage(JDOConstants.GENERATED_ANNOTATION_CLASSES_PACKAGE);
              Unmarshaller unmarshaller = context.createUnmarshaller();              
              unmarshaller.setClassLoader(getClass().getClassLoader());
              _appInfo.getJdoContent().add(unmarshaller.unmarshal(node));
          }           
          //-- add to appInfo
          _appInfo.add(node);
      } else {
          //-- add to parent AnyNode
View Full Code Here

            unmarshaller.setMapping(mapping);
            //-- turn off validation
            unmarshaller.setValidation(false);

                is = this.getClass().getResourceAsStream(TYPE_DEFINITIONS);
            TypeList typeList = (TypeList)unmarshaller.unmarshal( new org.xml.sax.InputSource(is) );

                //print what we just read (only in debug mode and if we have a logWriter)
            // TODO: Joachim 2007-09-04 remove me
                // LocalConfiguration config = LocalConfiguration.getInstance();
                if (LOG.isDebugEnabled()) {
View Full Code Here

        //-- Else we let the unmarshaller get us the class
        try {
            Class clazz = loader.loadClass(type);
            Unmarshaller unmarshaller = new Unmarshaller(clazz);
            return unmarshaller.unmarshal(new StringReader(value));
        } catch (ValidationException e) {
            //--this can't happen, just log it
            e.printStackTrace();
        }
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.