Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Unmarshaller


    if (f1.exists() && f2.exists()) {
      Mapping mapping = new Mapping();
      try {
  mapping.loadMapping(f1.getPath());
  Unmarshaller unmar = new Unmarshaller(mapping);
  unmar.setDebug(true);
  baseobj=(JoBoBase)unmar.unmarshal(new InputSource(f2.getPath()));
 
  log.info("configured from XML");
       
      } catch (Exception e) {
  log.error(e.getMessage());
View Full Code Here


        _validate = validate;

        // _cdr = new XMLClassDescriptorResolverImpl();
        if ( _mapping != null )
        {
            _unmarshaller = new Unmarshaller( _mapping );
        }
        else
        {
            _unmarshaller = new Unmarshaller();
        }
        // _unmarshaller.setResolver(_cdr);
        _unmarshaller.setValidation( validate );

        _unmarshaller.setResolver( _cdr );
View Full Code Here

      Mapping mapping = new Mapping();
      mapping.loadMapping(
        new InputSource(mis)
        );
     
      Unmarshaller unmarshaller = new Unmarshaller(mapping);
      settings =
        (ChartThemeSettings)unmarshaller.unmarshal(
          new InputSource(is)
        );
    }
    catch (MappingException e)
    {
View Full Code Here

      Mapping mapping = new Mapping();
      mapping.loadMapping(new InputSource(ExtendedGrammar.class.getResource("mapping.xml")
                                                               .openStream()));

      Unmarshaller unmarshaller = new Unmarshaller(ExtendedGrammar.class);
      unmarshaller.setMapping(mapping);

      this.grammar = (ExtendedGrammar)unmarshaller.unmarshal(new FileReader(grammarFile));

      if (log.isDebugEnabled())
        log.debug("grammar:\n"+grammar);
    }
    catch (Exception ex)
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    Mapping mapping = new Mapping();
    mapping.loadMapping(new InputSource(ExtendedGrammar.class.getResource("mapping.xml").openStream()));

    Unmarshaller unmarshaller = new Unmarshaller(ExtendedGrammar.class);
    unmarshaller.setMapping(mapping);

    ExtendedGrammar grammar =
      (ExtendedGrammar)unmarshaller.unmarshal(new FileReader(new File(args[0])));
    grammar.update();

    System.err.println(grammar);

    System.out.println("digraph automaton {");
View Full Code Here

    Node node = list.item(0);

    Mapping mapping = new Mapping();
    mapping.loadMapping(new InputSource(ExtendedGrammar.class.getResource("mapping.xml").openStream()));

    Unmarshaller unmarshaller = new Unmarshaller(ExtendedGrammar.class);
    unmarshaller.setMapping(mapping);

    ExtendedGrammar grammar = (ExtendedGrammar)unmarshaller.unmarshal(node);

    return grammar;
  }
View Full Code Here

        URL mappingUrl = classLoader.getResource("org/apache/geronimo/webservices/webservices_1_1.xml");

        try {
            mapping = new Mapping(classLoader);
            mapping.loadMapping(mappingUrl);
            unmarshaller = new Unmarshaller(mapping);
        } catch (Exception e) {
            throw (IllegalStateException)new IllegalStateException("Unable to initialize xml unmarshaller").initCause(e);
        }
    }
View Full Code Here

    public void testUnmarshalWebXml() throws Exception {
        URL webXmlMapping = getClass().getResource("castor-web-xml-mapping.xml");
        Mapping mapping = new Mapping();
        mapping.loadMapping(webXmlMapping);
        InputStream webXml = getClass().getResourceAsStream("web.xml");
        Unmarshaller unmarshaller = new Unmarshaller(mapping);
        unmarshaller.setIgnoreExtraElements(false);
        unmarshaller.setDebug(debug);
        WebAppDD config = (WebAppDD)unmarshaller.unmarshal(new InputStreamReader(webXml));
        assertTrue(config!=null);
    }
View Full Code Here

    public void testMarshalWebXml() throws Exception {
        URL webXmlMapping = getClass().getResource("castor-web-xml-mapping.xml");
        Mapping mapping = new Mapping();
        mapping.loadMapping(webXmlMapping);
        InputStream webXml = getClass().getResourceAsStream("web.xml");
        Unmarshaller unmarshaller = new Unmarshaller(mapping);
        WebAppDD config = (WebAppDD)unmarshaller.unmarshal(new InputStreamReader(webXml));

           OutputFormat of = new OutputFormat();
            of.setIndenting(true);
            of.setIndent(4); // 2-space indention
            of.setLineWidth(16384);
View Full Code Here

    protected Object readInternal() throws IOException {
        Object object = null;
        InputStream is = getInputStream();
        try {
            Mapping mapping = getCastorMapping();
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            unmarshaller.setEntityResolver(new EntityResolverImpl());
            unmarshaller.setIgnoreExtraElements(getIgnoreExtraElements());
            if(is!=null) {
                InputStreamReader in = new InputStreamReader(is);
                object = unmarshaller.unmarshal(in);
            }
        }
        catch(Exception me) {
            me.printStackTrace();
            throw new IOException(me.getMessage());
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.Unmarshaller

Copyright © 2018 www.massapicom. 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.