Just to let you know that I have updated the HTML docs on the Spring factory beans a few minutes ago, to be inline with the latest code (1.0-SNAPSHOT).
Sorry for any inconvenience caused. Werner Werner Guttmann wrote: > Hi, > > When using the 1.0-SNAPSHOT release of the Spring factory beans for > Castor XML, the way to set one or more mapping files has changed to > > <bean id="resolver" > > class="org.springframework.xml.castor.CastorResolverFactoryBean"> > <property name="mappingLocations"> > <list> > <value>castor-mapping.xml</value> > </list> > </property> > </bean> > > Sorry for any inconvenience caused .... It somehow looks like I have not > updated the HTML docs accordingly. > > Regards > Werner > >> -----Original Message----- >> From: S. Sharif [mailto:[EMAIL PROTECTED] >> Sent: Dienstag, 20. Februar 2007 20:36 >> To: [email protected] >> Subject: Re: [castor-user] Problem configuring Castor XML >> with Spring FactoryBeans >> >> >> I tried calling the ClassLoader.getResource() directly >> >> URL mappingPath = >> this.getClass().getClassLoader().getResource("castor-mapping.xml"); >> >> // load castor mapping file >> Mapping map = new Mapping(); >> map.loadMapping(mappingPath); >> unmarshaller = new Unmarshaller(map); >> >> >> and that works just fine when I run the code. So I am not >> sure why the example in "How to use the Spring FactoryBeans >> for Castor XML" >> http://www.castor.org/spring-xml-intro.html >> >> is not working for me. >> >> This is the xml in my spring config file >> >> <bean id="resolver" >> class="org.springframework.xml.castor.CastorResolverFactoryBean"> >> <property name="castorProperties"> >> <props> >> <prop >> key="mappingLocation">castor-mapping.xml</prop> >> </props> >> </property> >> </bean> >> >> <bean id="marshaller" >> class="org.springframework.xml.castor.CastorMarshallerFactoryBean"> >> <property name="resolver" ref="resolver"/> >> </bean> >> >> <bean id="unmarshaller" >> class="org.springframework.xml.castor.CastorUnmarshallerFactoryBean"> >> <property name="resolver" ref="resolver"/> >> </bean> >> >> >> And this is the command that I use to get an instance of the >> Unmarshaller: >> >> Unmarshaller unmarshaller = (Unmarshaller) >> appContext.getBean("unmarshaller"); >> >> PersonVO person = (PersonVO) >> unmarshaller.unmarshal(new >> FileReader(currentDirUrl.getPath() + >> "TestInput.xml")); >> >> >> Is there another missing step? I have not setup any castor >> properties. Do I need to do something such as setting up >> castor properties, or telling castor to load castor >> properties, ...etc?? >> >> Thanks. >> >> >> --- Werner Guttmann <[EMAIL PROTECTED]> wrote: >> >>> Hi, >>> >>> the CastorResolverFactoryBean looks for the mapping file on the >>> classpath, using a call to ClassLoader.getResource() to locate the >>> file (and eventually load it). >>> >>> Regards >>> Werner >>> >>> PS No, the Javadoc for the XML factory beans still needs to be made >>> available somewhere. >>> >>> S. Sharif wrote: >>>> Hi, >>>> I have read the page on "How to use the Spring FactoryBeans for >>>> Castor XML" on the Castor website >>>> >>>> http://www.castor.org/spring-xml-intro.html >>>> >>>> >>>> I followed the instructions on the page and setup Castor in my >>>> spring config xml file. When I try >>> to >>>> run the code I get the following error: >>>> >>>> Caused by: org.xml.sax.SAXException: The class for >>> the >>>> root element 'Document' could not be found. >>>> >>>> Upon investigating, I think that the error is >>> caused >>>> by the fact that Castor is not able to find my >>> mapping >>>> file castor-mapping.xml >>>> >>>> This is the xml that I put into my Spring config >>> file, >>>> just as shown in the example on the Castor >>> website: >>>> <bean id="resolver" >>>> >> class="org.springframework.xml.castor.CastorResolverFactoryBean"> >>>> <property name="castorProperties"> >>>> <props> >>>> <prop >>>> key="mappingLocation">castor-mapping.xml</prop> >>>> </props> >>>> </property> >>>> </bean> >>>> >>>> >>>> Does the mappingLocation property take a relative path? >> And if so >>>> the path is relative to what? >>>> Note: my castor-mapping.xml mapping file and my >>> spring >>>> config xml file are both located in the same directory. >>>> >>>> Also is there any Javadoc for the >>>> >> org.springframework.xml.castor.CastorResolverFactoryBean >>>> class?? I browsed through the Castor website, >>> but I >>>> could not find it. >>>> >>>> Thanks. >>>> >>>> >>>> >> ********************************************************** >>>> * Saladin Sharif >>>> * e-mail: [EMAIL PROTECTED] >>>> * Visit homepage @ >>> http://gaia.ecs.csus.edu/~sharifs >> ********************************************************** >>>> >>>> >>>> >> ______________________________________________________________ >> ______________________ >>>> Need a quick answer? Get one in minutes from >>> people who know. >>>> Ask your question on www.Answers.yahoo.com >>>> >>>> >> --------------------------------------------------------------------- >>>> To unsubscribe from this list please visit: >>>> >>>> http://xircles.codehaus.org/manage_email >>>> >>> >>> >> --------------------------------------------------------------------- >>> To unsubscribe from this list please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >> >> >> >> ______________________________________________________________ >> ______________________ >> Don't pick lemons. >> See all the new 2007 cars at Yahoo! Autos. >> http://autos.yahoo.com/new_cars.html >> >> --------------------------------------------------------------------- >> To unsubscribe from this list please visit: >> >> http://xircles.codehaus.org/manage_email >> > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

