Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.XMLContext.createUnmarshaller()


    context.addMapping(mapping);
   
    InputStream stream = getClass().getResourceAsStream("/com/jada/xml/query/Query.xml");
      BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

      Unmarshaller unmarshaller = context.createUnmarshaller();
      unmarshaller.setClass(NamedQueries.class);
     
      namedQueries = (NamedQueries) unmarshaller.unmarshal(reader);
  }
 
View Full Code Here


    context.addMapping(mapping);
   
    InputStream stream = getClass().getResourceAsStream("/com/jada/xml/databaseUpgrade/DatabaseUpgradeQuery.xml");
      BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

      Unmarshaller unmarshaller = context.createUnmarshaller();
      unmarshaller.setClass(DatabaseUpgradeQueries.class);
     
      databaseUpgradeQueries = (DatabaseUpgradeQueries) unmarshaller.unmarshal(reader);
  }
 
View Full Code Here

                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_COLUMN_NAME)
                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_ONE_TO_ONE_NAME)
                          || 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);
View Full Code Here

            InputSource srcMapping = new InputSource(strmMapping);
            Assert.assertNotNull("InputSource of mapping must not be null", srcMapping);
            Mapping mapping = new Mapping();
            mapping.loadMapping(srcMapping);
            context.addMapping(mapping);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("withmapping-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = unmarshaller.unmarshal(is);
View Full Code Here

    public void testLoadPackage() {
        try {
            XMLContext context = new XMLContext();
            context.addPackage("org.castor.xmlctf.bestpractise.genpackage");
            // context.getInternalContext().getXMLClassDescriptorResolver().getDescriptorCache();
            Unmarshaller u = context.createUnmarshaller();
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("genpackage-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = u.unmarshal(is);
View Full Code Here

       
        //2.1 Prepare file writer
        Reader reader = new FileReader("mapped_article.xml");

        //2.2 Create a new Unmarshaller
        Unmarshaller unmarshaller = context.createUnmarshaller();
        unmarshaller.setClass(Article.class);

        //2.3 Unmarshal "map" to Object
        Article article = (Article) unmarshaller.unmarshal(reader);
       
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.