Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Unmarshaller


     */
    protected Object readInternal(InputStream is) throws IOException {
        Object object = null;
        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


      final String METHOD_NAME = "load()";

        String filename = PlutoAdminContext.getInstance().getPlutoHome() + "/" + CONFIG_FILE;
        logDebug(METHOD_NAME, "Registry file to load: " + filename);

        Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
        unmarshaller.setMapping(this.mapping);

        PortletApplicationEntityListImpl apps = (PortletApplicationEntityListImpl)unmarshaller.unmarshal(new FileReader(filename));
        castorApplications = apps.getCastorApplications();
        return apps;
    }
View Full Code Here

        try {
            org.w3c.dom.Document portletDocument =
                XmlParser.parsePortletXml(new FileInputStream(portletXml));

            Unmarshaller unmarshaller = new Unmarshaller(mappingPortletXml);

            // modified by YCLI: START :: to ignore extra elements and attributes
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);
            // modified by YCLI: END

            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                    portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(webModule);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            if (debug) {
                System.out.println(portletApp);
            }

            // now generate web part

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                org.w3c.dom.Document webDocument =
                    XmlParser.parseWebXml(new FileInputStream(webXml));

                Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);

                // modified by YCLI: START :: to ignore extra elements and attributes
                unmarshallerWeb.setIgnoreExtraElements(true);
                unmarshallerWeb.setIgnoreExtraAttributes(true);
                // modified by YCLI: END

                webApp =
                    (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                        webDocument);
            } else {
                webApp = new WebApplicationDefinitionImpl();
                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(webModule);
View Full Code Here

     */
    protected Object readInternal(InputStream is) throws IOException {
        Object object = null;
        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

    private Map mappings = new HashMap();

    public Object getObject(InputStream stream, Map parameters) throws ConverterException {
        try {
            ReferenceFieldHandler.setObjectMap((Map)parameters.get("objectmap"));
            Unmarshaller unmarshaller = new Unmarshaller((Mapping)this.mappings.get(parameters.get("profiletype")));
            Object result = unmarshaller.unmarshal(new InputSource(stream));
            stream.close();
            return result;
        } catch (MappingException e) {
            throw new ConverterException("can't create Unmarshaller", e);
        } catch (Exception e) {
View Full Code Here

    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

        return xml2Descriptor( new InputSource( _sourcefile ) );
    }
   
   
    public static OzoneClassDescriptor xml2Descriptor( InputSource _source ) throws Exception {
        Unmarshaller umrs = new Unmarshaller( OzoneClassDescriptor.class );
        //umrs.setLogWriter( logger );
        return (OzoneClassDescriptor)umrs.unmarshal( _source );
    }
View Full Code Here

      marshaller.marshal(order);
      return writer.toString();
  }
 
  private TxnResult unmarshall(String response) throws IOException, MarshalException, ValidationException {
      Unmarshaller unmarshaller = xmlContext.createUnmarshaller();
      unmarshaller.setClass(TxnResult.class);
     
      StringReader stream = new StringReader(response);
      BufferedReader reader = new BufferedReader(stream);
      TxnResult result = (TxnResult) unmarshaller.unmarshal(reader);
      return result;
  }
View Full Code Here

    context.addMapping(mapping);
   
    InputStream stream = getClass().getResourceAsStream("/META-INF/persistence.xml");
      BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

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

      persistence = (Persistence) unmarshaller.unmarshal(reader);
  }
View Full Code Here

      marshaller.marshal(order);
      return writer.toString();
  }
 
  private Result unmarshall(String response) throws IOException, MarshalException, ValidationException {
      Unmarshaller unmarshaller = xmlContext.createUnmarshaller();
      unmarshaller.setClass(Result.class);
     
      StringReader stream = new StringReader(response);
      BufferedReader reader = new BufferedReader(stream);
      Result result = (Result) unmarshaller.unmarshal(reader);
      return result;
  }
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.