Re: [Simple-support] problems to deserialize an xml file
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2009-01-02 17:49:41
|
Hi,
The problem is class="java.beans.XMLDecoder". An option you can try is this.
Strategy strategy = new TreeStrategy("type", "length")
Persister persister = new Persister(strategy);
This will create a persister that uses a type= attribute to define the types rather than the class= attribute. The persister is reading the class= attribute to determine the type. So because the class="java.beans.XMLDecoder" is not the type you are deserializing you need to ignore it, using type= instead will ignore the class= attributes.
Niall
--- On Fri, 1/2/09, Mouad El Gharbaoui <mou...@gm...> wrote:
> From: Mouad El Gharbaoui <mou...@gm...>
> Subject: Re: [Simple-support] problems to deserialize an xml file
> To: gal...@ya...
> Date: Friday, January 2, 2009, 9:14 AM
> hi, thanks for the quick response,
>
> the xml contains the line <java
> version="1.6.0_07"
> class="java.beans.XMLDecoder">
> and the class = attributes too.
> I am using no strategy, didn t read anything about in the
> tutorial!
>
> i have already posted the code for:
> com.flowfact.client.app.configuration.UserConfiguration.readXStream(UserConfiguration.java:232)
> tha t s the few lines that i have posted at the beginning.
>
> thanks
>
> Mouad
>
>
>
> -------- Original-Nachricht --------
> > Datum: Fri, 2 Jan 2009 09:00:24 -0800 (PST)
> > Von: Niall Gallagher <gal...@ya...>
> > An: sim...@li..., Mouad El
> Gharbaoui <mou...@gm...>
> > Betreff: Re: [Simple-support] problems to deserialize
> an xml file
>
> > Hi,
> >
> > Looks like the XML content you are trying to
> deserialize is incorrect. In
> > this case you are deserializing an XMLDecoder and
> trying to assign it to a
> > UserConfiguration object. Attach the code for
> >
> >
> com.flowfact.client.app.configuration.UserConfiguration.readXStream(UserConfiguration.java:232)
> >
> > Does your XML source contain "class="
> attributes that contain either of
> > the classes? Also what strategy are you using?
> >
> > Niall
> >
> >
> > --- On Fri, 1/2/09, Mouad El Gharbaoui
> <mou...@gm...> wrote:
> >
> > > From: Mouad El Gharbaoui <mou...@gm...>
> > > Subject: [Simple-support] problems to deserialize
> an xml file
> > > To: sim...@li...
> > > Date: Friday, January 2, 2009, 8:52 AM
> > > I am trying the first time to deserialize an xml
> file to a
> > > given object with following codelines:
> > >
> > > Serializer serializer = new Persister();
> > > File source = new File(getPath() +
> getFileName());
> > > UserConfiguration conf =
> > > decoder.read(UserConfiguration.class, source);
> > >
> > > But i become following exception:
> > >
> org.simpleframework.xml.core.InstantiationException: Type
> > > class java.beans.XMLDecoder is not compatible
> with class
> > >
> com.flowfact.client.app.configuration.UserConfiguration
> > > at
> > >
> org.simpleframework.xml.core.Factory.getOverride(Factory.java:106)
> > > at
> > >
> >
> org.simpleframework.xml.core.ObjectFactory.getInstance(ObjectFactory.java:63)
> > > at
> > >
> org.simpleframework.xml.core.Composite.read(Composite.java:125)
> > > at
> > >
> org.simpleframework.xml.core.Traverser.read(Traverser.java:78)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:544)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:526)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:507)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:489)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:471)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:452)
> > > at
> > >
> org.simpleframework.xml.core.Persister.read(Persister.java:431)
> > > at
> > >
> >
> com.flowfact.client.app.configuration.UserConfiguration.readXStream(UserConfiguration.java:232)
> > > at
> > >
> >
> com.flowfact.util.configuration.Configuration.load(Configuration.java:121)
> > > at
> > >
> >
> com.flowfact.client.app.FlowFactActivator.getUserConfiguration(FlowFactActivator.java:106)
> > > at
> > >
> >
> com.flowfact.client.app.splashHandlers.InteractiveSplashHandler.requestTargetServerInformation(InteractiveSplashHandler.java:351)
> > > at
> > >
> >
> com.flowfact.client.app.ApplicationWorkbenchAdvisor.preStartup(ApplicationWorkbenchAdvisor.java:59)
> > > at
> > >
> >
> org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1359)
> > > at
> > >
> >
> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
> > > at
> > >
> org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> > > at
> > >
> >
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
> > > at
> > >
> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
> > > at
> > >
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
> > > at
> > >
> org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2293)
> > > at
> > >
> org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
> > > at
> > >
> org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> > > at
> > >
> >
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
> > > at
> > >
> >
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
> > > at
> > >
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> > > at
> > >
> >
> com.flowfact.client.app.FlowFactApplication.start(FlowFactApplication.java:28)
> > > at
> > >
> >
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
> > > at
> > >
> >
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> > > at
> > >
> >
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> > > at
> > >
> >
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
> > > at
> > >
> >
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> > > at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > > at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > at
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at
> java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > >
> org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
> > > at
> > >
> org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> > > at
> org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> > > at
> org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> > >
> > > Does anybpdy know what is the reason?
> > >
> > > Thanks
> > >
> > > Mouad
> > >
> > > --
> > > Psssst! Schon vom neuen GMX MultiMessenger
> gehört? Der
> > > kann`s mit allen:
> http://www.gmx.net/de/go/multimessenger
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > _______________________________________________
> > > Simple-support mailing list
> > > Sim...@li...
> > >
> https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
> >
>
> --
> Sensationsangebot verlängert: GMX FreeDSL -
> Telefonanschluss + DSL
> für nur 16,37 Euro/mtl.!*
> http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
|