[castor-user] Codehaus Castor mailing list relocations after Codehaus shutdown
Hi, IF YOU RECEIVE THIS MAIL, BEWARE THAT THIS MEANS YOU’RE SUBSCRIBED TO A MAILING LIST THAT WILL SOON DISAPPEAR. Read below if you want to know more. This mail is indeed a reminder that as Codehaus is closing, all the existing mailing lists of the Castor project at Codehaus will soon disappear. Future development will now happen at Github under https://github.com/castor-data-binding. Our official website will be at http://castor-data-binding.github.io/castor/. Please note that we will NOT migrate subscriptions from the Codehaus to FreeLists. As such, If you are interested into announcements related to Castor, subscribe to the new castor.announce mailing list hosted at freelists.org at http://www.freelists.org/list/castor.announce If you have questions to ask about the usage of Castor, subscribe to the new castor.user mailing list hosted at freelists.org at http://www.freelists.org/list/castor.user If you want to follow the development, subscribe to new castor.dev mailing list at freelists.org at http://www.freelists.org/list/castor.dev If you want to follow SCM activity, please use the GitHub facilities over at https://github.com/castor-data-binding - The Castor team --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[castor-user] Migration of Castor to github - Part II
Dear all, I have just made available a new build of the project's site at http://castor-data-binding.github.io/castor/ Please note that this site has been built using Maven, and has still some rough edges (broken links, ...). I'd appreciate any feedback on such issues at https://github.com/castor-data-binding/castor/labels/project%20site Thanks Werner On 22.03.2015 22:55, Werner Guttmann wrote: Hi all, as already mentioned by Ralf the other day, The Codehaus is coming to its End of Life [EOL] within a few days. As such, I have started to migrate major parts of Castor to Github, which will be the default code repository for Castor. As of now, the following artefacts have been migrated successfully and are available: * Source code: What used to hosted in an SVN repository at the Codehaus, is now available at https://github.com/castor-data-binding/castor. * Web site: The project's web site has moved from http://castor.codehaus.org/ to http://castor-data-binding.github.io/castor/. Please note that major sections will have to updated to reflect the move to Github. I will follow up with news re: the other infrastructure bits and pieces pretty soon. Anybody willing to contribute, please visit https://github.com/castor-data-binding/castor and create pull requests as needed. Kind Regards Werner Guttmann --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[castor-user] Migration of Castor to github - Part I
Hi all, as already mentioned by Ralf the other day, The Codehaus is coming to its End of Life [EOL] within a few days. As such, I have started to migrate major parts of Castor to Github, which will be the default code repository for Castor. As of now, the following artefacts have been migrated successfully and are available: * Source code: What used to hosted in an SVN repository at the Codehaus, is now available at https://github.com/castor-data-binding/castor. * Web site: The project's web site has moved from http://castor.codehaus.org/ to http://castor-data-binding.github.io/castor/. Please note that major sections will have to updated to reflect the move to Github. I will follow up with news re: the other infrastructure bits and pieces pretty soon. Anybody willing to contribute, please visit https://github.com/castor-data-binding/castor and create pull requests as needed. Kind Regards Werner Guttmann --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Re: [castor-dev] Castor mapping jar packaging issues with castor-1.3.3-core.jar, castor-1.3.3-xml.jar, and castor-1.3.3.jar
Hi, can somebody please create a Jira issue and provide all information from here at the newly created issue. Kind Regards Werner On 14.02.2014 21:22, Dmytro Shyshchenko wrote: Hello Werner, I do also had the same problem, as Jeff described. If you try to generate classes from .xsd without castor.jar on your class-path (using Ant or command line), you will get: Exception in thread main java.lang.ExceptionInInitializerError at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.init(SchemaUnmarshaller.java:229) at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.init(SchemaUnmarshaller.java:158) at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:663) at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:611) at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:332) Caused by: org.exolab.castor.xml.schema.SimpleTypesFactoryException: Error: The schema built in types could not be loaded or created.; org.castor.core.util.PropertiesException: Could not find configured class: org.castor.mapping.loaderFactories[0]=org.castor.mapping.JDOMappingLoaderFactory at org.exolab.castor.xml.schema.SimpleTypesFactory.loadTypesDefinitions(SimpleTypesFactory.java:433) at org.exolab.castor.xml.schema.SimpleTypesFactory.init(SimpleTypesFactory.java:169) at org.exolab.castor.xml.schema.Schema.clinit(Schema.java:111) . In order to generate classes from .xsd with version 1.3.3, you will need just everything on your class-path: pathelement location=${castor}/ pathelement location=${castorCore}/ pathelement location=${castorXML}/ pathelement location=${castorGen}/ pathelement location=${castorSchema}/ pathelement location=${commonsLogging}/ pathelement location=${commonsLang}/ or do re-packaging, as Jeff has proposed. Just try it your self! Best regards, Dmytro On Fri, Feb 14, 2014 at 7:58 PM, Werner Guttmann wgut...@codehaus.org mailto:wgut...@codehaus.org wrote: Hi Jeff, you should NOT have the castor-1.3.3 JAR on your classpath, anyhow, as you apparently decided to use the individual Castor modules (core, xml, ...). Can you please remove the Über-JAR, and your problems should be gone. Kind regards Werner On 28.01.2014 20:17, Jeff J Li wrote: There are packaging issues with the following three jar files in the _castor_ 1.3.3 GA version from the link _http://dist.codehaus.org/__castor/1.3.3/castor-1.3.3.zip_ http://dist.codehaus.org/castor/1.3.3/castor-1.3.3.zip___.. castor-1.3.3-core.jar castor-1.3.3-xml.jar castor-1.3.3.jar Those three files cannot be placed in the CLASSPATH at the same time because they are sealed packages as showing in the manifest files and they also contain duplicate compiled classes. Some classes in the package org.castor.mapping are duplicated in both _castor_-1.3.3-xml.jar and _castor_-1.3.3.jar. The packaging issue will case java security sealing violation. The _castor_-1.3.3-core.jar, and _castor_-1.3.3-xml.jar cannot be used without the _castor_-1.3.3.jar. The reason is that the _castor_-1.3.3-xml.jar misses some compiled classes which are available in _castor_-1.3.3.jar, such as AbstractMappingLoaderFactory.__class, JDOMappingLoaderFactory.class, XMLMappingLoaderFactory.class in the org.castor.mapping package. User may have to re-assembly those the jar files such as replacing everything in the package org.castor.mapping in the _castor_-1.3.3-xml.jar with the package org.castor.mapping in the _castor_-1.3.3.jar. I believe this needs to be repackaging and released to users. Regards, --__--__ *Jeff Li , Software Architect* DataStageConnectivity and XML Information Management Phone: (561) 862-3614 E-mail: l...@us.ibm.com mailto:l...@us.ibm.com --__--__- To unsubscribe from this list, please visit: http://xircles.codehaus.org/__manage_email http://xircles.codehaus.org/manage_email - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Maulti wrap elements with location attribute without any extra java classes
Hi, what precisely is your question ? You have attached a lot of artefacts (classes, mapping, ...), but what is your problem ? Kind Regards Werner On 12.02.2014 23:24, Arava, Srinivas wrote: Hi, I have also attached the sample project. Here is sample mapping. ?xmlversion=/1.0/ encoding=/UTF-8/? !DOCTYPEmapping PUBLIC -//EXOLAB/Castor Mapping DTD Version 1.0//EN http://castor.org/mapping.dtd; mapping classname=/com.ussco.wms.domain.model.Person/ verify-constructable=/false/ map-toxml=/SPerson/ / fieldname=/name/ type=/com.ussco.wms.domain.model.Name/ container=/true/ / fieldname=/sportsTag/ type=/string/ bind-xmlname=/Name/ node=/element/ location=/CutomField/ / /field fieldname=/sportsGrade/ type=/string/ bind-xmlname=/Value/ node=/element/ location=/CutomField/ / /field fieldname=/academicTag/ type=/string/ bind-xmlname=/Name/ node=/element/ location=/CutomField/ / /field fieldname=/academicGrade/ type=/string/ bind-xmlname=/Value/ node=/element/ location=/CutomField/ / /field /class classname=/com.ussco.wms.domain.model.Name/ verify-constructable=/false/ fieldname=/prefix/ type=/string/ bind-xmlname=/SPrefix/ node=/element/ / /field fieldname=/first/ type=/string/ bind-xmlname=/SFirstName/ node=/element/ / /field fieldname=/last/ type=/string/ bind-xmlname=/SLastName/ node=/element/ / /field /class /mapping Following is the actual output. ?xml version=1.0 encoding=UTF-8? SPerson SPrefixLord/SPrefix SFirstNameBaba/SFirstName SLastNameSai/SLastName CutomField NameSprots/Name ValueA/Value NameAcademic/Name ValueA/Value /CutomField /SPerson Following is the output I am hoping for, without any additional classes. ?xml version=1.0 encoding=UTF-8? SPerson SPrefixLord/SPrefix SFirstNameBaba/SFirstName SLastNameSai/SLastName CutomField NameSprots/Name ValueA/Value NameAcademic/Name ValueA/Value /CutomField /SPerson Information contained in this e-mail message and in any attachments thereto is confidential. If you are not the intended recipient, please destroy this message, delete any copies held on your systems, notify the sender immediately, and refrain from using or disclosing all or any part of its content to any other person. - 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
Re: [castor-user] How to map the following usecase - Pls assist.
Hi, this is not easy to achieve with a standard mapping approach. It would be a lot easier if you could introduce an additional XML artefact that wraps act and leg instances. Would that be an option ? Kind Regards Werner On 10.10.2013 01:36, Titus Rakkesh wrote: Dear Friends, We have a usecase like the following, population person id=1 employed=no plan selected=yes act type=h6 x=9427476.50229 y=-135180.91624 tel:135180.91624 end_time=06:00:00 / leg mode=car /leg act type=w10 x=9454368.60405 y=-135416.81187 end_time=16:00:00 / leg mode=car /leg act type=h6 x=9427476.50229 y=-135180.91624 tel:135180.91624 / /plan /person person id=10 employed=no plan selected=yes act type=h6 x=9427476.50229 y=-135180.91624 tel:135180.91624 end_time=06:00:00 / leg mode=car /leg act type=w10 x=9454368.60405 y=-135416.81187 end_time=16:00:00 / leg mode=car /leg act type=h6 x=9427476.50229 y=-135180.91624 tel:135180.91624 / /plan /person population Here important points are, 1. Under Plan element, there should be order as act followed by leg followed by act then leg. How we can enforce this order? When I set as ArrayList, all act elements come together? Pls assist. Thanks, Titus - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Source Generation Question
Hi, On 26.09.2013 13:58, Matthew Pontius wrote: Hello, I am trying to generate source for a schema using the Ant task and Castor v1.3.3-rc1 (I have also tried Castor v1.3.2). The schema has an Import, and I have told the ant task not to generate code for the import. I also have a binding file that tries to link an element in a complex type to an already generated class, but this does not seem to work. Please find below the scenario I am talking about Schema I am generating for: ?xml version=1.0 encoding=UTF-8? xsd:schema xmlns=http://www.w3.org/2001/XMLSchema; xmlns:xsd=http://www.w3.org/2001/XMLSchema; targetNamespace=http://www.example.com/digit-service/digit-schema; xmlns:tns=http://www.example.com/digit-service/digit-schema; xmlns:app=http://www.example.com/appian-pas-data-model/ws; elementFormDefault=qualified xsd:import namespace=http://www.example.com/appian-pas-data-model/ws; schemaLocation=appian-policy-change.xsd / xsd:complexType name=SetupPolicyChangeResponse xsd:sequence xsd:element name=policyChangeRequest type=app:PASWS_PolicyChangeRequestType minOccurs=1 maxOccurs=1 / /xsd:sequence /xsd:complexType /xsd:schema Note that the schema appian-policy-change.xsd has already had code generated for it that lives in a jar file on the class path Binding file to tie the policyChangeRequest element to the generated classes: binding xmlns=http://www.castor.org/SourceGenerator/Binding; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; defaultBindingType=type complexTypeBinding name=/complexType:SetupPolicyChangeResponse java-class name=SetupPolicyChangeResponse /java-class elementBinding name=/complexType:SetupPolicyChangeResponse/policyChangeRequest member name=policyChangeRequest java-type=com.example.appian.bean.PolicyChangeRequest/ /elementBinding /complexTypeBinding /binding This does not generate what I would expect, as it creates a java class that has a variable called _policyChangeRequest and its class is com.example.digit.PolicyChangeRequest (which is not actually generated so the code can not compile). I guess the question I have is if it is possible to run the generator and reference a class that has already been generated, if so is my syntax wrong? No, that is not supported. Cheers Werner Thanks, Matt Pontius Senior Consulting Software Engineer Blue Slate Solutions http://www.blueslate.net/ 518.810.0402 W 518.926.0306 C 315.208.4041 H - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Issue with generating schema object
Hi Sherwin, I am not sure whether this is actually allowed by the XML Schema spec, but for the Castor XML source generator, this is currently something which is not supported. Kind Regards Werner On 30.08.2013 22:15, Sherwin wrote: Hi, I have been using castor for the last few months and I am facing an issue with a particular xml schema. Below is the problematic part of the schema schema elementFormDefault=qualified xmlns=http://www.w3.org/2001/XMLSchema; targetNamespace=*urn:sobject.enterprise.soap.sforce.com* *import namespace=urn:enterprise.soap.sforce.com*/ !-- Base sObject (abstract) -- complexType name=sObject sequence element name=fieldsToNull type=xsd:string nillable=true minOccurs=0 maxOccurs=unbounded/ element name=Id type=tns:ID nillable=true / /sequence /complexType …. ….. ….. ….. /schema schema elementFormDefault=qualified xmlns=http://www.w3.org/2001/XMLSchema; targetNamespace=*urn:enterprise.soap.sforce.com* *import namespace=urn:sobject.enterprise.soap.sforce.com*/ !-- Our simple ID Type -- simpleType name=ID restriction base=xsd:string length value=18/ pattern value='[a-zA-Z0-9]{18}'/ /restriction /simpleType ….. …. …. /schema I have highlighted the parts in question. This is an extract from the types part of a salesforce wsdl. As you can see there are two schema elements present in the types part of the wsdl. The issue is that each of them as an import which imports the other. This is where castor fails with the following error _org.exolab.castor.xml.schema.SchemaException_: Unable to resolve Schema corresponding to namespace 'urn:enterprise.soap.sforce.com'. at org.exolab.castor.xml.schema.reader.ImportUnmarshaller.init(_ImportUnmarshaller.java:125_) at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(_SchemaUnmarshaller.java:604_) at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(_Sax2ComponentReader.java:255_) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.exolab.castor.xml.schema.reader.SchemaReader.read(_SchemaReader.java:301_) Thanks, Sherwin - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] lazy mappings always load their data
Hi Justin, On 23.05.2013 20:56, Justin Case wrote: Hello group, I really don't get the idea of lazy loading. From the Castor site I read the following: Per definition, when an instance of Department is loaded through e.g. Database.load(), Castor will not (pre-)load the Employee instance referenced (as such reducing the size pf the initial query as well as the size of the result set returned). Only when the Emplyoee instance is accessed through Department.getEmployee(), Castor will load the actual object into memory from the persistence store. This means that if the Employee instance is not accessed at all, not only will the initial query to load the Department object have had its complexity reduced, but no performance penalty will be incurred for the additional access to the persistence store either. As a consequence, I would have expected that a lazy object if never accessed, will never be loaded into memory. This seems to not be the case. A code like the following: Database db = _jdo.getDatabase(); db.begin(); OQLQuery query = db.getOQLQuery(SELECT product FROM + Product.class.getName() + product WHERE id = $1); query.bind(new Integer(1)); QueryResults results = query.execute(AccessMode.ReadOnly); Product product = (Product) results.next(); db.commit(); db.close(); will load all the lazy mappings from the Product class (1:1 or whatever) during the commit() phase. Am I getting something wrong, or is it by design so? How are you actually observing this behaviour ? I am really having problems to replay such scenario. Thanks Werner Thanks a lot, JC - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] No Introspector defined in properties!
Hi Alvaro, that sounds odd to me. Given that the GET Resource does its job just fine, and that the expected XML is being returned, I don't think the problem actually is with castor in this case. I'd raise a question with the Spring OXM guys at their forum(s), and maybe post a link to the forum entry here so that we can listen in. Regards Werner On 29.05.2013 13:20, Alvaro wrote: Hi all, Im trying to create a simple Spring REST app using SpringOXM and Castor for XML handling. So far so good, the problem is that when sending an XML POST request to create a contact, Castor crashes complaining that: pProblem accessing /contacts. Reason: preServer Error/pre/ph3Caused by:/h3prejava.lang.IllegalStateException: No Introspector defined in properties! The simple xml Im sending looks like: ?xml version=1.0 encoding=UTF-8? contactnameSonoo/namelastNameJaiswal/lastName/contact My mapping.xml: ?xml version=1.0? mapping class name=com.test.model.Contact map-to xml=contact/ field name=name type=string bind-xml name=name node=element/ /field field name=lastName type=string bind-xml name=lastName node=element/ /field /class /mapping The Spring configuration: context:component-scan base-package=com.test / !-- REST service -- bean class=org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter property name=messageConverters util:list id=beanList ref bean=castorMarshallingHttpMessageConverter / /util:list /property /bean bean id=castorMarshallingHttpMessageConverter class=org.springframework.http.converter.xml.MarshallingHttpMessageConverter property name=marshaller ref=castorMarshaller / property name=unmarshaller ref=castorMarshaller / /bean bean id=castorMarshaller class=org.springframework.oxm.castor.CastorMarshaller property name=mappingLocation value=classpath:com/test//model/mapping.xml / /bean And finally the controller looks like: package com.test.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.http.HttpStatus; @Controller @RequestMapping(/contacts) public class ContactsController { @RequestMapping(value=/{name}, method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public Contact getContact(@PathVariable String name) { Contact c = new Contact(); c.setName(name); c.setLastName(test); return c; } @RequestMapping( method = RequestMethod.POST ) @ResponseStatus( HttpStatus.CREATED ) @ResponseBody public Long create( @RequestBody Contact contact ){ System.out.println(Contact + contact.getName()); return 1L; } } As you see its a quick and dirty test to try out Castor and Spring OXM. Actually, a GET request to the getContact method works and the xml is returned, so the mapping.xml is loaded correctly. Do you have any idea why Castor is crashing when unmarshalling the POST request xml?? Thanks in advance, A --20cf302ad6669f206904ddd8f514 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable div dir=3DltrHi all,brdiv class=3Dgmail_quotediv dir=3Dltrdi= vdivdivdivdivdivdivdivdivbr/divIm trying to create a s= imple Spring REST app using SpringOXM and Castor for XML handling. So far s= o good, the problem is that when sending an XML POST request to create a co= ntact, Castor crashes complaining that:br lt;pgt;Problem accessing /contacts. Reason:brlt;pregt;=A0=A0=A0 Serve= r Errorlt;/pregt;lt;/pgt;lt;h3gt;Caused by:lt;/h3gt;lt;pregt;java= .lang.IllegalStateException: No Introspector defined in properties!brbr= /div The simple xml Im sending looks like:brlt;?xml version=3Dquot;1.0quot;= encoding=3Dquot;UTF-8quot;?gt;brlt;contactgt;lt;namegt;Sonoolt;/= namegt;lt;lastNamegt;Jaiswallt;/lastNamegt;lt;/contactgt;brbr/d= iv My mapping.xml:brlt;?xml version=3Dquot;1.0quot;?gt;brlt;mappingg= t;br=A0lt;class name=3Dquot;com.test.model.Contactquot;gt;br=A0=A0= =A0 lt;map-to xml=3Dquot;contactquot;/gt;br=A0=A0=A0 lt;field name= =3Dquot;namequot; type=3Dquot;stringquot;gt;br =A0=A0=A0=A0=A0=A0 lt;bind-xml name=3Dquot;namequot; node=3Dquot;elemen= tquot;/gt;br=A0=A0=A0 lt;/fieldgt;br=A0=A0=A0 lt;field name=3Dquo= t;lastNamequot; type=3Dquot;stringquot;gt;br=A0=A0=A0=A0=A0=A0 lt;bi= nd-xml name=3Dquot;lastNamequot; node=3Dquot;elementquot;/gt;br =A0=A0=A0 lt;/fieldgt;br=A0lt;/classgt;brlt;/mappinggt;brbr/= divThe
Re: [castor-user] Lazy loaded collections not read-only
Thanks, Justin. It looks like all required artefacts are in place, indeed. Werner On 03.05.2013 13:55, Justin Case wrote: Hi all, test case project created as attachment bug3248.zip and attached to JIRA. It uses HSQLDB in memory you only have to start it (it's a Maven project). HOW TO TEST: - Unpack the bug3248.ZIP, - import the existing Maven project, - run the JUnit class TestReadonlyLazyloading, which tests whether the collections are read-only, - notice how the lazily loaded collections fail the read-only test, while the identical regularly loaded are ok. Hope this helps :) S - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Lazy loaded collections not read-only
Hi 'user', mind creating a Jira issue at http://jira.codehaus.org/browsse/CASTOR and attach a fully working test case ? Whilst I have not been maintaining Castor JDO for a long time, I should still have some familiarity with that code area. Kind Regards Werner On 26.04.2013 01:33, d...@bluewin.ch wrote: Hello list, We noticed an unexpected behaviour with Castor 1.3.1 and Castor 1.3.3 RC1. We use lazy loading for collections. When we load an object (the parent object) in read-only method the elements (child objects) in collections for that object are not read-only. That is changes to parent object attributes are not persistent, changes to the child objects attributes are persistent. When we disable the lazy loading for collections the child object are read-only as expected. Is this behaviour actually expected that lazy loaded collections are not read-only even if the parent object is read-only? in pseudo code: ParentPO parentPO = org.exolab.castor.jdo.Database.load (ParentPO.class, id, Database.READONLY); ChildrenPO childrenPO = parentPO.getChildren().iterator().next(); //assuming non empty list parentPO.setParentName(name change); // change is not persistent childrenPO.setChildrenName(name change); // change is persistent I hope the attach gives more detailed information. thanks very much for your attention, best regards Justin Case - 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
Re: [castor-user] Global field handler without mapping file
Hi Howard, right now, such solution does not exist. Can I ask you what you are trying to achieve ? Kind Regards Werner On 19.04.2013 14:02, Mr. Howard Hill wrote: Hi, newbie here Is there a possibility of a global field handler without a castor mapping file, how can this be injected. Regards, Howard - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor XML 1.3.1 marshals null Collections
Hi Marc, can you please open Jira Issues for both problems ? Kind regards Werner On 23.01.2013 16:09, Marc Eyrignoux wrote: Up to now my project used an old version of Castor, like 0.9+, and I am working on a migration to the latest release, ie. 1.3.2 or 1.3.3-RC1. I am facing two problems: -My project runs with a JDK 5, and the releases of Castor 1.3.2 and Castor 1.3.3-RC1 seem to have been built with a JDK 6. Therefore I get errors at runtime, and I had to switch to Castor 1.3.1, which does not have this problem. That should be addressed. And it should not have happened. Anyway, I can live with that, it doesn’t matter much, even if the documentation of Castor states that any version should run properly with a JDK 5. -My true problem is about null Collections: they were NOT marshaled with my old version of Castor. That problem is specific to castor 1.3.1, or applies to e.g. 1.3.3-RC1 as well ? If the latter, please open a Jira issue. Now they are, which causes some regressions in my application. I searched everywhere if there a configuration or a property about that, but didn’t find anything. Is there something to configure somewhere or do I have to correct the regressions one by one ? In order that everything would be clear, here is an example of my problem : I want to marshal the following bean: Public class toto { Private Collection myCollection = null; Private String myString = “test”; Public Collection getMyCollection() { return myCollection; } Public void setMyCollection( Collection p_collection ) { myCollection = p_collection; } Public String getMyString() { return myString; } Public void setMyString( String p_string ) { myString = p_string; } } If “myString” contains “test” and “myCollection” contains null, my old version didn’t put the collection in the XML result: toto myStringtest/myString /toto But now it does : toto myStringtest/myString myCollection/ /toto How to tell Castor 1.3+ not to put “myCollection/” in the XML stream ? Thanks for your help, Marc - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] is this solution acceptable?
Hi, just drop the 'inner' commit() and begin()s, as using one transaction across the complete loop should be just fine. Kind Regards Werner Guttmann On 20.12.2012 00:48, olmec wrote: db.begin(); while ( results.hasMore() ){ product = (model.objects.Product)results.next(); if(product.getUrl() == null) { product.setUrl(product.getCaption()); } if(UrlInUse(product.getUrl()) { product.setUrl(product.getUrl() + product.getProductId()); } db.commit(); db.begin(); } db.commit(); - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Is there exist built-in iteration over generated source in castor ?
Hi, have you ever looked at Castor's source generator, which generates POJOs (+ XML bindings) from your XML schema. Any time your XML schema changes, simply re-generate the Java classes, and you should be set. Kind Regards Werner Guttmann On 15.11.2012 11:17, Yair Rinot wrote: Hi I'm using castor to marshal XML data generated by users and transform it to some proprietary model. During the data processing I need to iterate over the generated source a few times and perform different actions. Since the XML schema is changing along with the generated source, I'd like to know whether there exist any mechanism for iterating the generated source model which I can use to minimize the code changes required when changing the schema ? thanks, Y a i r R i n o t - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Is there exist built-in iteration over generated source in castor ?
Not 100% sure; there was at least a Jira feature request to enhance the descriptors to allow this. Regards Werner On 21.11.2012 15:22, Yair Rinot wrote: I am using Castor's source generator to re-generate POJOs from my XML schema each time the schema changes. My question is whether there exist any mechanism which enable iterating on the entire generated POJO model (I have a single root POJO element which refer to all the model) ? Is there any way (besides reflection) to iterate over all the fields of each generated POJO class using class descriptors or any other mechanism ? thanks, Y a i r R i n o t From: Werner Guttmann wgut...@codehaus.org To: user@castor.codehaus.org, Cc: Yair Rinot/Haifa/IBM@IBMIL Date: 21/11/2012 03:17 PM Subject: Re: [castor-user] Is there exist built-in iteration over generated source in castor ? Hi, have you ever looked at Castor's source generator, which generates POJOs (+ XML bindings) from your XML schema. Any time your XML schema changes, simply re-generate the Java classes, and you should be set. Kind Regards Werner Guttmann On 15.11.2012 11:17, Yair Rinot wrote: Hi I'm using castor to marshal XML data generated by users and transform it to some proprietary model. During the data processing I need to iterate over the generated source a few times and perform different actions. Since the XML schema is changing along with the generated source, I'd like to know whether there exist any mechanism for iterating the generated source model which I can use to minimize the code changes required when changing the schema ? thanks, Y a i r R i n o t - 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
Re: [castor-user] FW: castro 1.2 with Java 7
Hi, I cannot see a reason why that should not work, but having said that, please note that's it's several years ago that I have touched Castor 1.2. I suppose you'll have to try things. Regards Werner On 01.11.2012 16:38, paris strikos wrote: Hello Team, I'm working on a project that uses Casto 1.2 . We are planning a Java 7 and I would like to ask If we can use same vesion or should we upgarde to the latest? Thanks in advance! - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Broken links to castor reference guide
Gerry, the junked HTML reference guide is now available. Regards Werner On 22.10.2012 02:42, Gerry Tan wrote: Dear Castor website admin, Just want to bring into attention that the links to Castor reference guide specified here: http://www.castor.org/reference-guide.html appears to be broken. Can the correct link please be updated so the reference documentation is available. Kind Regards, Gerry Tan - 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
Re: [castor-user] Broken links to castor reference guide
HI Gerry, can you please raise a Jira tciket, and I will fix this asap. Regards Werner On 22.10.2012 02:42, Gerry Tan wrote: Dear Castor website admin, Just want to bring into attention that the links to Castor reference guide specified here: http://www.castor.org/reference-guide.html appears to be broken. Can the correct link please be updated so the reference documentation is available. Kind Regards, Gerry Tan - 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
Re: [castor-user] NullPointer using XMLInstance2Schema
Hi Alejandro, as attachments frequently get stripped off by mailing list servers, can I please ask you to create a new Jira issue at http://jira.codehaus.org/browse/CASTOR and attach all relevant files and/or instructions there ? Kind Regards Werner Guttmann On 11.09.2012 23:17, Alejandro Salas wrote: I'm really sorry, I attached a version of the file which doesn't create any errors. Here is the stripped file that generates the exception. Thanks. *From:* Alejandro Salas krieg...@yahoo.com *To:* user@castor.codehaus.org user@castor.codehaus.org *Sent:* Tuesday, September 11, 2012 1:50 PM *Subject:* Re: [castor-user] NullPointer using XMLInstance2Schema Thank you very much for answering so quickly. I don't know if I have to report it elsewhere. Just in case I'm attaching here a small version of the file containing just one element of each type. And here's the code I'm using to create the schema: XMLInstance2Schema xi2s = new XMLInstance2Schema(); Schema schema = xi2s.createSchema(PATH TO: dummyControl1.xml); Writer writer = new FileWriter(PATH TO: dummyControl1.xsd); xi2s.serializeSchema(writer, schema); writer.close(); Thanks again for your help. Best regards, Alejandro Salas. *From:* Werner Guttmann wgut...@codehaus.org *To:* user@castor.codehaus.org *Cc:* Alejandro Salas krieg...@yahoo.com *Sent:* Tuesday, September 11, 2012 3:13 AM *Subject:* Re: [castor-user] NullPointer using XMLInstance2Schema Hi Alejandro, yes, this looks like a bug. But please do not forget to attach all relevant artefacts required so that we can easily replay your problem. In addition, please strip down the XML files as much as possible. Kind Regards Werner Guttmann On 11.09.2012 07:45, Alejandro Salas wrote: Hello everyone, I'm trying to use XMLInstance2Schema. I followed the code sample from the javadoc but I'm getting a NullPointerException in XMLInstance2SchemaHandler, line 520. I don't know if this is the correct behavior or if this is a bug. Somewhere during the parsing of my xml e1.getType() in line 487 returns null, next there are a couple of ifs, in my case the execution goes to line 493 and 494. The problem is that e1Type is never set to e2Type so it's still null when it arrives at 520. The same thing happens in the if from 507, e2Type is not being set. On both of the else clause (line 496 and 409) the variables are being set. Is this a bug? Should I report it? I attached the xml I'm using. Here's part of the method from XMLInstance2SchemaHandler. 487XMLType e1Type = e1.getType(); 488 XMLType e2Type = e2.getType(); 489 490 //-- Make sure types are not null and if so create them 491 if (e1Type == null) { 492 if (e2Type == null) return; //-- nothing to merge 493if (e2Type.isSimpleType()) { 494 e1.setType(e2Type); 495} 496else { 497 ComplexType cType = new ComplexType(_schema); 498 Group group = new Group(); 499 group.setOrder(_defaultGroupOrder); 500 cType.addGroup(group); 501 e1.setType(cType); 502 e1Type = cType; 503} 504 } 505 else if (e2Type == null) { 506 if (e1Type.isSimpleType()) { 507 e2.setType(e1Type); 508 } 509 else { 510 ComplexType cType = new ComplexType(_schema); 511 Group group = new Group(); 512 group.setOrder(_defaultGroupOrder); 513 cType.addGroup(group); 514 e2.setType(cType); 515 e2Type = cType; 516 } 517 } 518 519 //-- both simple types 520 if (e1Type.isSimpleType() e2Type.isSimpleType()) { Thanks in advance! - 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
Re: [castor-user] NullPointer using XMLInstance2Schema
Hi Alejandro, yes, this looks like a bug. But please do not forget to attach all relevant artefacts required so that we can easily replay your problem. In addition, please strip down the XML files as much as possible. Kind Regards Werner Guttmann On 11.09.2012 07:45, Alejandro Salas wrote: Hello everyone, I'm trying to use XMLInstance2Schema. I followed the code sample from the javadoc but I'm getting a NullPointerException in XMLInstance2SchemaHandler, line 520. I don't know if this is the correct behavior or if this is a bug. Somewhere during the parsing of my xml e1.getType() in line 487 returns null, next there are a couple of ifs, in my case the execution goes to line 493 and 494. The problem is that e1Type is never set to e2Type so it's still null when it arrives at 520. The same thing happens in the if from 507, e2Type is not being set. On both of the else clause (line 496 and 409) the variables are being set. Is this a bug? Should I report it? I attached the xml I'm using. Here's part of the method from XMLInstance2SchemaHandler. 487XMLType e1Type = e1.getType(); 488 XMLType e2Type = e2.getType(); 489 490 //-- Make sure types are not null and if so create them 491 if (e1Type == null) { 492 if (e2Type == null) return; //-- nothing to merge 493if (e2Type.isSimpleType()) { 494 e1.setType(e2Type); 495} 496else { 497 ComplexType cType = new ComplexType(_schema); 498 Group group = new Group(); 499 group.setOrder(_defaultGroupOrder); 500 cType.addGroup(group); 501 e1.setType(cType); 502 e1Type = cType; 503} 504 } 505 else if (e2Type == null) { 506 if (e1Type.isSimpleType()) { 507 e2.setType(e1Type); 508 } 509 else { 510 ComplexType cType = new ComplexType(_schema); 511 Group group = new Group(); 512 group.setOrder(_defaultGroupOrder); 513 cType.addGroup(group); 514 e2.setType(cType); 515 e2Type = cType; 516 } 517 } 518 519 //-- both simple types 520 if (e1Type.isSimpleType() e2Type.isSimpleType()) { Thanks in advance! - 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
Re: [castor-user] Fwd: Problem with unmarshalling if xml file contains information about xsd
Hi, a few observations: * Castor does not perform XML schema validation upon unmarshalling as you'd expect (e.g. using JAXP schema validation). * Castor should still be able to unmarshal your XML. If you really wanted validation upon unmarshalling, please consider using POJOs from your XML schema using Castor's source generator, and you'll get that validation as part of the descriptor classes generated. Kind regards Werner Guttmann On 21.08.2012 11:01, Małgorzata Wolniewicz wrote: -- Wiadomość oryginalna -- Temat: Problem with unmarshalling if xml file contains information about xsd Data: Tue, 21 Aug 2012 10:44:54 +0200 Nadawca:Małgorzata Wolniewicz gos...@man.poznan.pl Odpowiedź-Do: Małgorzata Wolniewicz gos...@man.poznan.pl Firma/Organizacja: Poznań Supercomputing and Networking Center Adresat:user@castor.codehaus.org Dear Castor users, I have encountered problem, which seems to be trivial, anyway I have no idea how to solve it. I created the simplest example I could. I want to have an xml file, based on rules defined by my xsd schema, and a java client which will perform unmarshalling. My client works if the xml looks as follows: ?xml version=1.0 encoding=UTF-8? person pesel=12345 firstnameGosia/firstname lastnameWolniewicz/lastname addressMy address/address children child data name=Kid1 age=8.0/ /child child data name=Kid2 age=4.5/ /child /children /person But I would like to include in my xml information which xsd defines it, but when I add it my client stops working. It does not crash, but data is not unmarshalled properly. My object has empty fields. With schema information begin of my xml looks like: ?xml version=1.0 encoding=UTF-8? person pesel=12345 xmlns=http://www.example.org/Person; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.example.org/Person Person.xsd ... I enclose my xml (with and without the header), my client and my xsd. I would be grateful if anyone could suggest how to solve the problem. Best regards, Gosia Wolniewicz -- Małgorzata Wolniewicz Poznań Supercomputing and Networking Center Scientific Applications Department email:gos...@man.poznan.pl www:http://www.man.poznan.pl skype: gosiawolniewicz tel. +48 61 858-21-74 - 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
Re: [castor-user] How to map a collection within a nested tag?
Hi John, ignoring that your clas mappings below do not define map-to / directives, the field mapping for Cart's itemsList property should be as follows: field name=itemsList collection=arraylist type=Item bind-xml name=item location=foo/items-list / /field This should do it. Regards Werner On 04.07.2012 07:38, John Turner wrote: I have a problem similar to that addressed by the 'How to map a collection of elements' (http://www.castor.org/how-to-map-a-collection.html). I need to un-marshal an XML document that contains a collection. The tag at the collection level is inside another nested tag. My input XML is: cart foo items-list item count=1broccoli/item item count=4orange/item /items-list /foo /cart I have tried this mapping (and others!): mapping class name=Cart auto-complete=true field name=itemsList collection=arraylist type=Item container=false bind-xml name=items-list location=foo / /field /class class name=Item field name=Name type=java.lang.String bind-xml name=item node=text / /field field name=Count type=java.lang.Integer bind-xml name=count node=attribute / /field /class /mapping I get this error message: Unable to find FieldDescriptor for 'foo' in ClassDescriptor of cart. The Cart and Item classes are as per the how-to referenced above. Please can somebody suggest a mapping that accommodates the foo tag? (Note: my XML is coming from a legacy system and cannot be altered). Thanks, John - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] [upgrade 0.9.x - 1.3.2] unmarshalling fails
Hi Thomas, can I kindly to ask you to try things against the RC of Castor 1.3.3, where a few regression issues have been fixed that are in the context of the *ElementProcessor classes. If that does not improve things, we will have to look into this in more detail. Kind Regards Werner On 22.06.2012 10:02, Papendieck, Thomas wrote: Hello, my application used castor-xml 0.9.x for a long time. I decided t upgrade to 1.3.2. So I regenerated my castor-classes with castor-xml-codegen-1.3.2 and Java-7 and added the castor-xml-1.3.2 jars to my projekt. This is the DOS-CMD-line used to generate the castor classes: %JDK_HOME%\bin\java -classpath %CP% org.exolab.castor.builder.SourceGenerator -i %DTD_DIR%\%INTERFACE_NAME%.xsd -package %JAVA_PACKAGE% -dest generated_sources/%INTERFACE_NAME% As you ca see it's used for more than one project. This one is the first to be upgraded. That's why I'd like to keep the old generator call untill I know the new version workes well... Unfortunately the unmarshaller does not create object tree as expected. I get the an empty ParadIni object. No exception is thrown. Castor logs some warnings: 22.Jun.2012 09:25:18 [WARN ] StartElementProcessor:StartElementProcessor.compute(): Unable to find FieldDescriptor for 'Used_Interface_Flag' in ClassDescriptor of null. 22.Jun.2012 09:25:18 [INFO ] EndElementProcessor:EndElementProcessor.compute(): Ignoring Used_Interface_Flag no descriptor was found 22.Jun.2012 09:25:18 [WARN ] StartElementProcessor:StartElementProcessor.compute(): Unable to find FieldDescriptor for 'Bootloader_Path_Table' in ClassDescriptor of null. 22.Jun.2012 09:25:18 [INFO ] EndElementProcessor:EndElementProcessor.compute(): Ignoring Bootloader_Path_Table no descriptor was found ... I attached the DTD, a valid XML and a jar containig the generated classes. the Line to unmarshall is this: Reader reader = new FileReader(_fileName); ParadIni paradIni = (ParadIni) Unmarshaller.unmarshal(ParadIni.class, reader); What am I doing wrong? How can I bring castor-xml-1.3.2 to work? bye Thomas - 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
Re: AW: [castor-user] [upgrade 0.9.x - 1.3.2] unmarshalling fails
Hi, in that case I'd like to see a test case that provides us with a minimal set of XML schema definitions and XML documents to replay the problem, and have them attached to a Jira issue. Please note the term *minimal* above. Kind Regards Werner On 22.06.2012 11:10, Papendieck, Thomas wrote: Hello Werner, I recreated my castor classes using 1.3.3-rc1 and changed my classpath to use 1.3.3-rc1 jars. The logging has been turned off but the unmarshalling still does not work. Bye Thomas - 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
Re: [castor-user] Unmarshalling sequence with optional elements
Hi, assuming that you are using Castor's code generator to generate Java code from the XML schema definitions (correct me if I am wrong here), you'll get a batch of Java POJOs that more or less mirror the structures defined in your schema. Given that you've got some complexity in there (uses of choices and sequences and a mix thereof); I'd suggest that you keep things separated from your domain model. If the XML schema was e.g. part of a WADL definition, specifying the payload of various REST resources, I'd treat the generated Java classes as DTOs only, and internally map them to a model POJO that I'd use (amongst other things) to persist to a database using Hibernate. Given that there's always a gap between e.g. the XML schema specification and your requirements with regards to persistence (domain model in general), I am always in favour of keeping things apart and live with the minor overhead of having to convert/map between DTOs and domain classes. Does this make sense ? Kind Regards Werner On 18.06.2012 16:45, rednix wrote: Hi, I'm struggling with a mapping/unmarshalling of a XML which contains a sequence with an optional element. Here is the XSD part for the list: xs:element name=relations maxOccurs=1 minOccurs=0 type=relationsType /xs:element xs:complexType name=relationsType xs:annotation xs:documentation xml:lang=enEither a set of a lead project and a lead-sourcing scope or a set of cosourced projects with an optional sourcing scope./xs:documentation /xs:annotation xs:choice minOccurs=1 maxOccurs=1 xs:sequence minOccurs=1 maxOccurs=1 xs:element name=leadProject type=projectType minOccurs=1 maxOccurs=1/ xs:element name=leadSs maxOccurs=1 minOccurs=1 type=ssRefType/ /xs:sequence xs:sequence maxOccurs=500 minOccurs=1 xs:element name=coProject maxOccurs=1 minOccurs=1 type=projectType xs:annotation xs:documentation xml:lang=enCoProject (short for co-sourced project) names and identifies a co-sourced project./xs:documentation /xs:annotation /xs:element xs:element name=coSs maxOccurs=1 minOccurs=0 type=ssRefType /xs:element /xs:sequence /xs:choice /xs:complexType The element coSs is optional and may occur 0 or 1 times. Here is a snippet of the corresponding XML: sourcingScope relations coProject name=gt;project quot;fullquot; namelt; short=project short name id=PROJ_ID/ coSs number=9876-12 id=54987321/ coProject name=blubberbla short=blubberbla short name id=blubber_bla/ coProject name=CoSourced01Vu short=MVP 02 w/ VU id=PROJ_ID_01/ coSs number=-99 id=12345678/ /relations /sourcingScope I want coProject and coSs be coupled together on the Java side in one object in the list. The coupling is defined by the order of the elements. So the first obj in the list would have PROJ_ID and 54987321; second only blubber_bla without a coSs info and the third processed like the 1st one. The thing with the lead choice is an additional case (then there are no co-elements and exactly two lead elements). The Java list element (which is actually a hibernate domain object) looks like this: public class VuRelation implements java.io.Serializable { private Long id; // internal id private SourcingScope sourcingScope; // ref to parent // set for lead-sourcing private String leadVuId; private String leadVuNr; private String leadProjectId; private String leadProjectShortName; private String leadProjectName; // set for co-sourcing private String coVuId; private String coVuNr; private String coProjectId; private String coProjectShortName; private String coProjectName; ... and linked in the main object like this: public class SourcingScope implements java.io.Serializable { private SetVuRelation relations = new HashSetVuRelation(); } How should the castor mapping look like for this case? How can I tell castor to encapsulate certain elements on the same hierarchy xml level into one object (combined with optional elements)? Any help is appreciated! - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Problem reading namespace (newbie)
Hi Curt, please do not try to map 'attributes' such as 'xmlns:xsi' or 'xsi:schemaLocation', as those are handled by Castor internally (and completely automatically). As those are mainly namespace definitions, please leave this to Castor XML to handle. Once you remove those from your mapping, you should be fine. Kind regards Werner PS If you don't use a prefix for a namespace (please see your default namespace definition), there's no need to specify a prefix. So map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; ns-prefix=/ could and should be shortened to map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; / On 11.06.2012 22:16, crazykz wrote: Hi, I'm trying to read in a GPX file and the header looks like this: gpx version=1.0 creator=GPSBabel - http://www.gpsbabel.org; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://www.topografix.com/GPX/1/0; xsi:schemaLocation=http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd; I've created the mapping and up until now have excluded everything in the GPX header to get the mapping correct. Now I'm trying to add in the 5 attributes of the GPX header that are here and I'm getting an error. I'm sure it's because I don't know how to configure the mapping with the proper namespace prefix or something like that. Here's the relevant mapping part: class name=parser.GPX map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; ns-prefix=/ field name=version type=java.lang.String bind-xml name=version node=attribute / /field field name=creator type=java.lang.String bind-xml name=creator node=attribute / /field field name=xmlnsXsi type=java.lang.String bind-xml name=xmlns:xsi node=attribute / /field field name=xmnls type=java.lang.Stringuert, bind-xml name=xmnls node=attribute / /field field name=xsiSchemaLocation type=java.lang.String bind-xml name=xsi:schemaLocation node=attribute / /field /class Here's the error output I'm getting: org.exolab.castor.xml.MarshalException: The namespace associated with the prefix: 'xmlns' is null.{File: file: GPXMapping.xml; line: 17; column: 50} Would anyone be able to help me with how to properly map this if that is the issue? Thanks, Curt - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] An immediate fix required on CASTOR-3222
Hi John, I suppose you have seen my comments at http://jira.codehaus.org/browse/CASTOR-3222 ? Regards Werner On 07.06.2012 19:40, J p wrote: Hi Werner, As i am working on a hot project, i need an immediate response on the bug http://jira.codehaus.org/browse/CASTOR-3222. then only i can go further with my work. Please do the needful help on this issue Thanks, John - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Problem reading namespace (newbie)
Hi, no worries .. ;-). On 12.06.2012 13:58, crazykz wrote: Hi Werner, Thanks. I'm just starting to learn all of the ins and outs of XML schemas, etc. and I didn't know what Castor is doing for me and what I need to do. I'm reading in a file that is generated by another program so I just needed to make sure I cover as much of it as possible. I know that when I write out the file Castor is not writing out the two attributes you mentioned. I guess if I don't need them I'll just leave that piece alone. Just curious if there's a way to tell Castor to print those out? If you are talking about the schemaLocation attribute, have a look at http://www.castor.org/javadoc/org/exolab/castor/xml/Marshaller.html#setSchemaLocation(java.lang.String) That should do the trick. Kind regards Werner Thanks for the help. Curt Werner Guttmann-6 wrote: Hi Curt, please do not try to map 'attributes' such as 'xmlns:xsi' or 'xsi:schemaLocation', as those are handled by Castor internally (and completely automatically). As those are mainly namespace definitions, please leave this to Castor XML to handle. Once you remove those from your mapping, you should be fine. Kind regards Werner PS If you don't use a prefix for a namespace (please see your default namespace definition), there's no need to specify a prefix. So map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; ns-prefix=/ could and should be shortened to map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; / On 11.06.2012 22:16, crazykz wrote: Hi, I'm trying to read in a GPX file and the header looks like this: gpx version=1.0 creator=GPSBabel - http://www.gpsbabel.org; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://www.topografix.com/GPX/1/0; xsi:schemaLocation=http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd; I've created the mapping and up until now have excluded everything in the GPX header to get the mapping correct. Now I'm trying to add in the 5 attributes of the GPX header that are here and I'm getting an error. I'm sure it's because I don't know how to configure the mapping with the proper namespace prefix or something like that. Here's the relevant mapping part: class name=parser.GPX map-to xml=gpx ns-uri=http://www.topografix.com/GPX/1/0; ns-prefix=/ field name=version type=java.lang.String bind-xml name=version node=attribute / /field field name=creator type=java.lang.String bind-xml name=creator node=attribute / /field field name=xmlnsXsi type=java.lang.String bind-xml name=xmlns:xsi node=attribute / /field field name=xmnls type=java.lang.Stringuert, bind-xml name=xmnls node=attribute / /field field name=xsiSchemaLocation type=java.lang.String bind-xml name=xsi:schemaLocation node=attribute / /field /class Here's the error output I'm getting: org.exolab.castor.xml.MarshalException: The namespace associated with the prefix: 'xmlns' is null.{File: file: GPXMapping.xml; line: 17; column: 50} Would anyone be able to help me with how to properly map this if that is the issue? Thanks, Curt - 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
[castor-dev] Re: [castor-user] An immediate fix required on CASTOR-3222
Hi John, first you tell people on the user list to use other products because Castor does not meed your expectations, now you are asking for an immediate fix ? Let me clarify a few things: * This is an open source project. * As such, feel free to contribute as much as you want or can ? * If you supply me with a patch for the issue in question, I am more than happy to assess it and commit it (if possible). * Otherwise, please consider taking up professional services if you really need urgent help. Kind Regards Werner Guttmann On 07.06.2012 19:40, J p wrote: Hi Werner, As i am working on a hot project, i need an immediate response on the bug http://jira.codehaus.org/browse/CASTOR-3222. then only i can go further with my work. Please do the needful help on this issue Thanks, John - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Not able to generate mapping files using MappingTool
Hi, can you please raise a new ticket at Jira (http://jira.codehaus.org/browse/CASTOR), and attach the class that causes problems during creation of the mapping files. Please try to keep things at a minimum in general, as it will help us to track down the problem. Kind Regards Werner On 30.05.2012 15:20, rednix wrote: I'm getting the same error. Would be nice if someone can have a look at this issue. Sarry wrote: I tried every single approach and every single 3rd party tool available to generate the mapping files, but I am not able to generate them. I also tried with the code given in example and made sure that the class is present in the classpath, but still getting the same error. Here is the code that I got from samples: /* * Created on Aug 11, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.exolab.castor.tools.MappingTool; import org.exolab.castor.xml.XMLContext; import com.rac.sims.domain.Person; /** * * generate a Castor mapping file ready for editing */ public class CastorMapper { private MappingTool tool = null; private static Log log = LogFactory.getFactory().getInstance( CastorMapper.class); private static final String OUTPUT_FILE = product-mapping.xml; public CastorMapper() { try { tool = new XMLContext().createMappingTool(); } catch (Exception e) { log.error(e.getClass().getName(), e); } } public void createMapping(Class[] someClasses, String outputFile) { try { for (int i = 0; i someClasses.length; i++) { tool.addClass(someClasses[i]); } File file = new File(outputFile); log.debug(Output will has been created at + file.getAbsolutePath()); OutputStream stream = new FileOutputStream(file); Writer writer = new OutputStreamWriter(stream); tool.write(writer); writer.close(); } catch (Exception e) { log.error(e.getClass().getName(), e); } } public void createMapping(String aClass, String outputFile) { try { tool.addClass(aClass); File file = new File(outputFile); log.debug(Output will has been created at + file.getAbsolutePath()); OutputStream stream = new FileOutputStream(file); Writer writer = new OutputStreamWriter(stream); tool.write(writer); writer.close(); } catch (Exception e) { log.error(e.getClass().getName(), e); } } public static void main(String[] args) { CastorMapper mapper = new CastorMapper(); mapper.createMapping(Person.class.getName(), OUTPUT_FILE); } } Here is the error I am getting: 16:42:13 AbstractProperties [DEBUG] Properties loaded from classpath: /org/castor/core/castor.core.properties 16:42:13 AbstractProperties [DEBUG] Properties loaded from classpath: /org/castor/xml/castor.xml.properties 16:42:13 XMLClassDescriptorResolverImpl$DescriptorCacheImpl [DEBUG] New instance! 16:42:13 XMLContext [DEBUG] Creating new MappingTool instance. 16:42:13 XMLClassDescriptorResolverImpl$DescriptorCacheImpl [DEBUG] Get descriptor for: com.rac.sims.domain.Person found: null 16:42:13 XMLClassDescriptorResolverImpl$DescriptorCacheImpl [DEBUG] Get descriptor for: com.rac.sims.domain.Person found: null 16:42:13 CastorXMLStrategy [DEBUG] Setting property: org.exolab.castor.xml.util.ResolverStrategy.LoadPackageMappings to value: true 16:42:13 CastorXMLStrategy [DEBUG] Setting property: org.exolab.castor.xml.util.ResolverStrategy.useIntrospection to value: true 16:42:13 CastorXMLStrategy [DEBUG] Setting property: org.exolab.castor.xml.util.ResolverStrategy.MappingLoader to value: null 16:42:13 CastorXMLStrategy [DEBUG] Setting property: org.exolab.castor.xml.util.ResolverStrategy.Introspector to value: org.exolab.castor.xml.Introspector@80fa6f 16:42:13 CastorXMLStrategy [DEBUG] Setting property: org.exolab.castor.xml.util.ResolverStrategy.ClassLoader to value: sun.misc.Launcher$AppClassLoader@1ba34f2
Re: [castor-user] xsi:type and hierarchy definition
Hi, if that's your opinion, feel free to have it. But maybe you'd rather read up on a tool you are about to use *before* asking questions in the future. Asking questions is one thing, asking educated questions something completely different. Kind regards Werner On 30.05.2012 02:30, J p wrote: Hello Boss, castor is not that much good as JAXB, You can't everything in castor. if something is making a trouble better move to some other marshalling framework like JAXB, JiBx, XMLBeans...etc here we wont any support. i sent a lot of email to user@castor.codehaus.org mailto:user@castor.codehaus.org but nobody respond properly Actually i didn't any respond from them. i am still waiting for my previous post. Better switch to better framework. Thanks On Tue, May 29, 2012 at 11:32 PM, drowelbuod drowelb...@gmail.com mailto:drowelb...@gmail.com wrote: Hello. I want to marshal an object to an XML with Castor. To do so, I used the castor XML conversor to generate the Java classes from the XSD files. When I marshal an object using the generated classes I get an XML. But there is problem in the XML generated when the xsi:type is required to reference a subclass, because I don't get the reference to the namespace defined in the XSD of the subclass. So I get: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=getUser ... But I would like to obtain something like: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=bn:getUser ... Or something like: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=B:getUser ... With this definition of XSD files used: File A.xsd ... xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:an=http://www.mydefinition.com/A; targetNamespace=http://www.mydefinition.com/A; elementFormDefault=qualified ... xsd:complexType name=bodyContentType/ ... File B.xsd xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:an=http://www.mydefinition.com/A; xmlns:bn=http://www.mydefinition.com/B; targetNamespace=http://www.mydefinition.com/B; elementFormDefault=qualified xsd:import namespace=http://www.mydefinition.com/A; schemaLocation=./A.xsd/ ... xsd:complexType name=getUser xsd:complexContent xsd:extension base=an:bodyContentType xsd:sequence xsd:element name=webExId type=xsd:string/ /xsd:sequence /xsd:extension /xsd:complexContent /xsd:complexType ... The XML conversor of Castor doesn't add the namespace information to generate it. How can force to add this information in the generation? May be I need change something in the XSD files? Thanks in advance. -- View this message in context: http://old.nabble.com/xsi%3Atype-and-hierarchy-definition-tp33926856p33926856.html Sent from the Castor - User mailing list archive at Nabble.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
Re: [castor-user] xsi:type and hierarchy definition
Hi, if that's your opinion, feel free to have it. But maybe you'd rather read up on a tool you are about to use *before* asking questions in the future. Asking questions is one thing, asking educated questions something completely different. Kind regards Werner On 30.05.2012 02:30, J p wrote: Hello Boss, castor is not that much good as JAXB, You can't everything in castor. if something is making a trouble better move to some other marshalling framework like JAXB, JiBx, XMLBeans...etc here we wont any support. i sent a lot of email to user@castor.codehaus.org mailto:user@castor.codehaus.org but nobody respond properly Actually i didn't any respond from them. i am still waiting for my previous post. Better switch to better framework. Thanks On Tue, May 29, 2012 at 11:32 PM, drowelbuod drowelb...@gmail.com mailto:drowelb...@gmail.com wrote: Hello. I want to marshal an object to an XML with Castor. To do so, I used the castor XML conversor to generate the Java classes from the XSD files. When I marshal an object using the generated classes I get an XML. But there is problem in the XML generated when the xsi:type is required to reference a subclass, because I don't get the reference to the namespace defined in the XSD of the subclass. So I get: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=getUser ... But I would like to obtain something like: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=bn:getUser ... Or something like: ... bodyContent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:type=B:getUser ... With this definition of XSD files used: File A.xsd ... xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:an=http://www.mydefinition.com/A; targetNamespace=http://www.mydefinition.com/A; elementFormDefault=qualified ... xsd:complexType name=bodyContentType/ ... File B.xsd xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:an=http://www.mydefinition.com/A; xmlns:bn=http://www.mydefinition.com/B; targetNamespace=http://www.mydefinition.com/B; elementFormDefault=qualified xsd:import namespace=http://www.mydefinition.com/A; schemaLocation=./A.xsd/ ... xsd:complexType name=getUser xsd:complexContent xsd:extension base=an:bodyContentType xsd:sequence xsd:element name=webExId type=xsd:string/ /xsd:sequence /xsd:extension /xsd:complexContent /xsd:complexType ... The XML conversor of Castor doesn't add the namespace information to generate it. How can force to add this information in the generation? May be I need change something in the XSD files? Thanks in advance. -- View this message in context: http://old.nabble.com/xsi%3Atype-and-hierarchy-definition-tp33926856p33926856.html Sent from the Castor - User mailing list archive at Nabble.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
Re: [castor-user] Castor newbie: Codegen for CityGML fails ...
Thanks, Peter. Werner On 05.06.2012 12:56, Peter Follo wrote: Yes I have looked into the naming collisions, but I'm new to castor and it is fairly complex so don't take my word for it. I will file a bugreport, trying to narrow it down a bit. This will also include the bindings file. Regards, Peter On 06/04/2012 12:40 PM, Werner Guttmann wrote: Hi Peter, I'd need to look into this in more detail. Can I ask you to create a Jira issue and attach an absolute minimalistic XML schema set that allows me to replay your problem. Please refrain from attaching all XML schemas, as I am not in a position to cross-check things when there's literally hundreds of entities generated. Kind Regards Werner PS Can I take it that you have read up on naming collisions with Castor's code generator ? On 28.05.2012 13:34, Peter Follo wrote: I'm trying to generate code for CityGML version 1.0 with the following command: $ java org.exolab.castor.builder.SourceGeneratorMain -verbose -dest src -binding-file binding.xml -generateImportedSchemas -is http://schemas.opengis.net/citygml/profiles/base/1.0/CityGML.xsd and it fails with the following warning and a null pointer exception: $ - Imported XML Schemas will be processed automatically. $ May 28, 2012 1:02:30 PM org.exolab.castor.xml.schema.SimpleTypesFactory createUserSimpleType $ WARNING: Error: could not find the built in parent type for: MeasureOrNullListType I have tried this with version 1.2, 1.3 and a subversion checkout from 20120528 with the same output. I have narrowed it down to the included xml schema http://schemas.opengis.net/gml/3.1.1/base/valueObjects.xsd which gives the following stack trace: $ -- Imported XML Schemas will be processed automatically. $ May 28, 2012 1:09:10 PM org.exolab.castor.xml.schema.SimpleTypesFactory createUserSimpleType $ WARNING: Error: could not find the built in parent type for: MeasureOrNullListType $ java.lang.NullPointerException $ at org.exolab.castor.xml.schema.reader.SimpleTypeDefinition.createSimpleType(SimpleTypeDefinition.java:141) $ at org.exolab.castor.xml.schema.reader.SimpleContentRestrictionUnmarshaller.finish(SimpleContentRestrictionUnmarshaller.java:415) $ at org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.endElement(SimpleContentUnmarshaller.java:224) $ at org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.endElement(ComplexTypeUnmarshaller.java:466) $ at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:666) $ at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:202) $ at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:598) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1741) $ at $ com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) $ at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835) $ at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) $ at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) $ at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210) $ at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568) $ at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:676) $ at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:334) The type MeasureOrNullListType is defined in http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd which is included in the schema above. Generating sources from basicTypes.xsd gives the following output without errors but with some warnings: $ -- Imported XML Schemas will be processed automatically. $ Creating classes for: MeasureListType $ Creating classes for: MeasureOrNullListType $ Creating classes for: CodeOrNullListType $ Creating classes for: CodeListType $ May 28, 2012 1:13:33 PM org.exolab.castor.builder.TypeConversion convertType $ WARNING: Warning: The W3C datatype 'NameList' is not currently supported by Castor Source Generator. $ May 28, 2012 1:13:33 PM org.exolab.castor.builder.TypeConversion convertType $ WARNING: Warning: The W3C datatype 'Name' is not currently supported by Castor Source Generator. $ Creating classes for: CoordinatesType $ Creating classes for: CodeType $ Creating classes for: MeasureType $ added manifest $ adding: src/se/foi/CityGML10/CodeListType.class(in = 1361) (out= 737)(deflated 45%) $ adding: src
Re: [castor-dev] XML Validation with its XSD Schema when marshalling and unmarshalling
Hi, On 28.05.2012 02:54, J p wrote: Hi Werner, i neeed to validate pojo xml ( not mapping xml ) with its xsd when marshalling and unmarshalling with castor. How can i validate xml with xsd on castor? Why don't you generate java sources from the XML schema, and rely on Castor and its generated descriptor/validator code for validation ? Kind Regards Werner am working on this since last last week. below is xml and xsd files. Book.xml : ?xml version=1.0 encoding=UTF-8? books xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:NamespaceSchemaLocation='books.xsd' book id=bk001 authorWriter/author titleThe First Book/title genreFiction/genre price44.95/price pub_date2000-10-01/pub_date reviewAn amazing story of nothing./review /book book id=bk002 authorPoet/author titleThe Poet's First Poem/title genrePoem/genre price24.95/price reviewLeast poetic poems./review /book /books XSD : ?xml version=1.0 encoding=UTF-8? xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema; targetNamespace=urn:books xmlns:bks=urn:books xsd:element name=books type=bks:BooksForm/ xsd:complexType name=BooksForm xsd:sequence xsd:element name=book type=bks:BookForm minOccurs=0 maxOccurs=unbounded/ /xsd:sequence /xsd:complexType xsd:complexType name=BookForm xsd:sequence xsd:element name=author type=xsd:string/ xsd:element name=titletype=xsd:string/ xsd:element name=genretype=xsd:string/ xsd:element name=pricetype=xsd:float / xsd:element name=pub_date type=xsd:date / xsd:element name=review type=xsd:string/ /xsd:sequence xsd:attribute name=id type=xsd:string/ /xsd:complexType /xsd:schema Thanks, John - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor newbie: Codegen for CityGML fails ...
Hi Peter, I'd need to look into this in more detail. Can I ask you to create a Jira issue and attach an absolute minimalistic XML schema set that allows me to replay your problem. Please refrain from attaching all XML schemas, as I am not in a position to cross-check things when there's literally hundreds of entities generated. Kind Regards Werner PS Can I take it that you have read up on naming collisions with Castor's code generator ? On 28.05.2012 13:34, Peter Follo wrote: I'm trying to generate code for CityGML version 1.0 with the following command: $ java org.exolab.castor.builder.SourceGeneratorMain -verbose -dest src -binding-file binding.xml -generateImportedSchemas -is http://schemas.opengis.net/citygml/profiles/base/1.0/CityGML.xsd and it fails with the following warning and a null pointer exception: $ - Imported XML Schemas will be processed automatically. $ May 28, 2012 1:02:30 PM org.exolab.castor.xml.schema.SimpleTypesFactory createUserSimpleType $ WARNING: Error: could not find the built in parent type for: MeasureOrNullListType I have tried this with version 1.2, 1.3 and a subversion checkout from 20120528 with the same output. I have narrowed it down to the included xml schema http://schemas.opengis.net/gml/3.1.1/base/valueObjects.xsd which gives the following stack trace: $ -- Imported XML Schemas will be processed automatically. $ May 28, 2012 1:09:10 PM org.exolab.castor.xml.schema.SimpleTypesFactory createUserSimpleType $ WARNING: Error: could not find the built in parent type for: MeasureOrNullListType $ java.lang.NullPointerException $ at org.exolab.castor.xml.schema.reader.SimpleTypeDefinition.createSimpleType(SimpleTypeDefinition.java:141) $ at org.exolab.castor.xml.schema.reader.SimpleContentRestrictionUnmarshaller.finish(SimpleContentRestrictionUnmarshaller.java:415) $ at org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.endElement(SimpleContentUnmarshaller.java:224) $ at org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.endElement(ComplexTypeUnmarshaller.java:466) $ at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:666) $ at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:202) $ at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:598) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1741) $ at $ com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607) $ at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) $ at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835) $ at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) $ at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) $ at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210) $ at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568) $ at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:676) $ at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:334) The type MeasureOrNullListType is defined in http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd which is included in the schema above. Generating sources from basicTypes.xsd gives the following output without errors but with some warnings: $ -- Imported XML Schemas will be processed automatically. $ Creating classes for: MeasureListType $ Creating classes for: MeasureOrNullListType $ Creating classes for: CodeOrNullListType $ Creating classes for: CodeListType $ May 28, 2012 1:13:33 PM org.exolab.castor.builder.TypeConversion convertType $ WARNING: Warning: The W3C datatype 'NameList' is not currently supported by Castor Source Generator. $ May 28, 2012 1:13:33 PM org.exolab.castor.builder.TypeConversion convertType $ WARNING: Warning: The W3C datatype 'Name' is not currently supported by Castor Source Generator. $ Creating classes for: CoordinatesType $ Creating classes for: CodeType $ Creating classes for: MeasureType $ added manifest $ adding: src/se/foi/CityGML10/CodeListType.class(in = 1361) (out= 737)(deflated 45%) $ adding: src/se/foi/CityGML10/CodeOrNullListType.class(in = 1297) (out= 728)(deflated 43%) $ adding: src/se/foi/CityGML10/CodeType.class(in = 1277) (out= 719)(deflated 43%) $ adding: src/se/foi/CityGML10/CoordinatesType.class(in = 1686) (out= 881)(deflated 47%) $ adding: src/se/foi/CityGML10/MeasureListType.class(in = 1516) (out= 839)(deflated 44%) $ adding:
[castor-dev] Re: [castor-user] namespace issue
Hi, On 29.05.2012 02:57, J p wrote: Marshaller marshaller = context.createMarshaller(); marshaller.setMapping(mapping); marshaller.setWriter(writer); marshaller.setNamespaceMapping(,http://www.books.com/120;); marshaller.setSuppressNamespaces(true); the xml generated by castor is not formatting properly if i give suppress namespace as true. Below is the xml which is being genererated, schemaLocation should have an xsi prefix ex: xsi:shemaLocation. Generated xml by castor; books xmlns=http://www.books.com/120; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; schemaLocation=http://www.books.com/120 books.xsd book price value1000/value /price /book /books I am not sure whether this is a bug or not, but can you please create a Jira issue for this (setSuppressNamespaces(true) and no xsi:prefix. I will have to look into this. the unwanted ns1 is generating if i give suppress namespace as false. but it generates xsi prefix for shemaLocation, Marshaller marshaller = context.createMarshaller(); marshaller.setMapping(mapping); marshaller.setWriter(writer); marshaller.setNamespaceMapping(,http://www.books.com/120;); marshaller.setSuppressNamespaces(false); books xmlns=http://www.books.com/120; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation=http://www.books.com/120 books.xsd book price ns1:value xmlns:ns1=http://castor.exolab.org/;11/ns1:value /price /book /books i dont want to have above ns1... in the xml. what should i do for that? What does your mapping for book llok like ? Kind Regards Werner Thanks - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] [castor-dev] Unmarshalling with different namespaces
Hi, as already mentioned, please make sure that all your classes are mapped to a valid namespace. It's actually the namespace (and its URI) that is more important in a Castor mapping than the prefices. So class name=entity.output.CalculatorBw map-to xml=field1 ns-prefix=/ should read class name=entity.output.CalculatorBw map-to xml=field1 ns-uri=http://www.example.org/example; / ... /class and only then Castor will know that field1{http://www.example.org/example} is mapped against the Java class CalculatorBw. Kind Regards Werner On 16.05.2012 10:06, AJO wrote: This doesn't solve my issue. I don't have a problem with the clc-prefixed elements, they are unmarshalled correctly, only with the default namespace elements (ID, year, quarter, amount). Werner Guttmann-6 wrote: Hi, switching this conversation to the user list, as that's where it should take place. For answers to your questions, please see inline. Kind Regards Werner On 15.05.2012 18:20, AJO wrote: Hi, I can't get unmarshalling to work with a combination of default namespace and specific namespace. The passed xml is the following: ?xml version=1.0 encoding=UTF-8 standalone=no? clc:CalculationOutput xmlns:clc=http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement; xmlns=http://www.example.org/example; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; clc:RuntimeConfiguration id=ID:a6db6635 name=runtime1 version=0.3/ clc:Calculation field1 ref=S442 Features ID28/ID year2011/year quarter1/quarter amount216187.23/amount /Features /field1 /clc:Calculation /clc:CalculationOutput I can only get the above xml to get unmarshalled by adding xmlns= to the ID, year, quarter and amount fields, so it seems the default schema is never taken into account. How can I get the above mapped in castor, taking into account the default schema? This is the mapping file working when I add xmlns= to the detail fields: ?xml version=1.0? !DOCTYPE mapping PUBLIC -//EXOLAB/Castor Mapping DTD Version 1.0//EN http://castor.org/mapping.dtd; !--mapping xmlns:clc=http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement; xmlns=http://www.example.org/field1; xsi:schemaLocation=C:/resources/schema/schemalocation.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance-- mapping class name=entity.CalculationOutput map-to xml=CalculationOutput ns-prefix=clc/ You still need to define the namespace URI to which you want this (and all other classes, of course) class to be bound: class name=entity.CalculationOutput map-to xml=CalculationOutput ns-uri=http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement; ns-prefix=clc/ Can you please add those bindings accordingly, and everything should be set. field name=versie type=entity.output.CalculatorVersie bind-xml name=RuntimeConfiguration/ /field field name=field1 type=entity.output.CalculatorBw bind-xml name=field1 location=Calculation/ /field /class class name=entity.output.CalculatorBw map-to xml=field1 ns-prefix=/ field name=id type=string bind-xml name=ref node=attribute/ /field field name=number type=string bind-xml name=ID node=element location=Features/ /field field name=year type=string bind-xml name=year node=element location=Features/ /field field name=quarter type=string bind-xml name=quarter node=element location=Features/ /field field name=amount type=string bind-xml name=amount node=element location=Features/ /field /class - 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
[castor-user] First release candidate for castor 1.3.3
Hi, I have just made available a first release candidate for Castor 1.3.3. Please report any regression issues at the Jira instance at the Codehaus [1]. In addition, please test the issues already fixed in this release as indicated [2] and close if appropriate. Kind Regards Werner Guttmann [1]: http://jira.codehaus.org/browse/CASTOR [2]: http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=10891version=17217 - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] First release candidate for castor 1.3.3
Hi, no, there's no intention for dropping Java 5 support. As it happened, the first release candidate had been built with Java 6 due to a misconfigured Maven dependency, and this problem has already been addressed in SVN and the final release (or an RC2) will be built against Java 5. Kind regards Werner On 24.04.2012 18:14, xzh...@yahoo.com wrote: Hi Werner, castor-xml is Java 6 binary. Are you dropping Java 6 support? Thanks, Xiaohong --Original Message-- From: Werner Guttmann To: annou...@castor.codehaus.org To: user@castor.codehaus.org ReplyTo: user@castor.codehaus.org Subject: [castor-user] First release candidate for castor 1.3.3 Sent: Apr 24, 2012 4:56 AM Hi, I have just made available a first release candidate for Castor 1.3.3. Please report any regression issues at the Jira instance at the Codehaus [1]. In addition, please test the issues already fixed in this release as indicated [2] and close if appropriate. Kind Regards Werner Guttmann [1]: http://jira.codehaus.org/browse/CASTOR [2]: http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=10891version=17217 - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email Sent from my Verizon Wireless BlackBerry - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] issues with setting the default name space
You are welcome. Kind Regards Werner On 19.04.2012 17:27, Priya B wrote: You are right, I was not mapping all the classes, looks like I have to do that. Now I get the correct namespace. Thankyou, Prioya Date: Thu, 19 Apr 2012 09:15:20 +0200 From: wgut...@codehaus.org To: user@castor.codehaus.org CC: balakrishnanpr...@hotmail.com Subject: Re: [castor-user] issues with setting the default name space Hi, have you mapped *all* classes of your domain to a namespace (uri) ? Regards Werner On 18.04.2012 22:02, Priya B wrote: This does not work. I had tried that earlier but with the below suggestion my output xml has a empty xmlns= as an attribute to some of the tags. mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument ns-uri=urn:hl7-org:v3 / field name=typeId type=org.abc.xyv.model.TypeId bind-xml name=typeId/ /field /class /mapping Noe my xml looks like.. clinicalDocument typeId... a xlmns= /a /typeId /clinicalDocument Date: Tue, 17 Apr 2012 12:54:05 +0200 From: wgut...@codehaus.org To: user@castor.codehaus.org CC: balakrishnanpr...@hotmail.com Subject: Re: [castor-user] issues with setting the default name space Hi Priya, How come you are *not* using the ns-uri attribute on the map-to elements to identify the namespace URI you want to assign to a given Java class ? mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument ns-uri=urn:hl7-org:v3 / field name=typeId type=org.telligen.patientsafety.model.TypeId bind-xml name=typeId/ /field /class /mapping Having done this, using Marshaller.setNamespace() should globally assign prefixes to namespace URIs. Kind Regards Werner On 13.04.2012 15:20, Priya B wrote: I think that was a typo. In the code I do the following. m = new Marshaller(), m.setNameSpace..(voc, urn:hl7-org:v3/voc); setNameSpace..(,urn:hl7-org:v3); Mapping file is as below but the declaration for xmlns shows as an empty tag. Sorry for the confusion. Priya Date: Fri, 13 Apr 2012 13:12:35 +0200 From: wgut...@codehaus.org To: user@castor.codehaus.org Subject: Re: [castor-user] issues with setting the default name space Hi, Why are you trying to map one namespace uri (hl7-org:v3/voc) more than once, i.e. to an explicit namespace prefix *and* the default namespace ? Kind regards Werner On 08.04.2012 22:02, Priya B wrote: Below are the first few lines of the xml I get and the mapping. I do not understand why I am getting the empty tag for xmlns, however the other namespaces come fine. *_XML File :_* ClinicalDocument xmlns:voc=urn:hl7-org:v3/voc xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 CDA.xsd*xmlns=* typeId root=2.16.840.1.113883.1.3 extension=POCD_HD40 / - - /ClinicalDocument *_Mapping File:_* * * mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 infrastructure/cda/CDA.xsd xmlns=urn:hl7-org:v3 xmlns:voc=urn:hl7-org:v3/voc/ field name=typeId type=org.telligen.patientsafety.model.TypeId bind-xml name=typeId/ /field - - /mapping In my code to marshal I do Marshaller m = new Marshaller(), m.setNameSpace..(voc, urn:hl7-org:v3/voc); setNameSpace..(,urn:hl7-org:v3/voc); I am expecting the output xml to have the namespace xmlns=urn:hl7-org:v3/voc but I get xmlns= but get rest of the declaration. Not sure what am I doing wrong? Thanks, Priya - 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 - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] xsi namespace not added
Hi Sebastian, what version of castor are you using ? And can you show us the code that you use to produce the XML ? And the relevant mapping file fragment ? Kind Regards Werner On 20.04.2012 00:48, Sebastian Montero wrote: Hi, I'm having a problem with castor marshaller, its producing an element with the xsi:type attribute, but it doesn't add the xsi namespace, what do I have to do so that it outputs the namespace? I have checked and the suppressNamespaces flag is off. Thanks in advance, Sebastian Montero - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] issues with setting the default name space
Hi, have you mapped *all* classes of your domain to a namespace (uri) ? Regards Werner On 18.04.2012 22:02, Priya B wrote: This does not work. I had tried that earlier but with the below suggestion my output xml has a empty xmlns= as an attribute to some of the tags. mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument ns-uri=urn:hl7-org:v3 / field name=typeId type=org.abc.xyv.model.TypeId bind-xml name=typeId/ /field /class /mapping Noe my xml looks like.. clinicalDocument typeId... a xlmns= /a /typeId /clinicalDocument Date: Tue, 17 Apr 2012 12:54:05 +0200 From: wgut...@codehaus.org To: user@castor.codehaus.org CC: balakrishnanpr...@hotmail.com Subject: Re: [castor-user] issues with setting the default name space Hi Priya, How come you are *not* using the ns-uri attribute on the map-to elements to identify the namespace URI you want to assign to a given Java class ? mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument ns-uri=urn:hl7-org:v3 / field name=typeId type=org.telligen.patientsafety.model.TypeId bind-xml name=typeId/ /field /class /mapping Having done this, using Marshaller.setNamespace() should globally assign prefixes to namespace URIs. Kind Regards Werner On 13.04.2012 15:20, Priya B wrote: I think that was a typo. In the code I do the following. m = new Marshaller(), m.setNameSpace..(voc, urn:hl7-org:v3/voc); setNameSpace..(,urn:hl7-org:v3); Mapping file is as below but the declaration for xmlns shows as an empty tag. Sorry for the confusion. Priya Date: Fri, 13 Apr 2012 13:12:35 +0200 From: wgut...@codehaus.org To: user@castor.codehaus.org Subject: Re: [castor-user] issues with setting the default name space Hi, Why are you trying to map one namespace uri (hl7-org:v3/voc) more than once, i.e. to an explicit namespace prefix *and* the default namespace ? Kind regards Werner On 08.04.2012 22:02, Priya B wrote: Below are the first few lines of the xml I get and the mapping. I do not understand why I am getting the empty tag for xmlns, however the other namespaces come fine. *_XML File :_* ClinicalDocument xmlns:voc=urn:hl7-org:v3/voc xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 CDA.xsd*xmlns=* typeId root=2.16.840.1.113883.1.3 extension=POCD_HD40 / - - /ClinicalDocument *_Mapping File:_* * * mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 infrastructure/cda/CDA.xsd xmlns=urn:hl7-org:v3 xmlns:voc=urn:hl7-org:v3/voc/ field name=typeId type=org.telligen.patientsafety.model.TypeId bind-xml name=typeId/ /field - - /mapping In my code to marshal I do Marshaller m = new Marshaller(), m.setNameSpace..(voc, urn:hl7-org:v3/voc); setNameSpace..(,urn:hl7-org:v3/voc); I am expecting the output xml to have the namespace xmlns=urn:hl7-org:v3/voc but I get xmlns= but get rest of the declaration. Not sure what am I doing wrong? Thanks, Priya - 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
[castor-user] Snapshot release for Castor 1.3.3
Hi everybody, I am in the process of uploading a new snapshot release of Castor 1.3.3 to the Codehaus' snapshot repository. Hopefully, this will be the last snapshot being built before making available a first release candidate for Castor 1.3.3 within the next two days. As always, any testing would be appreciated Kind Regards Werner - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Failing to unmarshall
Hi Mike, On 14.04.2012 08:38, Mike Wood wrote: Hi Werner From your response it sounds like you have seen the behaviour I have described in 1.3.2 and hence it is also unstable, please confirm? It is actually quite simple: there are some bug reports against Castor 1.3.2 that appear to report similar (if not the same) issues that have been looked into. If so what version would you recommend we use? Can you please (re-)test with TRUNK, or a snapshot release of 1.3.3 ? As mentioned I cannot recreate this problem in development, it only happens in a live environment. Can you explain why we are seeing these issues, configuration, setup a known bug? Sorry, but that questions is not clear to me. What is it that you wanted to know ? Regards Werner Thanks Mike. -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: 03 April 2012 19:43 To: user@castor.codehaus.org Cc: Mike Wood Subject: Re: [castor-user] Failing to unmarshall Hi Mike, can I please ask you to test against current TRUNK and report back your findings ? I am suprised that you had those issues with 1.3.1 (when I would have expected to see 1.3.2 mentioned here), but current trunk has seen a lot of bug fixes applied. Kind Regards Werner On 28.03.2012 14:37, Mike Wood wrote: Hello We have been using Castor for over 5 years on our product without any major issues. We recently upped version of Castor to 1.3.1 and have started to encounter issues when our application starts up then begins unmarshalling files. The sequence of events seems to be the same every time. The first failure reports this error... Failed to convert string to object: Nested error: org.exolab.castor.xml.MarshalException: White space is required between the processing instruction target and data.{File: [not available]; line: 1; column: 10} The second failure reports this error... Failed to convert string to object: Nested error: org.exolab.castor.xml.MarshalException: Content is not allowed in prolog.{File: [not available]; line: 1; column: 1} Then every single file the application tries to unmarshall results in this error... Failed to convert string to object: The class for the root element 'OUR_TO_ARP_File' could not be found. The application must be stopped and restarted to alleviate the situation. There is nothing wrong with any of the files we are asking Castor to unmarshall, they are well formed and if we restart the application it will unmarshall the files without issue. I have tried to recreate the sequence of events in a development environment as yet without success. I have even forced the first two errors by creating a file with random text before the declaration to force the 'Content not allowed..' error and by removing all of the spaces from the xml declaration in another file to force the 'White space...' error but subsequent files unmarshall without any problem. Does Castor go through some sort of initialisation process that may be failing to complete leading to the problems we are seeing or could someone suggest another reason this may be happening? Thanks Mike. This e-mail has been scanned for all viruses. - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Regular expression evaluator from default castor.properties not defined
Hi, On 12.04.2012 22:54, Stevens, Gary (NC627A) wrote: Hi Werner, I found the fix for my issue. I did in fact have to create a custom castor.properties file that set the org.exolab.castor.regexp property and add it to my project's classpath. I found the release notes for 1.3.1 state that an IllegalStateException will be thrown when no regular expression engine is named in a custom castor.properties file. I had the misunderstanding that the value for the org.exolab.castor.regexp property set in the castor.properties file inside castor-1.3.1-xml.jar would be used, but that is not the case. Well, actually, if such a value is set, it should be used. But great that you managed to resolve your problem. Kind Regards Werner Thanks, Gary -Original Message- From: Stevens, Gary (NC627A) Sent: Wednesday, April 11, 2012 8:33 AM To: user@castor.codehaus.org Subject: RE: [castor-user] Regular expression evaluator from default castor.properties not defined Sorry for the additional reply, but there is a typo in my original message. I am currently running Castor version 1.3.1. Thanks, Gary -Original Message- From: Stevens, Gary (NC627A) Sent: Wednesday, April 11, 2012 8:27 AM To: user@castor.codehaus.org Subject: RE: [castor-user] Regular expression evaluator from default castor.properties not defined Hi Werner, Yes, I have added the jars for Jakarta ORO 2.0.8 and Jakarta RegExp 1.5 and the problem occurs during unmarshalling. Thanks, Gary -Original Message- From: Werner Guttmann [mailto:werner.guttm...@gmx.net] Sent: Tuesday, April 03, 2012 2:40 PM To: user@castor.codehaus.org Cc: Stevens, Gary (NC627A) Subject: Re: [castor-user] Regular expression evaluator from default castor.properties not defined Hi, did you add the JAR for the Jakarta libraries ? Can I take it that the problem actually occurs upon (un-)marshalling ? Kind regards Werner On 22.03.2012 17:46, Stevens, Gary (NC627A) wrote: Hi all, I am trying to update the version of Castor my application uses from 0.9.5.3 to 1.3.2. I used the command line code generator to create the Java classes based on our schema files and replaced the code in my project. When I ran our unit tests some of them failed with this error: java.lang.IllegalStateException: You are trying to use regular expressions without having specified a regular expression evaluator. Please use the castor.properties file to define such. I used a custom castorbuilder.properties file to generate the code but I am not using a custom castor.properties file. I do not understand why with the default castor.properties file in castor-xml.jar, which has the value org.exolab.castor.regexp=org.exolab.castor.util.JakartaOroEvaluator, this error still occurs. Is there something more than having castor-core.jar, castor-xml.jar, and castor-xml-schema.jar in my classpath to get the settings in the castor.properties file to get picked up? Thank you, Gary F Stevens - 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 - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] issues with setting the default name space
Hi, Why are you trying to map one namespace uri (hl7-org:v3/voc) more than once, i.e. to an explicit namespace prefix *and* the default namespace ? Kind regards Werner On 08.04.2012 22:02, Priya B wrote: Below are the first few lines of the xml I get and the mapping. I do not understand why I am getting the empty tag for xmlns, however the other namespaces come fine. *_XML File :_* ClinicalDocument xmlns:voc=urn:hl7-org:v3/voc xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 CDA.xsd*xmlns=* typeId root=2.16.840.1.113883.1.3 extension=POCD_HD40 / - - /ClinicalDocument *_Mapping File:_* * * mapping class name=org.abc.xyv.model.ClinicalDocument map-to xml=ClinicalDocument xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=urn:hl7-org:v3 infrastructure/cda/CDA.xsd xmlns=urn:hl7-org:v3 xmlns:voc=urn:hl7-org:v3/voc/ field name=typeId type=org.telligen.patientsafety.model.TypeId bind-xml name=typeId/ /field - - /mapping In my code to marshal I do Marshaller m = new Marshaller(), m.setNameSpace..(voc, urn:hl7-org:v3/voc); setNameSpace..(,urn:hl7-org:v3/voc); I am expecting the output xml to have the namespace xmlns=urn:hl7-org:v3/voc but I get xmlns= but get rest of the declaration. Not sure what am I doing wrong? Thanks, Priya - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] One Array List Collection Field Multiple XML Elements
Hi Tim, I don't think that's actually possible with Castor XML. Kind Regards Werner On 06.04.2012 23:55, Tim Milstead wrote: I have a single array list collection field, e.g. addressLines that I want to unmarshall from multiple XML elements, e.g.C_ADDRESS1, C_ADDRESS2, etc. Each XML element contains the value of a single element in the collection. How do I go about mapping this? I've tried something like: field name=addressLines type=string collection=arraylist bind-xml name=C_ADDRESS1 node=element /bind-xml /field field name=addressLines type=string collection=arraylist bind-xml name=C_ADDRESS2 node=element /bind-xml /field But I unsurprisingly get a mapping exception telling me that the addressLines field appears more than once. I wonder if this is even impossible with a custom field handler since that will still be configured with only one XML element name? Tim - 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
Re: [castor-user] Regular expression evaluator from default castor.properties not defined
Hi, did you add the JAR for the Jakarta libraries ? Can I take it that the problem actually occurs upon (un-)marshalling ? Kind regards Werner On 22.03.2012 17:46, Stevens, Gary (NC627A) wrote: Hi all, I am trying to update the version of Castor my application uses from 0.9.5.3 to 1.3.2. I used the command line code generator to create the Java classes based on our schema files and replaced the code in my project. When I ran our unit tests some of them failed with this error: java.lang.IllegalStateException: You are trying to use regular expressions without having specified a regular expression evaluator. Please use the castor.properties file to define such. I used a custom castorbuilder.properties file to generate the code but I am not using a custom castor.properties file. I do not understand why with the default castor.properties file in castor-xml.jar, which has the value org.exolab.castor.regexp=org.exolab.castor.util.JakartaOroEvaluator, this error still occurs. Is there something more than having castor-core.jar, castor-xml.jar, and castor-xml-schema.jar in my classpath to get the settings in the castor.properties file to get picked up? Thank you, Gary F Stevens - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Failing to unmarshall
Hi Mike, can I please ask you to test against current TRUNK and report back your findings ? I am suprised that you had those issues with 1.3.1 (when I would have expected to see 1.3.2 mentioned here), but current trunk has seen a lot of bug fixes applied. Kind Regards Werner On 28.03.2012 14:37, Mike Wood wrote: Hello We have been using Castor for over 5 years on our product without any major issues. We recently upped version of Castor to 1.3.1 and have started to encounter issues when our application starts up then begins unmarshalling files. The sequence of events seems to be the same every time. The first failure reports this error… Failed to convert string to object: Nested error: org.exolab.castor.xml.MarshalException: White space is required between the processing instruction target and data.{File: [not available]; line: 1; column: 10} The second failure reports this error… Failed to convert string to object: Nested error: org.exolab.castor.xml.MarshalException: Content is not allowed in prolog.{File: [not available]; line: 1; column: 1} Then every single file the application tries to unmarshall results in this error… Failed to convert string to object: The class for the root element 'OUR_TO_ARP_File' could not be found. The application must be stopped and restarted to alleviate the situation. There is nothing wrong with any of the files we are asking Castor to unmarshall, they are well formed and if we restart the application it will unmarshall the files without issue. I have tried to recreate the sequence of events in a development environment as yet without success. I have even forced the first two errors by creating a file with random text before the declaration to force the ‘Content not allowed..’ error and by removing all of the spaces from the xml declaration in another file to force the ‘White space…’ error but subsequent files unmarshall without any problem. Does Castor go through some sort of initialisation process that may be failing to complete leading to the problems we are seeing or could someone suggest another reason this may be happening? Thanks Mike. - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Unmarshalling a stream with no mappable element should return null or throw an exception
Hi, On 14.03.2012 03:37, Dumont Arnaud wrote: Hi all, I'm using a simple Unmarshaller to unmarshall a String into a Java bean, using Castor v1.2: Unmarshaller un = new Unmarshaller(MyObject.class); Mapping mapping = new Mapping(); mapping.loadMapping(mappingFilePath); un.setMapping(mapping); MyBean myBean = un.unmarshal(new StringReader(myString)); My mapping file: ?xml version=1.0 encoding=UTF-8? mapping class name=com.MyBean map-to xml=myBean / field name=myField type=string / [...] /class /mapping When myString contains XML data corresponding to MyBean, the unmarshalling works correctly. But when myString is an empty String or does not contain XML data corresponding to MyBean, I would expect myBean to be null or an exception to be thrown. Instead, I get a newly instantiated MyBean, with no fields set. This might be worth having a look at. Can you please raise a Jira issue over at http://jira.codehaus.org/browse/CASTOR and attach a working test case that we can use to replay the problem. Is there a way to detect that no XML data corresponding to the bean class was found in myString (like a required attribute on the class tag?)? I couldn't find anything in the documentation or in the mail archive about this. Am I missing something? There's an option named 'ignoreExtraElements', but that's not really what you are looking for. This could be used to throw an exception if there's XML content to be parsed/unmarshalled which is not expected. Other than that ... there's nothing right now. Regards Werner Guttmann I could parse the String myself, looking for amyBean tag, but I would prefer the tag name to stay configurable in the Castor mapping file. Thanks in advance and many thanks for your great Castor library. Arnaud Dumont - 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
Re: [castor-user] castor 1.3.3
No, it hasn't. But yes, you are right, it is quote over-due. Regards Werner On 25.02.2012 15:18, xzh...@yahoo.com wrote: Hi, Has 1.3.3 been released yet? According to JIRA, it should've been out 12/JUL/11 which iis more than 6 months ago. We really need the fix for CASTOR-3114 to upgrade from 1.3.1. Thanks. Sent from my Verizon Wireless BlackBerry - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] castor mapping generation throwing error : Unable to resolve ID for instance of class 'java.lang.String'
Hi, I am not sure, but it could be that support for the XML schema construct is faulty/incomplete. Why not look at the sources and at least identify the culprit ? Cheers Werner On 22.02.2012 02:10, Pradeep_s83 wrote: While generating castor mapping and classes , i am getting following error. This error is happening when xs:extension tag is present http://old.nabble.com/file/p33368179/err.txt err.txt . Uploaded schema and error files. Please help. http://old.nabble.com/file/p33368179/test.xsd test.xsd - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] How to marshall null fields and empty collections to empty elements
Hi, I'd have to try this myself first to give you a precise answer, but you could have a look at the 'required' attribute. Regards Werner On 07.02.2012 18:23, Alessandro wrote: Hello everybody, I started using Castor a few weeks ago, quite happily until now. But I came across an issue I haven't found a solution for. I want to generate an XML with empty tags where no value is present in my java object. Be that an empty collection or a null field. With the default configuration though I don't get any element at all. How can I instruct castor to do this? Here is a fragment of my castor-mapping.xml class name=org.youthnet.doit.syndication.common.model.response.SyndicationOpportunity map-to xml=opportunity ns-uri=http://www.do-it.org.uk/volunteering-opportunity/ field name=title type=java.lang.String/ field name=summary type=java.lang.String/ field name=availability type=org.youthnet.doit.syndication.common.model.response.SyndicationAvailability bind-xml name=times/ /field field name=activities collection=arraylist type=org.youthnet.doit.domain.Activity bind-xml location=activities name=activity/ /field . for instance I want anactivities tag even if the activities collection is empty. Any clue about how to do this? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Trying to unmarshall Map when mixed with non-matching sibling nodes
Hi, as I don't know anythign baout your Java classes, this is hard to tell. But it it looks like within bind-xml name=item.value node=element / 'item.value' is causing your problems. Regards Werner On 31.01.2012 17:25, Stacy Young wrote: Hi All, I'm trying to unmarshall the portion highlighted in green below into a map (or list) ... Response xmlns=http://www.foobar.com; response1X/response1 response2M/response2 detail tagInternalResponseCode/tag value0/value /detail detail tagSubErrorCode/tag value0/value /detail detail tagInternalResponseDescription/tag valueno_error/value /detail txnTime2012-01-31T11:16:57.994-05:00/txnTime duplicateFoundfalse/duplicateFound /Response I've tried the following (as well as about a hundred permutations) without any luck. field name=detail get-method=getDetail set-method=setDetail collection=map bind-xml name=detail class name=org.exolab.castor.mapping.MapItem field name=key type=string bind-xml name=item.tag node=element / /field field name=value type=string bind-xml name=item.value node=element / /field /class /bind-xml /field Exception at runtime is: Unable to find FieldDescriptor for 'tag' in ClassDescriptor of map-item. Is this a namespace issue or am I just off base? Thanks! Stacy - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castors not pooling the parsers - causes performance issues under extreme load
Hi, On 15.02.2012 07:59, Bhushan Shelke wrote: Hello All, I am using castor(1.2, upgraded to 1.3.2 as well) as data binding framework in one of the project. External systems (6 to be precise) send xml data (moderate) every second. Then we use castor to marshal/un marshal at various places in code. Problem I am facing is – during unmarshalling process castor doesn’t seem to pool (cache) the parsers (SAX), hence ends up looking up and then creating/loading parser for every request. This obviously has performance overheads. And since this is done internally and I couldn’t find any configuration that tells castor to pool parsers, so I’ve hit dead end. Under extreme load this also leads to thread blocking/ deadlocks because of probably a defect in tomcat, when too many threads request to load same class. This looks like a nice feature to have in castor (if not there already). Yes, it dies, indeed. Though thinking about this a little bit longer, I cannot think of an easy and intuitive way of approaching said subject. But feel free to raise a Jira issue and share your thoughts with us Kind Regards Werner Guttmann Following is snapshot thread blocking I mentioned earlier – Thread 1981: (state = BLOCKED) - org.apache.catalina.loader.WebappClassLoader.loadClass(java.lang.String, boolean) @bci=0, line=1524 (Compiled frame) - org.apache.catalina.loader.WebappClassLoader.loadClass(java.lang.String) @bci=3, line=1491 (Compiled frame) - javax.xml.parsers.FactoryFinder.getProviderClass(java.lang.String, java.lang.ClassLoader, boolean) @bci=25, line=111 (Interpreted frame) - javax.xml.parsers.FactoryFinder.newInstance(java.lang.String, java.lang.ClassLoader, boolean) @bci=3, line=146 (Interpreted frame) - javax.xml.parsers.FactoryFinder.find(java.lang.String, java.lang.String) @bci=345, line=233 (Interpreted frame) - javax.xml.parsers.SAXParserFactory.newInstance() @bci=4, line=128 (Interpreted frame) - org.exolab.castor.xml.util.XMLParserUtils.getSAXParser(boolean, boolean) @bci=2, line=118 (Interpreted frame) - org.castor.xml.AbstractInternalContext.getXMLReader(java.lang.String) @bci=56, line=262 (Interpreted frame) - org.castor.xml.AbstractInternalContext.getXMLReader() @bci=2, line=248 (Interpreted frame) - org.exolab.castor.xml.Unmarshaller.unmarshal(org.xml.sax.InputSource) @bci=8, line=692 (Interpreted frame) - org.springframework.oxm.castor.CastorMarshaller.unmarshalInputStream(java.io.InputStream) @bci=12, line=386 (Interpreted frame) - org.springframework.oxm.support.AbstractMarshaller.unmarshalStreamSource(javax.xml.transform.stream.StreamSource) @bci=12, line=368 (Interpreted frame) - org.springframework.oxm.support.AbstractMarshaller.unmarshal(javax.xml.transform.Source) @bci=57, line=134 (Interpreted frame) Any help/pointers would be greatly appreciated. --Bhushan DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor marshalling xmlns not coming for enum type
Hi, can you please open a new issue at Castor's Jira, and attach a working test case that allows us to replay the problem at hand. Kind Regards Werner On 03.11.2011 19:14, Pradeep_s83 wrote: Hi, I am using spring castor marshalling . In the generated xml , for enum types xmlns attribute is not coming . Its coming for other primitive types Please find the mapping snippet below. queryFilter is an enum type class name=com.test.gen.common.SearchRequestType access=shared map-to xml=SearchRequestType ns-uri=http://www.wsgc.com/schemas/WSI/DS/Common/v1.0; element-definition=true / field name=queryFilter type=com.test.gen.common.QueryFilterType required=true bind-xml name=QueryFilter node=element / /field field name=conceptCode type=java.lang.String required=true bind-xml name=ConceptCode node=element / /field /class class name=com.test.gen.common.QueryFilterType access=shared verify-constructable=false map-to xml=QueryFilterType ns-uri=http://www.wsgc.com/schemas/WSI/DS/Common/v1.0; element-definition=false / /class - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Ant task classpathref for castor.class.path should be set what?
Oops, sorry, my fault. You are looking at the right documentation. Kind Regards Werner Guttmann On 03.11.2011 12:44, Kayode Odeyemi wrote: On Thu, Nov 3, 2011 at 11:27 AM, Werner Guttmann wgut...@codehaus.org mailto:wgut...@codehaus.org wrote: Hi, On 03.11.2011 10:30, Kayode Odeyemi wrote: On Thu, Nov 3, 2011 at 8:51 AM, Werner Guttmann wgut...@codehaus.org mailto:wgut...@codehaus.org mailto:wgut...@codehaus.org mailto:wgut...@codehaus.org wrote: Hi, looking at the documentation for the Ant task for the XML code generator at http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.invocations.anttask.parameters http://castor.org/reference/__html/xml.code.generator.html#__xml.code.generator.__invocations.anttask.parameters http://castor.org/reference/__html/xml.code.generator.html#__xml.code.generator.__invocations.anttask.parameters http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.invocations.anttask.parameters__ I cannot see a 'castor.class.path' parameter. So what is your question actually about ? I got that from here: http://castor.org/ddlgen-__anttask.html http://castor.org/ddlgen-anttask.html. Which is outdated. Please use the reference guide to get an idea what's supported and what not. Amyway, i've been able to get around it using classpath=${javac.classpath} with castor jars files in my classpath. However, I was able to successfully generate java files from an XSD. I was hoping that with the generateMapping flag turned on, I was going to get a corresponding XML file with each of these java classes but that didn't happen. How can I get around this? Can you plkease switch to the NEW Ant task definition, and take it from there ? I think I'm looking at the new one? I went to the link you pasted above (http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.invocations.anttask) and it is not different from the Castor PDF reference I'm using. The new reference is showing classpathref=castor.class.path which I mentioned I replaced with classpath=${javac.classpath} to get things working. if there's any other newer reference, can you please point me to this. Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Ant task classpathref for castor.class.path should be set what?
Hi, looking at the documentation for the Ant task for the XML code generator at http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.invocations.anttask.parameters I cannot see a 'castor.class.path' parameter. So what is your question actually about ? Kind Regards Werner Guttmann On 02.11.2011 19:33, Kayode Odeyemi wrote: Hello all, First time poster here. Please what is castor.class.pathin ant build file meant to be set to for castor? Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Ant task classpathref for castor.class.path should be set what?
Hi, On 03.11.2011 10:30, Kayode Odeyemi wrote: On Thu, Nov 3, 2011 at 8:51 AM, Werner Guttmann wgut...@codehaus.org mailto:wgut...@codehaus.org wrote: Hi, looking at the documentation for the Ant task for the XML code generator at http://castor.org/reference/__html/xml.code.generator.html#__xml.code.generator.__invocations.anttask.parameters http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.invocations.anttask.parameters I cannot see a 'castor.class.path' parameter. So what is your question actually about ? I got that from here: http://castor.org/ddlgen-anttask.html. Which is outdated. Please use the reference guide to get an idea what's supported and what not. Amyway, i've been able to get around it using classpath=${javac.classpath} with castor jars files in my classpath. However, I was able to successfully generate java files from an XSD. I was hoping that with the generateMapping flag turned on, I was going to get a corresponding XML file with each of these java classes but that didn't happen. How can I get around this? Can you plkease switch to the NEW Ant task definition, and take it from there ? Kind Regards Werner Guttmann My use case revolves around generating an XML from JDO at periodic intervals and then posting the XML files to Solr for indexing. Please how can I marshal records stored in JDO directly to an XML file using castor? Will appreciate any help. Thank you. On 02.11.2011 19:33, Kayode Odeyemi wrote: Hello all, First time poster here. Please what is castor.class.pathin ant build file meant to be set to for castor? Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Any node conflicting element with exsiting descriptor
Hi Paul, this could as well be the reason for the problems we are seeing. Huub, can you please try to your test case against a 1.3.3 snapshot release (simply the latest from last weekend). As far as I remember, I did commit a patch for that issue (and I am suprised to see that the issue has not been updated). Kind Regards Werner On 27.10.2011 14:16, Paul French wrote: is this a manifestation of the same problem given at... http://jira.codehaus.org/browse/CASTOR-2902 Paul French Kirona Solutions Ltd Tel: 07803 122 058 E-Mail: paul.fre...@kirona.com Web: www.kirona.com http://www.kirona.com This email and any attachments are confidential and should only be read by those to whom they are addressed. If you are not the intended recipient, please contact us on 01625 585511, delete the email (including any attachment) from your computer and destroy any copies. Any distribution or copying without our prior permission is prohibited. Internet communications are not always secure and may be subject to delays, non-delivery and unauthorised alterations. Therefore, information expressed in this message is not given or endorsed by Kirona Solutions Limited (Kirona) unless otherwise notified by our duly authorised representative independent of this message. No warranty is given that this email (including any attachment) is virus free. Any views or opinions presented are solely those of the author and do not necessarily represent those of Kirona. Registered addresses: Kirona Solutions Limited, Barrington House, Heyes Lane, Alderley Edge, Cheshire. SK9 7LA Registered in England and Wales No: 04678711 On 27/10/2011 13:05, Werner Guttmann wrote: Hi, could you please create a new Jira ticket and attach all this information, incl. the test case. Kind Regards Werner Guttmann On 25.10.2011 23:02, seper...@planet.nl wrote: I have added a test case in the form of an Eclipse project (adjust classpath settings). Furthermore I have done some debugging and found the following piece of code: XMLClassDescriptorResolverImpl (line 311): if (possibleMatches.size() == 1) { // we have exactly one possible match - that's our result // (if it has the right namespace, it's an exact match, if not its // the only possible match) return (XMLClassDescriptor) possibleMatches.get(0); } This means that when I send in a 'raw' xml Fragment in an 'any' element (xsd) Castor will still find a Descriptor with the same name and assume it should unmarshall to this element. Well actually it does this once, a second time it will have 2 descriptors with the same name cached and then it does check for namespace!? So basically I cannot send in an XML fragment which is meant to be an AnyNode when Castor has a Descriptor for an element with the same name (but different namespace). This presents me with a difficult problem to solve in our production code. How can I tell Castor to leave my 'any' element alone? Greetings, Huub - 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
Re: [castor-user] XSD - Java data type mapping
Hi Alex, On 26.10.2011 02:03, Alex Milanovic wrote: Hi, I noticed that Castor 1.3.2 SourceGenerator mapped both nonNegativeInteger and positiveInteger (in XSD) to long (in Java). However, the SourceGenerator User Document states that nonNegativeInteger and positiveInteger map to int. As I didn't define any custom binding for these fields it seems that the Castor documentation is out of sync with the code on these two data types. Thanks for letting us now. Can you please raise a ticket at Jira and we will take care of this. I wonder if there are more differences? How can I find out the current XSD-Java data type mapping? Is there a Castor class that defines them? No, it's all constants in the various XS* classes. Having said that, the docs should be up to date, so if you find more differences, please let us know. Kind Regards Werner Thanks Alex - 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
Re: [castor-user] Any node conflicting element with exsiting descriptor
Hi, could you please create a new Jira ticket and attach all this information, incl. the test case. Kind Regards Werner Guttmann On 25.10.2011 23:02, seper...@planet.nl wrote: I have added a test case in the form of an Eclipse project (adjust classpath settings). Furthermore I have done some debugging and found the following piece of code: XMLClassDescriptorResolverImpl (line 311): if (possibleMatches.size() == 1) { // we have exactly one possible match - that's our result // (if it has the right namespace, it's an exact match, if not its // the only possible match) return (XMLClassDescriptor) possibleMatches.get(0); } This means that when I send in a 'raw' xml Fragment in an 'any' element (xsd) Castor will still find a Descriptor with the same name and assume it should unmarshall to this element. Well actually it does this once, a second time it will have 2 descriptors with the same name cached and then it does check for namespace!? So basically I cannot send in an XML fragment which is meant to be an AnyNode when Castor has a Descriptor for an element with the same name (but different namespace). This presents me with a difficult problem to solve in our production code. How can I tell Castor to leave my 'any' element alone? Greetings, Huub - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] substitutionGroup and Source Generator
On 19.10.2011 17:09, Alex Milanovic wrote: Hi Werner, Yes I am using the element mode. You shouldn't in the case of substitution groups. Are there any caveats with the type mode when it comes to (un)marshalling? Not to my knowledge. A few years ago, I did some consultancy for a client that used (rather biggish) FpML applications, with substitution groups being used all over the place. So why not give it a try ? For example, if I have to unmarshal a global element (e.g. ElemA) will Castor be able to identify the Java class that corresponds to the global element's complex type (TypeA)? Yes, of course. But it will stop generating separate classes for elements. Or, if I want to marshal the class that corresponds to the global element's complex type (TypeA) how will Castor know the XML tag (ElemA) given that the element information would not be captured in the complex type's class? It will, as global element defs will still be considered. There's even s small section on precisely this in the reference guide. Kind Regards Werner Thanks, Alex -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Wednesday, October 19, 2011 12:42 AM To: user@castor.codehaus.org Cc: Alex Milanovic; Adrien schiehle Subject: Re: [castor-user] substitutionGroup and Source Generator Hi Alex, On 18.10.2011 19:51, Alex Milanovic wrote: Werner, I am facing the same issue described in the link below (http://www.mail-archive.com/castor-dev@exolab.org/msg07657.html) with Castor 1.3.2 and the 'element' method. Please note this is not about naming conflicts but about the fact that Castor SourceGenerator generates Java classes that don't translate well the XML element substitutability to Java. For example, assume we have the following XSD definitions: TypeB extends TypeA ElemA is of type TypeA ElemB is of type TypeB, substitutes elemA In XML documents ElemB can substitute ElemA but in the Java code generated by Castor the ElemB class does not inherit from ElemA class and therefore there is no substitutability there. Here's an example where substitutability matters. Suppose ElemParent can have ElemA as a child element: Hmm, are you by chance using element mode when generating the Java classes ? If yes, please try to switch to type mode as this clearly makes a difference in the context of this. Kind Regards Werner ElemParent ElemA SourceGenerator creates a Java class that specifies ElemA as the type of elemA. Now, because ElemB does not inherit from ElemA the member _elemA cannot have a value of type ElemB, which essentially kills the substitutability in Java. Class ElemParent ElemA _elemA; Could SourceGenerator be changed to product the following? Class ElemParent TypeA _elemA; In this case, the class member _elemA can have a value of type ElemB because ElemB inherits from TypeB, which in turn inherits from TypeA. I tried enforcing this type in the bindings as illustrated below but it didn't work. elementBinding name=/complexType:ElemParentType/ElemA member name=ElemA java-type=somepackage.TypeA/ /elementBinding I looked at the documentation of SourceGenerator and the Castor Reference Guide but didn't find a way to work around this problem. Should I open a bug/CR report? Thanks Alex -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Friday, December 17, 2010 12:27 AM To: user@castor.codehaus.org Cc: Adrien schiehle Subject: Re: [castor-user] substitutionGroup and Source Generator No, it does. And there's actually quite a lot of information about this and (possible) naming conflict problems and how to go about resolving those during source generation in the reference guide. Just out of curiosity, what version of Castor are you trying to use ? Regards Werner On 17.12.2010 06:54, Adrien schiehle wrote: Hi, I'm having issue with substitutionGroup and Source Generator. My problem is the same as Michael Wang in his mail : http://www.mail-archive.com/castor-dev@exolab.org/msg07657.html ( [castor-dev] About generated java codes to support substitutionGroup ) The mail was sent Monday, June 03, 2002 Arnaud Blandin answered him that the Source Generator doesn't support substitutionGroup. Is it still the case? Thanks in advance, Adrien SCHIEHLE. - 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 - To unsubscribe from this list
Re: [castor-user] How to avoid generating Java classes for element groups?
Hi Alex, On 18.10.2011 21:07, Alex Milanovic wrote: Hi, SourceGenerator in Castor 1.3.2 (with the 'element' method) produces Java classes for element groups. In XML documents, though, element groups have no representation. They're only used for modeling in XML schemas. Is there a way to turn off the generation of Java classes for element groups? No, not to my knowledge. Having said that, though, does it really make a difference, when the XML produced/parsed matches the XML schema given ? Or do you need the classes generated for other things as well ? Regards Werner Guttmann Attribute groups don't have this problem in SourceGenerator as no special Java classes are generated for them. Thanks Alex - 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
Re: [castor-user] Globally overriding data type mapping in SourceGenerator
Hi Alex, On 18.10.2011 21:11, Alex Milanovic wrote: Hi, Is there a way to globally override the data type mapping in Source Generator? No, it is not possible. But I cannot think of a reason why this could no be added to the feature set. Kind Regards Werner For sure one can do it on a member-by-member basis but I'd like to be able to define that, for example, all occurrences of xsd:decimal map to java.lang.Double instead of BigDecimal. Possible? Thanks Alex - 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
Re: [castor-user] Globally overriding data type mapping in SourceGenerator
Hi Alex, On 18.10.2011 21:11, Alex Milanovic wrote: Hi, Is there a way to globally override the data type mapping in Source Generator? No, it is not possible. But I cannot think of a reason why this could no be added to the feature set. Kind Regards Werner For sure one can do it on a member-by-member basis but I'd like to be able to define that, for example, all occurrences of xsd:decimal map to java.lang.Double instead of BigDecimal. Possible? Thanks Alex - 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
Re: [castor-user] substitutionGroup and Source Generator
Hi Alex, On 18.10.2011 19:51, Alex Milanovic wrote: Werner, I am facing the same issue described in the link below (http://www.mail-archive.com/castor-dev@exolab.org/msg07657.html) with Castor 1.3.2 and the 'element' method. Please note this is not about naming conflicts but about the fact that Castor SourceGenerator generates Java classes that don't translate well the XML element substitutability to Java. For example, assume we have the following XSD definitions: TypeB extends TypeA ElemA is of type TypeA ElemB is of type TypeB, substitutes elemA In XML documents ElemB can substitute ElemA but in the Java code generated by Castor the ElemB class does not inherit from ElemA class and therefore there is no substitutability there. Here's an example where substitutability matters. Suppose ElemParent can have ElemA as a child element: Hmm, are you by chance using element mode when generating the Java classes ? If yes, please try to switch to type mode as this clearly makes a difference in the context of this. Kind Regards Werner ElemParent ElemA SourceGenerator creates a Java class that specifies ElemA as the type of elemA. Now, because ElemB does not inherit from ElemA the member _elemA cannot have a value of type ElemB, which essentially kills the substitutability in Java. Class ElemParent ElemA _elemA; Could SourceGenerator be changed to product the following? Class ElemParent TypeA _elemA; In this case, the class member _elemA can have a value of type ElemB because ElemB inherits from TypeB, which in turn inherits from TypeA. I tried enforcing this type in the bindings as illustrated below but it didn't work. elementBinding name=/complexType:ElemParentType/ElemA member name=ElemA java-type=somepackage.TypeA/ /elementBinding I looked at the documentation of SourceGenerator and the Castor Reference Guide but didn't find a way to work around this problem. Should I open a bug/CR report? Thanks Alex -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Friday, December 17, 2010 12:27 AM To: user@castor.codehaus.org Cc: Adrien schiehle Subject: Re: [castor-user] substitutionGroup and Source Generator No, it does. And there's actually quite a lot of information about this and (possible) naming conflict problems and how to go about resolving those during source generation in the reference guide. Just out of curiosity, what version of Castor are you trying to use ? Regards Werner On 17.12.2010 06:54, Adrien schiehle wrote: Hi, I'm having issue with substitutionGroup and Source Generator. My problem is the same as Michael Wang in his mail : http://www.mail-archive.com/castor-dev@exolab.org/msg07657.html ( [castor-dev] About generated java codes to support substitutionGroup ) The mail was sent Monday, June 03, 2002 Arnaud Blandin answered him that the Source Generator doesn't support substitutionGroup. Is it still the case? Thanks in advance, Adrien SCHIEHLE. - 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
Re: [castor-user] SourceGenerator - don't prompts the user on identical local elements
Hi Alex, On 18.10.2011 21:18, Alex Milanovic wrote: Hi, Here's a possible enhancement idea for the SourceGenerator: Currently, if it detects two local elements with the same name (defined under different complex types) it will warn that the resulting Java class will be overwritten and prompts the user for a confirmation. To get rid of the warning one can define a global element and reference it from the two complex types. SourceGenerator could, however, detect that the two local element declarations are identical (in name, type, minOccurs, maxOccurs, etc.) and potentially print out a message that because they're identical only one Java class is created for both. Yes, I agree that in more genral cases, this could be done. But remember where a user sets special properties based on e.g. target namespace, java package names, etc. In this context it will get more and more difficult to maintain this basic assumption about equality. As such, I think decisions have been taken early in the genesis of Castor to leave it where it stands now. Not sure if this appears often enough to justify special handling though... It's not really about the frequency, but about the special seetings on euser might apply during code generation. Having said that, I am more than willing to work with anybody on such feature to gain a better understanding. Thanks Alex Kind Regards Werner Guttmann - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Line breaks during Unmarshall process
Hi, thanks for 'reporting' this work around. But assuming that this is not reproducible with newer versions of cstor XML, I guess we'll leave it there. We do encourage users to use more recent versions of Castor, but if you are stuck, you'll have to work-around issues that have been fixed in later released. Kind Regards Werner Guttmann On 17.10.2011 09:00, Mohit Raj wrote: Recently I found a work around for this problem, so wanted to share this across. 1. Replace xercesImpl.jar with sax.jar from http://www.saxproject.org 2. Upgrade castor-1.0.2.jar to castor-1.2.jar 3. Configure the castor jar using a castor.properties file with following content: ## # Define the XML parser to be used by Castor. # The parser must implement org.xml.sax.Parser. org.exolab.castor.parser=org.xml.sax.helpers.XMLReaderAdapter # Defines the (default) XML serializer factory to use by Castor, which must # implement org.exolab.castor.xml.SerializerFactory; default is # org.exolab.castor.xml.XercesXMLSerializerFactory org.exolab.castor.xml.serializer.factory=org.exolab.castor.xml.XercesJDK5XML SerializerFactory ## Because, this relates to castor 1.0.2, which is not listed in the options while creating a Jira, I haven't filed an issue. Additionally, I don't have a unit test to provide for this, as that would be heavily dependent on my work project. Let me know, if I can provided any more details. Thanks. Mohit Raj -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Wednesday, January 05, 2011 10:41 PM To: Mohit Raj Cc: user@castor.codehaus.org Subject: Re: [castor-user] Line breaks during Unmarshall process Hi, just to make sure that email does not fool around with characters, can you please create a new Jira issue and attach all relevant files so that we can replay this problem ? Thanks in advance Werner On 05.01.2011 15:45, Mohit Raj wrote: Yes am sure the problem relates to unmarshalling. Below is an example and also attached is the problem example. = Problem causing XML fragment: storeREGT# 1 1 1 148 90/store Castor Unmarshaller bebug Output: #startElement: store #characters: REGT# #characters: 1 1 1 148 90 #endElement: store = If you observe in the output above content of store element is being shown in 2 lines (#characters) which is because of the fact that a new line character is introduced. Pl. see the attached full XML document. Also, do ignore the 14111 character position(mentioned in earlier in thread) as that was the position reported of tab delimited file from which the attached XML has been generated. Thanks, Mohit Raj -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Wednesday, January 05, 2011 7:36 PM To: user@castor.codehaus.org Cc: Mohit Raj Subject: Re: [castor-user] Line breaks during Unmarshall process Hi, I am not sure I can follow fully. Can you please provide us with some sample XML to highlight the problem at hand ? And are you sure the problem is a problem related to unmarshalling, i.e. producing Java object instances from XML document(s) ? Cheers Werner On 05.01.2011 12:36, Mohit Raj wrote: Hi, I have been looking around the web and specifically on Castor site but in vain. I am facing the problem of new line character being introduced when using the org.exolab.castor.xml.Unmarshaller object. This happenes exactly when the character 14111 in the xml to be imported and converted to java objects has a white space on it. I have seen some suggestions like OutputFormat.setLineWidth(16384), but this method doesn't exist in my version of castor library (1.3 and 1.0.2), though at the same time, not sure if this would be of any help, as am unmarshalling against this being a solution for marshalling. Any help would be highly appreciated and let me know if you require any more details. Thanks, Mohit - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Unmarshall raw xml segment with right namespace
Hi, have you got a test case that I could use to debug your problem ? If yes, please create a new Jira issue and attach the test case (including all required files). Kind Regards Werner Guttmann On 17.09.2011 12:31, seper...@planet.nl wrote: Hello, I have a question about marshalling raw xml segments. With reference to the example at: http://www.castor.org/how-to-unmarshal-raw-xml.html What I want is the xml fragment miscMisc xml to be dealt with later/misc The example gives a result that includes the parent element xmlnode2 So with the requirement that the fragment could be any element. How do I get only the fragment I want. Furthermore the xml I have to unmarshall is more like the following: root xmlns=nsouter xmlnode attribute=misc xml data dataData 1/data dataData 2/data /xmlnode stringRegular String Data/string xmlnode2 misc xmlns=nsinnerMisc xml to be dealt with later/misc /xmlnode2 /root I need to unmarshall the fragment: misc xmlns=nsinnerMisc xml to be dealt with later/misc with the right namespace I have tried to adjust the FieldHandler: public Object convertUponSet(final Object value) { AnyNode result = null; final AnyNode node = (AnyNode) value; if (node != null) { result = node.getFirstChild(); if (result.getNodeType() != AnyNode.ELEMENT) { result = result.getNextSibling(); } } if (result == null || result.getNodeType() != AnyNode.ELEMENT) { throw new BindingRuntimeException(failed to extract the Message Body xml segment); } return result.toString(); } But result = node.getFirstChild(); gives me an AnyNode that has the same namespace of the parent (nsouter) ? Greetings, Huub - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it?
Hi, what is the actual size of of the String before unmarshalling ? Regards Werner Guttmann On 29.09.2011 23:30, Richard2011 wrote: Sure, I'm having around 29 Objects that are filled up when I unmarshalled a big String. Those Objects are parsed out using a mapping.xml file, like the following: class name=com.class.objects.parentClassName map-to xml=InquiryResponse / field name=field1 type=string bind-xml name=Field1 node=element/ /field field name=inquiryResponseHeader type=com.class.objects.className bind-xml name=InquiryResponseHeader node=element / /field etc. /class class name=com.class.objects.className field name=id type=string bind-xml name=id node=attribute/ /field field name=seq type=string bind-xml name=seq node=attribute/ /field etc /class It takes about 1 - 2 minutes to unmarshall this objects. It may be longer depending on the String received. I have been thinking also in the possibility to have less objects, for example, although is much cleaner in a sense to have objects for each xml section that encapsulates information, will it be better to try to enter information in less objects? Also I have the context and unmarshaller set up as the following: Mapping mapping = new Mapping(); InputSource in = new InputSource(getClass().getClassLoader().getResource(fileName.xml).getPath()); mapping.loadMapping(in); //Added to increase performance with similar mappings context.addMapping(mapping); //End of XmlContext change Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setMapping(mapping); unmarshaller.setValidation(false); I read somewhere about a .cdr file that needs to be there but my I basically don't use generated files. Any idea? I can bring more information if required. I really appreciate any thought or direction. Werner Guttmann-6 wrote: Hi, I can only second that statement about the (non-) cost of logging. Having said that, what kind of degradation are you actually observing ? Can you share some information with us on this subject ? Kind Regards Werner Guttmann On 26.09.2011 20:42, Thom Hehl wrote: Hi, Richard! If you look through the documentation for log4j, there is a trivial cost for supplying these log statements and probably much less if you turn them off. The cost of this is pretty minor and I wouldn't worry about it. -Original Message- From: Richard2011 [mailto:ricardo.alvar...@equifax.com] Sent: Monday, September 26, 2011 2:41 PM To: user@castor.codehaus.org Subject: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it? My first reasonable question, can INFO messages as the following: INFO: org.exolab.castor.xml.UnmarshalHandler - #endElement: bind-xml INFO: org.exolab.castor.xml.UnmarshalHandler - #characters: Degrade the performance? (I see in the logs lot's of this messages - using Net Beans 6.9.1) and I was curious. Until it ends this type of messages it continues with normal processes. Can logging be the cause of castor degradation? 2.) I was reading about a .cdr file.. would this help? How can I generate one? 3.) I have at least 20 classes, some are nested on others.. is there any chance this can cause degradation as well? Or maybe that a mapping made in the xml file can be changed in order to improve performance? I really appreciate any assistance that anyone can give me... - 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
Re: [castor-user] description in mapping files and Castor 1.3.2
Hi Stevo, I remember that we had a small issue with an inconsistence between DTSs and Xml schema for the mapping file after the 1.3.2 release, but that has been fixed. I have never seen what you are seeing, to be honest ? Can you show me a sample mapping file where yoou are seeing this warnings ? Cheers Werner On 29.09.2011 17:17, Stevo Slavić wrote: Hello Castor users, Maintaining a project I updated Castor to 1.3.2, and now Castor complains on unchanged valid Castor mapping files, reporting for all description elements (global one under mapping root element, but also description elements within class elements) following error message: Unable to find FieldDescriptor for 'description' in ClassDescriptor of mapping. description element is allowed according to following Castor mapping xsd: http://www.castor.org/mapping.xsd Couldn't find JIRA ticked opened for this. Is anyone experiencing this unwanted behavior? Regards, Stevo. - 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
Re: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it?
Hi Richard, On 27.09.2011 23:32, Richard2011 wrote: Hi Thom, That's give me a relief on research, Is it possible to be .cdr or quantity of classes? Getting into a point in which I don't which else to take a look. Will the parsing mapping.xml parsing order or something on the file could affect? It could be a lot of things to be honest. But I still don't know what problems you are experiencing. Would you mind sharing your observations with us ? In general: * Order of mappings doesn't make a difference. * What quantity are we talking about ? * Why are you using a mapping file together with generated POJOs ? Kind Regards Werner Guttmann By the way, I'm using castor.1.3.2. Does Xerces/Xalan newest versions will have any improvement if I set it up in my project? Anyway, thank you for your help! Thom Hehl-2 wrote: Hi, Richard! If you look through the documentation for log4j, there is a trivial cost for supplying these log statements and probably much less if you turn them off. The cost of this is pretty minor and I wouldn't worry about it. -Original Message- From: Richard2011 [mailto:ricardo.alvar...@equifax.com] Sent: Monday, September 26, 2011 2:41 PM To: user@castor.codehaus.org Subject: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it? My first reasonable question, can INFO messages as the following: INFO: org.exolab.castor.xml.UnmarshalHandler - #endElement: bind-xml INFO: org.exolab.castor.xml.UnmarshalHandler - #characters: Degrade the performance? (I see in the logs lot's of this messages - using Net Beans 6.9.1) and I was curious. Until it ends this type of messages it continues with normal processes. Can logging be the cause of castor degradation? 2.) I was reading about a .cdr file.. would this help? How can I generate one? 3.) I have at least 20 classes, some are nested on others.. is there any chance this can cause degradation as well? Or maybe that a mapping made in the xml file can be changed in order to improve performance? I really appreciate any assistance that anyone can give me... -- View this message in context: http://old.nabble.com/Castor-Performance-Degradation---Can-INFO-messages %2C-.cdr-file-or-lot%27s-of-classes-be-the-cause-of-it--tp32503960p32503 960.html Sent from the Castor - User mailing list archive at Nabble.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 - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it?
Hi, I can only second that statement about the (non-) cost of logging. Having said that, what kind of degradation are you actually observing ? Can you share some information with us on this subject ? Kind Regards Werner Guttmann On 26.09.2011 20:42, Thom Hehl wrote: Hi, Richard! If you look through the documentation for log4j, there is a trivial cost for supplying these log statements and probably much less if you turn them off. The cost of this is pretty minor and I wouldn't worry about it. -Original Message- From: Richard2011 [mailto:ricardo.alvar...@equifax.com] Sent: Monday, September 26, 2011 2:41 PM To: user@castor.codehaus.org Subject: [castor-user] Castor Performance Degradation - Can INFO messages, .cdr file or lot's of classes be the cause of it? My first reasonable question, can INFO messages as the following: INFO: org.exolab.castor.xml.UnmarshalHandler - #endElement: bind-xml INFO: org.exolab.castor.xml.UnmarshalHandler - #characters: Degrade the performance? (I see in the logs lot's of this messages - using Net Beans 6.9.1) and I was curious. Until it ends this type of messages it continues with normal processes. Can logging be the cause of castor degradation? 2.) I was reading about a .cdr file.. would this help? How can I generate one? 3.) I have at least 20 classes, some are nested on others.. is there any chance this can cause degradation as well? Or maybe that a mapping made in the xml file can be changed in order to improve performance? I really appreciate any assistance that anyone can give me... - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] using Queue as a collection
Hi Alan, why not create a feature request over at http://jira.codehaus.org/browse/CASTOR, and work with us on gettin this collection type potentially added. Kind Regards Werner Guttmann On 16.09.2011 17:29, Alan Hawrelak wrote: I am trying to use castor 1.3.1, where a collection is a java.util.Queue. Actually a ConcurrentLinkedQueueTQueueElement. When I try: Mapping mapping = new Mapping(); mapping.loadMapping(file://castorTestMapping.xml file:///\\castorTestMapping.xml );; It causes the error: Nested error: org.exolab.castor.xml.MarshalException: java.lang.IllegalArgumentException: java.util.Queue is not a valid FieldMappingCollectionType Is there some other collection that will work for this? Or an alternate way of doing this? Thanks. Here is the a part of the mapping file: class name=com.test.TQueue field name=queue_ collection=java.util.Queue type=com.test.TQueueElement get-method=getQueue set-method=setQueue bind-xml name=Queue/ /field field name=name_ type=java.lang.String get-method=getName set-method=setName bind-xml name=QueueName node=attribute / /field field name=type_ type=java.lang.String get-method=getType set-method=setType bind-xml name=QueueType node=attribute / /field /class class name=com.test.TQueueElement field name=payload_ type=org.exolab.castor.mapping.MapItem collection=map get-method=getPayload set-method=setPayload bind-xml name=queueItem class name=org.exolab.castor.mapping.MapItem field name=key type=java.lang.String /field field name=value type=java.lang.String / /class /bind-xml /field /class And the related java classes (simplified) are: public class TQueue { private QueueTQueueElement queue_; private String name_; private String type_; public TQueue() { queue_ = new ConcurrentLinkedQueueTQueueElement(); } public void add(TQueueElement element) { if ( element == null ) { throw new NullPointerException(); } queue_.add(element); } public synchronized String getName() { return name_; } public synchronized String getType() { return type_; } public synchronized void setName(String name) { if ( name == null ) { throw new NullPointerException(); } name_ = name; } public synchronized void setType(String type) { if ( type == null ) { throw new NullPointerException(); } type_ = type; } } public class TQueueElement implements Cloneable { private MapString,String payload_; public TQueueElement() { payload_ = new HashMapString,String(); } public String getEntry(String name) { return getPayload().get(name); } public MapString,String getPayload() { return payload_; } public String putEntry(String name, String value) { return getPayload().put(name, value); } public void setPayload(MapString,String payload) { if ( payload == null ) { throw new NullPointerException(); } payload_ = payload; } } - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor mapping file neded or not
Hi, On 26.08.2011 08:33, Pradeep_s83 wrote: Hi, I have generated java classes from xsd using castor source generation. Now for marshalling and unmarshalling do i need to use a castor mapping file? No, as during source code generation both POJOs and descriptor classes have been generated. When i am generating xml using marshaller class without setting a mapping xml i am getting proper xml response, but if i use the generated mapping file , xml node values are not populated for the custom java type nodes As long as you are making sure that both the POJOs and the descriptor classes are on the classpath, things should work out of the box. Cheers Werner - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] XML entity encoding
Hi, that's actually not Casto's job to do. Internally, Castor relies on Xerces XML serializing capabilities, so there's no way to 'force things'. What does your Xml actually look like ? Cheers Werner On 22.08.2011 20:59, Papendieck, Thomas wrote: Hi, how do I force castor-xml to convert e.g. '' into 'gt;' in content of text nodes? bye Thomas - 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
Re: [castor-user] [XML-Codegeneration] let setters return 'this'
Ho Thomas, I had a couple of thoughts on a similar subject (adding more fluency to Castor at a general level), but can I please ask you to defer this discussion to until GSoC has finished completely (which is not more than a few days off). I am not really in favour of simply changing all generated setters to return this instead of void, as this would break many existing contracts. But why not add additional methods that are designed with fluency in mind. Kind Regards Werner On 17.08.2011 10:20, Papendieck, Thomas wrote: Hello, how about having setters returnig 'this'? In my unittests I have to create a lot of dummy structures. Currently I create them in the 'setUp()' method eaven when the structure is shared by all the tests. If setters would return 'this' I could initialize Constants like this: RootNode rn = new RootNode() .setContainer1( new Container1().setContainee(new Containee())) .setContainer2(new Container1()) I'd love not to have to create a bunch one time references to create a Structure of castor objects. bye Thomas - 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
Re: [castor-user] [1.3.1] marshaller.setProperty(org.exolab.castor.indent, true); not working
Hi, as far as I remember, there were a lot of refactorings that got integrated into the 1.3.1 release, one of which rendered that feature useless again .. :-(. Now to my knowledge it was fixed for 1.3.2 again (a quick look into Jira should clear this up), and as part of 1.3.3 we are giving that code area some time and dedication again to maintain and improve stability. Kind Regards Werner On 09.08.2011 15:32, Papendieck, Thomas wrote: Hello, in http://www.mail-archive.com/user@castor.codehaus.org/msg07198.html Marshaller.setProperty operation not working with castor 1.2? has been statet that this bug was fixed in 1.3. But in my copy of 1.3.1 the Marshaller object still ignores the change I made... Am I missing some additional configuration here? bye Thomas - 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
Re: [castor-user] I need to use combination of keys in HashMap
Not to my knowledge. Cheers Werner On 04.08.2011 15:33, Giriraj Bhojak wrote: Can the field named key in the class mapping of org.exolab.castor.mapping.MapItem to point to more than one key? I mean I want to use two concatenated strings (fields )as the key in the hashmap. Thanks, Giriraj. - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Unmarshalling multiple xml to one class
Hi, as already said, XML data binding basically supports two operations: * unmarshalling: XML -- object instances * marshalling: object instances -- XML When you supply a mapping file for Castor XML, you are actually supplying enough information so that *both* operations have enough information that is *not* ambiguous. In your case, the mapping information you provide would be sufficient for the unmarshalling side of things, but would be AMBIGUOUS for marshalling (see my question below). As such, this is currently not supported out of the box. Regards Werner Guttmann On 14.07.2011 11:47, mdaoud wrote: Hi Werner, Thank you so much for your help. I am sorry as i am quite newbie to Castor i am bit lost. Basically, Class is just pojo class which has some properties (name,address,age,..) and i have some webservices operation like updateAge which passes the age, and i have updateName which passes the name. So i want to map those 2 requests to Class (as it will be bit trivial building class for every single request!!) Did i miss something?? Thanks, Werner Guttmann-6 wrote: HI, this is currently not possible with Castor XML. Whilst on the unmarshalling side this could be achievable, it would cause complete chaos on the marshalling side of things. What XML element would you Castor expect to use when you marshalled an instance of com.mycomp.pkg.Class. I hope this helps. Kind Regards Werner Guttmann On 14.07.2011 11:10, mdaoud wrote: Hi guys, I am quite new to use Castor and i would really appreciate if you can guide me to solve my problem. Basically, I am integrating Castor with Spring-ws. I would like to map multiple xml (SOAP requests) to the same class. when i try to define something like the code below, i get an error saying the class already in use! any way to solve this? class name=com.mycomp.pkg.Class map-to xml=firstSOAPRequest/ field name=name type=string bind-xml name=Name node=element/ /field field name=address type=string bind-xml name=Address node=element/ /field /class class name=com.mycomp.pkg.Class map-to xml=secondSOAPRequest/ field name=name type=string bind-xml name=Name node=element/ /field /class Thanks in advance, - 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
Re: Rv: Re: [castor-user] Re: Castor 1.3.1 is not available on MvnRepository
Hi, can I ask you a simple question ? Are you just downloading the JARs from those Maven repository pages, or are you really using Maven as a build tool ? It looks like you are not using Maven, as if you specified the dependency to castor-xml, Maven would download all (transitive) dependencies for you, incl. e..g castor-core (which holds the packages mentioned below). So are you actually using Maven ? Kind Regards Werner PS Btw, I am CCing the user mailing list. And I will look into your email problems. Btw, can I safely assume that you have subscribed to the mailing lists ? On 12.07.2011 17:54, Manuel Jordan wrote: Hello Werner Thanks so much for your support!!! I wrote a reply email to user@castor.codehaus.org but not appear in the mailing list nor I dont receive a rejected email, I dont know if this is normal, due this I am sending directly this email to you BTW I used these two maven dependencies (old version) !-- Castor -- dependency groupIdorg.codehaus.castor/groupId artifactIdcastor/artifactId version1.2/version /dependency !-- Castor - Xerces -- dependency groupIdxerces/groupId artifactIdxercesImpl/artifactId version2.9.1/version /dependency Well I needed the first dependency, 'Core' which is obvious the reason and 'Xerces' because I needed this package 'org.exolab.castor.xml.XercesSerializer', otherwise I got an exception if I only work with 'Core' Now with the follow dependency groupIdorg.codehaus.castor/groupId artifactIdcastor-xml/artifactId version1.3.2/version /dependency This dependency replace the two previous dependencies shown above and I got the same 'org.exolab.castor.xml.XercesSerializer' package required which was included with 'xerces', the second dependency. But I am confused, how I am getting these core packages only with 'castor-xml'? org.castor.core org.castor.core.exceptions org.castor.core.util where these three core dependencies appear on http://mvnrepository.com/artifact/org.codehaus.castor/castor/1.2 and not on http://mvnrepository.com/artifact/org.codehaus.castor/castor-xml/1.3.2 I am confused Thanks in advanced --- Manuel Jordan Elera Blog LinkedIn Senior Member Spring Community Forums Technical Reviewer of Apress - USA Pro SpringSource dm ServerSpring Enterprise Recipes: A Problem-Solution ApproachSpring Recipes: A Problem-Solution Approach, Second EditionPro Spring IntegrationPro Spring Batch - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Unmarshalling to empty string
Hi, On 31.05.2011 11:03, ranbaab wrote: Hi all, I am working on a web based application deployed on tomcat and planning to move to geronimo. The application was deploy to geronimo tomcat and run successfully(partially). Some of the page are having issue due to null pointer exception because the string without the default value return null after unmarshalling. In the schema, there is a string which does not have a default value. xs:attribute name=n-columns type=xs:string minOccurs=1 maxOccurs=1/ org.exolab.castor.builder.SourceGeneratorMain is used to generate the class, while the xml has the value n-columns= The generated default constructor does not set the string to it default value. public class SubGroup implements Serializable { private String _nColumns; public SubGroup() { } After the Unmarshaller.unmarshal(Configuration, reader) The string value is return null. But when the application is deployed with tomcat, the string value is return as string. I am wondering whether there is any jar conflict? I think you might be right here. I would search your geronimo installations to see whether there are any old Castor JARs configured/deployed. Regards Werner Thanks, Ranjan - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Re: [user-castor] - Lack of ValidationMessages resource bundle
Hi, that issue has already been fixed as part of 1.3.3 (on-going). Regards Werner On 16.05.2011 13:14, João Antunes wrote: Ok, got stuck at the mvn jar which gave me the output: [INFO] Invalid task 'jar': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal And due to my utter ignorance in Maven associated with the pressing urgency to get a class serialized, I just downgraded the castor version to 1.3.1 at least until the 1.3.2 is fixed. Best regards, *João Antunes* MsC in Communication Networks Engineering https://fenix.ist.utl.pt/cursos/merc?locale=en_EN at IST http://www.ist.utl.pt/en/about-IST/ Web: http://web.ist.utl.pt/~joao.a.p.antunes http://web.ist.utl.pt/%7Ejoao.a.p.antunes E-mail: joao.antu...@tagus.ist.utl.pt mailto:joao.antu...@tagus.ist.utl.pt LinkedIn: http://pt.linkedin.com/in/joaoapantunes *Instituto Superior Técnico - Centro de Informática/Direcção de Serviços de Informação* Software Engineer - FénixEDU team *Proud associate of **G3SI* http://g3si.netai.net/index.php?lang=en Em 16/05/11 11:12, João Antunes escreveu: Hi! I'm having trouble using the Castor lib as I get the following error (when using castor inside a struts webapp): -- Caused by: java.util.MissingResourceException: Can't find bundle for base name ValidationMessages, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1539) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1278) at java.util.ResourceBundle.getBundle(ResourceBundle.java:805) at org.exolab.castor.xml.Validator.clinit(Validator.java:78) -- And I do have the following Jars on my lib folder: castor-1.3.2-anttasks.jar castor-1.3.2-commons.jar castor-1.3.2-ddlgen.jar castor-1.3.2-xml.jar castor-1.3.2-codegen.jar castor-1.3.2-core.jar castor-1.3.2.jar castor-1.3.2-xml-schema.jar castor-1.3.2-jdo.jar Which after extracting them I could not find any file ValidationMessages* file, as executing this find . -iname validation* only got these results: ./org/exolab/castor/xml/validators/ValidationUtils.class ./org/exolab/castor/xml/ValidationContext.class ./org/exolab/castor/xml/ValidationException.class The file does exist in the source code though, I'm trying to build and to remake the Jar to see what is the problem, I'll post info if I get somewhere. -- *João Antunes* MsC in Communication Networks Engineering https://fenix.ist.utl.pt/cursos/merc?locale=en_EN at IST http://www.ist.utl.pt/en/about-IST/ Web: http://web.ist.utl.pt/~joao.a.p.antunes http://web.ist.utl.pt/%7Ejoao.a.p.antunes E-mail: joao.antu...@tagus.ist.utl.pt mailto:joao.antu...@tagus.ist.utl.pt LinkedIn: http://pt.linkedin.com/in/joaoapantunes *Instituto Superior Técnico - Centro de Informática/Direcção de Serviços de Informação* Software Engineer - FénixEDU team *Proud associate of **G3SI* http://g3si.netai.net/index.php?lang=en - 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
Re: [castor-user] cannot find method setPattern
Hi Anca, On 09.05.2011 17:18, Anca Dobrescu wrote: Hi everyone - I'm trying to use Castor XML Code generator 1.3.2 in my project. I'm invoking it through the Maven 2 plugin. What version are you using here ? I'm having the following error: *cannot find symbol symbol : method setPattern(java.lang.String) location: class org.exolab.castor.xml.validators.StringValidator* This method is actually called in one of the classes generated from my XSD. Here's the context: *//-- validation code for: _naissance fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope StringValidator typeValidator = new StringValidator(); typeValidator.setWhiteSpace(preserve); typeValidator.setPattern(\\d{4}-\\d{2}-\\d{2}); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator);* It seems that the setPattern method of the PatternValidator class has been deprecated some versions ago and no longer exists in the 1.3.2 version. In order to have a detailed look at this, can you please create a new Jira issue at http://jira.codehaus.org/browse/CASTOR and attach all relevant files for me to reproduce the problem. Thanks in advance. Cheers Werner So, if I'm not missing something, although the method no longer exists in the Castor XML 1.3.2 API it appears in code generated by this very API. Please let me know if there is something I'm missing or, if not, is there is a workaround to this problem. Thanks for taking the time to help me figure this out! -Anca - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] - Castor and Java annotations
Hi Joao, On 09.05.2011 09:05, João Antunes wrote: Hello! First of all, thanks for the contribute given to the O.S. community that the castor lib represents; also, please accept my apologies if an answer for this question already exists, meaning that I didn't search thoroughly enough for it. I was wondering if I can use Castor to map Annotations in fields/methods in Java to translate into XML location elements or XML attributes, No, it does not have support for XML annotations. There used to be active development on providing support for JAXB annotations, but that died off ... and to my knowledge is not finished. e.g.: -- Java file: [...] Class YPTO { @XPTOAnnotation{ yada } private String stringToPersist; public String getStringToPersist() { [...] into XML File: YPTO stringToPersist XPTOAnnotation=yadacontentofthestring/stringToPersist [...] or alternatively: YPTO XPTOAnnotation yada stringToPersistcontentofthestring/stringToPersist [or] YPTO XPTOAnnotation yada !-- Or even without the YADA, I really don't need the details of the annotations -- stringToPersistcontentofthestring/stringToPersist [...] -- As I could understand, the field element in the XML Mapping does not support the annotations. Is there any plugin/element that I missed to implement this? No, you have not missed anything. My end goal is to generate XHTML using XML which came from a JavaBean, the idea is to make a generic XSLT (or DVSL, whichever is easier [ I guess DSVL http://velocity.apache.org/dvsl/devel/ will be easier, also if anyone has any comment about this, feel free to give a hint :)]) that will pickup on the hints provided on the bean on the form of annotations (I will use annotations because I guess that is the way to go here, but I can go with something else if it's easier to implement ) to render the XHTML using a predetermined 'XHTML template'. In case a plugin doesn't exist, any info on how I should do this? writing a plugin/patch to the lib to implement this behaviour might be what I end up doing, ... Hmm, why not invest the time in trying to finish the support for the JAXB annotations ? I guess that's not the answer you've been looking for (at least not precisely), but let's see what you think of my answers. Cheers Werner as long as it's less time consuming than the alternative which is to define a XSD and use JAXB and a generic algorithm to interpret beans [which castor already does] and its annotations [which is what it would be perfect if castor already did had :)]. Thanks in advance, João Antunes - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Re: [castor-dev] Thinking about Castor 1.3.3
Hi Clovis, On 25.04.2011 16:01, Clovis Wichoski wrote: Hi Werner, I'm a user of castor since intalio manages the source, I know that i can help in some places, and many points, but for me the great problem is time to understand the castor code, before have a nice overview to touch any place. I agree that there's no nice overview which one could digest before looking at issues, etc. But there wasn't one when I joined Castor as a committer back in 2003. As such, it took me a lot of time to familiarize with major concepts. I think if exists a better documentation about castor internals architecture, ... What sort of 'documentation' would you expect ? more developers can come, as the codebase can be more understandable, today if anyone try to learn castor codebase, we always become lost and must ask someone to see if what we understand is really what castor does. That even happens to me, to be honest. Sometimes the code does not relate its intention. That's especially true when thereÄs commented out code and/or comments that are very hard to digest. Then, for my opinion, I think that a great contribution for the project is, if someone can write about how castor works internally or just the history how that developer becomes castor code aware. To be honest: debugging, most of the time. Especially when I run into (un)marshalling issues these days that are not trivial, without a debugger it would be very hard, if not impossible. I know if we debug, inspect each line of code, we can discover that, but I think that a resume, can attract more developers and speed up some solutions. Once again: what should the resume try to communicate ? I'd really like to understand your proposal fully. Cheers Werner best regards Clóvis 2011/4/20 Werner Guttmann wgut...@codehaus.org Hi everybody, I am actually thinking about going for much shorter development cycles when it comes to making Castor releases available. My intention - as already stated in the announcement email for Castor 1.3.2 - is to provide Castor 1.3.3 within 6 weeks (+/- 2 weeks) from the 1.3.2 release date. Whilst I would love to keep this rhythm up and going for a long time, my (our) resources are limited by nature. Still, here's my offer: I'll try to keep working towards 6 to 8 weeks cycles as long as there's more and improved input form the user community. How to interpret this ? Well, Castor has been an open source project now for 10+ years. And I'd like to see it that way for another 10 years. But I have already invested a lot of time into this project (having been a committer for the last 8 years), and it honestly feels quite 'lonely' out there from time to time. Having said that, I have seen some increased feedback on Jira issues in the weeks before the 1.3.2 release, and I believe that such feedback (whether in form of testing or patch provision or documentation patches or new HOW-TOs) does pay back, indeed. At least to me it did in the sense that it (once again) provided enough motivation to keep myself going and work towards the 1.3.2 release two weeks ago. A process that has been painful now an then, to be honest. Here's what I'd like to discuss in general terms and propose to/ask of the community in terms of making Castor more iterative and improve its quality/feature base: * The more communication we (committers) get, the more it feels like an open source project with actual involvement from the community. Most of the Jira issues we get to see are bug reports (for a valid reason, that is). But most of the time, that's it. Being an open source project, there's the sources. It actually is possible to assess the source code and identify a problem area. Not everyone is capable/willing to provide a patch out of nothing, but a patch does not have to actually include working code and resolve a problem completely. We are very happy to take patches that provide comments (that actually match the flow of a test case provided, that identify code areas that you think are wrong, ...), pseudo code, etc. * Communication is essential, indeed. There's Jira to report issues and have meaningful conversations (at least we try) about their resolutions. But there's more to an open source project. There's mailing lists, like this one, where the community can ask questions related to the product offerings. There's the dev list, which to my surprise seem to be highly unused. Why is this ? And more generally speaking: what else has been missed over the last years ? * How many people actually visit Castor's Jira instance on a regular base ? How many are actually 'reading' (aka following) the activity stream on the 'Summary' page '? How many are subscribed to the RSS feed representing this 'activity stream' ? * And most importantly, what are folks actually missing most from Castor ? Is there a genuine feeling that the product e.g. is not mature enough, lacks (certain) features, etc
Re: [castor-user] castor unmarshalling with xmlns and xmlns:xsi in root elemet with a mapping file
Hi Patrick, let's have a look at the root element of your XML instance: content xmlns=http://www.eclipse.org/jubula/client/archive/schema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; ... /content Clearly, you want the content element to be in the 'http://www.eclipse.org/jubula/client/archive/schema' XML name space. Now, in your mapping file, the class mapping for the corresponding Java class looks like this: class name=testdesigner.persistence.Content map-to xml=content/ field name=model type=testdesigner.models.TestDesignerModel direct=true bind-xml name=project node=element/ /field /class Problem is that you have not told Castor about the name space being used here, 'http://www.eclipse.org/jubula/client/archive/schema' in your case. Please change your map-to element as follows: class name=testdesigner.persistence.Content map-to xml=content ns-uri=http://www.eclipse.org/jubula/client/archive/schema/ field name=model type=testdesigner.models.TestDesignerModel direct=true bind-xml name=project node=element/ /field /class and you should be fine. Regards Werner On 26.04.2011 10:18, Patrick Möller wrote: Hi @ all. Sorry my provider always cuts off my email. I dont know why. I attached my previous email to this mail in a *.txt file Greetings Patrick Möller ___ WEB.DE DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt mit gratis Handy-Flat! http://produkte.web.de/go/DSL_Doppel_Flatrate/2 - 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
[castor-user] First snapshot release for 1.3.3
Hi, I have just pushed a first snapshot release of Castor 1.3.3 (1.3.3-SNAPSHOT) to the Codehaus snapshot repository [1]. Please download and use this snapshot release as soon as possible, and report any regression issues at the Jira instance at the Codehaus [2]. In addition, please test the issues already fixed in this snapshot release as indicated [2]. If you want to see any open issues being integrated with the code base other than those assigned to release 1.3.3, please make yourself heard. Making yourself heard means providing us with patches, fully fledged test cases, feedback, etc., in other words anything that *substantially* eases our lives as committers. Kind Regards Werner Guttmann [1]: http://nexus.codehaus.org/snapshots/org/codehaus/castor [2]: http://jira.codehaus.org/browse/CASTOR a - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Line breaks during Unmarshall process
Hi, sorry for picking this up again so late, but can I please ask you to create a Jira issue with the relevant files attached. Thanks Werner On 05.01.2011 15:45, Mohit Raj wrote: Yes am sure the problem relates to unmarshalling. Below is an example and also attached is the problem example. = Problem causing XML fragment: storeREGT# 1 1 1 148 90 /store Castor Unmarshaller bebug Output: #startElement: store #characters: REGT# #characters: 1 1 1 148 90 #endElement: store = If you observe in the output above content of store element is being shown in 2 lines (#characters) which is because of the fact that a new line character is introduced. Pl. see the attached full XML document. Also, do ignore the 14111 character position(mentioned in earlier in thread) as that was the position reported of tab delimited file from which the attached XML has been generated. Thanks, Mohit Raj -Original Message- From: Werner Guttmann [mailto:wgut...@codehaus.org] Sent: Wednesday, January 05, 2011 7:36 PM To: user@castor.codehaus.org Cc: Mohit Raj Subject: Re: [castor-user] Line breaks during Unmarshall process Hi, I am not sure I can follow fully. Can you please provide us with some sample XML to highlight the problem at hand ? And are you sure the problem is a problem related to unmarshalling, i.e. producing Java object instances from XML document(s) ? Cheers Werner On 05.01.2011 12:36, Mohit Raj wrote: Hi, I have been looking around the web and specifically on Castor site but in vain. I am facing the problem of new line character being introduced when using the org.exolab.castor.xml.Unmarshaller object. This happenes exactly when the character 14111 in the xml to be imported and converted to java objects has a white space on it. I have seen some suggestions like OutputFormat.setLineWidth(16384), but this method doesn't exist in my version of castor library (1.3 and 1.0.2), though at the same time, not sure if this would be of any help, as am unmarshalling against this being a solution for marshalling. Any help would be highly appreciated and let me know if you require any more details. Thanks, Mohit - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] [XML] Is it possible for Castor to generate POJOs AND mapping file from .xsd?
Hi Matthew, On 14.04.2011 23:50, Matthew Erler wrote: I have an Eclipse project that uses the Maven jaxb2 plugin to generate POJOs from an .xsd. Castor then uses those POJOs to pass data into a method in my web service application. So now when the .xsd is updated a quick 'mvn package' is all that's needed to update the POJOs and expose new/updated POJO methods to my code. I would like to transition that to Castor because I still need to manually update the Castor mapping file (castor-mapping.xml) when the .xsd changes. Is there a Castor plugin that will generate POJOs and the mapping file from an .xsd? Yes, the castor-maven-plugin from the Codehaus MOJO Project. But it seems like you've come across this already .. ;-). The documentation for castor-maven-plugin here: http://static.highsource.org/mjiip/maven-jaxb2-plugin/generate-mojo.html#generatePackage That URL definitely points to the maven-jabx-plugin. Have a look at http://mojo.codehaus.org/castor-maven-plugin/ for the complete documentation, and http://mojo.codehaus.org/castor-maven-plugin/usage.html for an introduction on how to use the plugin. Cheers Werner hints that it might be possible but I can't get it to work correctly if that's the way to go. Is there a tutorial around anywhere? I've Googled for a few hours myself. Here is the maven2 pom plugin that I'm using, which is throwing errors all over the place probably because I don't know what I'm doing: plugin groupIdorg.codehaus.mojo/groupId artifactIdcastor-maven-plugin/artifactId version2.0/version configuration schemasrc/main/webapp/WEB-INF/orderService.xsd/schema resourceDestinationsrc/main/java/resourceDestination destsrc/main/java/dest packagingcom.ideeksha.order.webservice/packaging generateMappingstrue/generateMappings warningstrue/warnings /configuration executions execution goals goalgenerate/goal /goals /execution /executions /plugin Here is my jaxb2 plugin in my pom that works. I would hope that moving this out in favor of a Castor plugin (with no changes to any other project files) should be a straightforward thing to do plugin groupIdorg.jvnet.jaxb2.maven2/groupId artifactIdmaven-jaxb2-plugin/artifactId executions execution goals goalgenerate/goal /goals configuration schemaDirectorysrc/main/webapp/WEB-INF/schemaDirectory generatePackagecom.ideeksha.order.webservice/generatePackage generateDirectorysrc/main/java/generateDirectory forceRegeneratetrue/forceRegenerate /configuration /execution /executions /plugin - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[castor-user] Thinking about Castor 1.3.3
Hi everybody, I am actually thinking about going for much shorter development cycles when it comes to making Castor releases available. My intention - as already stated in the announcement email for Castor 1.3.2 - is to provide Castor 1.3.3 within 6 weeks (+/- 2 weeks) from the 1.3.2 release date. Whilst I would love to keep this rhythm up and going for a long time, my (our) resources are limited by nature. Still, here's my offer: I'll try to keep working towards 6 to 8 weeks cycles as long as there's more and improved input form the user community. How to interpret this ? Well, Castor has been an open source project now for 10+ years. And I'd like to see it that way for another 10 years. But I have already invested a lot of time into this project (having been a committer for the last 8 years), and it honestly feels quite 'lonely' out there from time to time. Having said that, I have seen some increased feedback on Jira issues in the weeks before the 1.3.2 release, and I believe that such feedback (whether in form of testing or patch provision or documentation patches or new HOW-TOs) does pay back, indeed. At least to me it did in the sense that it (once again) provided enough motivation to keep myself going and work towards the 1.3.2 release two weeks ago. A process that has been painful now an then, to be honest. Here's what I'd like to discuss in general terms and propose to/ask of the community in terms of making Castor more iterative and improve its quality/feature base: * The more communication we (committers) get, the more it feels like an open source project with actual involvement from the community. Most of the Jira issues we get to see are bug reports (for a valid reason, that is). But most of the time, that's it. Being an open source project, there's the sources. It actually is possible to assess the source code and identify a problem area. Not everyone is capable/willing to provide a patch out of nothing, but a patch does not have to actually include working code and resolve a problem completely. We are very happy to take patches that provide comments (that actually match the flow of a test case provided, that identify code areas that you think are wrong, ...), pseudo code, etc. * Communication is essential, indeed. There's Jira to report issues and have meaningful conversations (at least we try) about their resolutions. But there's more to an open source project. There's mailing lists, like this one, where the community can ask questions related to the product offerings. There's the dev list, which to my surprise seem to be highly unused. Why is this ? And more generally speaking: what else has been missed over the last years ? * How many people actually visit Castor's Jira instance on a regular base ? How many are actually 'reading' (aka following) the activity stream on the 'Summary' page '? How many are subscribed to the RSS feed representing this 'activity stream' ? * And most importantly, what are folks actually missing most from Castor ? Is there a genuine feeling that the product e.g. is not mature enough, lacks (certain) features, etc. ? I most definitely do acknowledge that Castor is a complex project, especially in terms of its code base (with major parts having been written around 2000), which could use some heavy refactoring. But in the end this needs to be a community effort, and that's what I'd like to see happen. Thanks for your time reading this, and thanks (once again) to everybody that provided well-though feedback and input during the last few weeks. And please do not hesitate to ask questions as a result of this email. Kind Regards Werner Guttmann - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: 答复: [castor-user] Exception while mapping a java.util.List attribute
What kind of objects does your list actually hold ? Are there subclasses of Vehicles ? What XML are you actually getting, and what XML artefacts would you like to see produced ? Cheers Werner On 19.04.2011 13:02, Jose Antonio wrote: Thank you for your reply. It works fine, but now, I'm having another problem related to this. When I marshall the object, the vehicle tags in the xml file doesn't contain the xsi:type attribute. For that reason, when I unmarshall the object I get an error. Do you know how can I specify this attribute in the mapping file so that it appears in the resultant xml file? I've tried using the type attribute of bind-xml tag but it doesn't work. Thank you very much. 2011/4/19 吕晓一 lvxia...@aspire-tech.com Hi, here is an example. myClass vehiclelist vehicle/ vehicle/ /vehiclelist /myClass You should define a Vehicle class and a mapping-file for it, and you should include this mapping-file in the main mapping-file include href=”VehicleMap.xml”/ class name=your.package.MyClass auto-complete=true map-to xml=myClass/ field name=vehicles type=your.package.Vehicle collection=arraylist bind-xml name=vehicle” node=element location=vehiclelist/ /field /class *发件人:* Jose Antonio [mailto:jagavi...@gmail.com] *发送时间:* 2011年4月19日 15:33 *收件人:* user@castor.codehaus.org *主题:* [castor-user] Exception while mapping a java.util.List attribute Hello, I've got a problem mapping a class whose one of its attributes is a java.util.List. I'm getting the following exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xmlContext' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: list is not a valid FieldMappingCollectionType at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) ... 154 more Caused by: java.lang.IllegalArgumentException: list is not a valid FieldMappingCollectionType at org.exolab.castor.mapping.xml.types.FieldMappingCollectionType.valueOf(FieldMappingCollectionType.java:249) at org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoader.java:625) at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDescriptors(AbstractMappingLoader.java:408) at org.exolab.castor.xml.XMLMappingLoader.createClassDescriptor(XMLMappingLoader.java:231) at org.exolab.castor.mapping.loader.AbstractMappingLoader.createClassDescriptors(AbstractMappingLoader.java:255) at org.exolab.castor.xml.XMLMappingLoader.loadMapping(XMLMappingLoader.java:152) at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:164) at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:130) at org.exolab.castor.xml.XMLContext.addMapping(XMLContext.java:82) at org.castor.spring.xml.XMLContextFactoryBean.afterPropertiesSet(XMLContextFactoryBean.java:121) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 164 more What I am trying to do is: I want the java.util.List attribute to be mapped with a diferent name in the xml file. For example, if the attribute is: private ListVehicle vehicles; I want this attribute to be mapped with the name
Re: [castor-user] Re: UnmarshalHandlerMessages ValidationMessages
Yes, you are right, they should be in those files. And the Maven JARs uploaded to the Codehaus repo (and replicated globally) have those resource file included. It's only with the regular JARS available at http://dist.codehaus.org/castor that seem to have these problems. And I guess this is a result of a broken Ant build we are still using, which has not really been maintained properly. Can you please open a new Jira issue and I will make the required changes and push the XML JAR again ? Cheers Werner On 14.04.2011 22:08, Craig Tataryn wrote: I think perhaps these .properties files aren't getting built into the .jar files? Both of those .properties files should be in the castor-xml jar right? I see them in svn here: http://svn.codehaus.org/castor/castor/trunk/xml/src/main/resources/ Craig. On 2011-04-14, at 2:06 PM, Craig Tataryn wrote: Hi, when running the test case from http://jira.codehaus.org/browse/CASTOR-2963 with the 1.3.2 release jars I was faced with errors concerning the absence of two resource bundles: UnmarshalHandlerMessages ValidationMessages To get past this I simply added two blank .properties files to the root package of the test case and it proceeded. Is this something new for castor 1.3.2? Craig. - 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
[castor-user] Re: [castor-announce] [ANNOUNCEMENT] Castor 1.3.2 Released
Hola Victor, I have just re-uploaded the JARs for the XML and DDLGEN parts of Castor so that all files are 1.5-compliant. Kind Regards Werner Guttmann On 07.04.2011 19:54, Werner Guttmann wrote: Hola Victor, let me look into this in detail. The Maven build is definitely configured to produce 1.5-compliant class files, but I have to cross-check the binary files uploaded to http://dist.codehaus.org/castor/1.3.2/ Can you please raise a Jira issue with this information ? Kind Regards Werner On 07.04.2011 00:16, Victor Manuel Iniestra Alvarez wrote: On 01:59 p.m., Werner Guttmann wrote: Hi, on behalf of the Castor team, I am very pleased to announce the release of Castor version 1.3.2. http://castor.codehaus.org/ To get this update through Maven, simply specify the version in your project's POM as follows (using Castor XML as a sample: dependency groupIdorg.codehaus.castorgroupId artifactIdcastor-xml/artifactId version1.3.2/version /dependency Alternatively, Castor 1.3.2 can be downloaded from the Codehaus at http://dist.codehaus.org/castor/1.3.2/ . Hi I have downloaded the version from the link and I'm getting this error: GRAVE: El Servlet /documentaPVM lanzó excepción de load() java.lang.UnsupportedClassVersionError: Bad version number in .class file (no puedo cargar clase org.exolab.castor.mapping.MappingException) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2822) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at mx.com.bibs.util.castorbean.database.DataBaseParser.busca(DataBaseParser.java:202) at mx.com.bibs.util.castorbean.CastorBean.get(CastorBean.java:58) at mx.com.bibs.Sherpa2seg.business.local.facade.JdoGenericaFacadeImpl.init(JdoGenericaFacadeImpl.java:43) The project works well on castor-1.3; I'm working on Tomcat 6 / SUN JDK 5.0. Is this version intended for Java 6? Thanks - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Castor xml: some problems of using the include of mapping element.
Hi, is this actually a regression issue with Castor 1.3.2, or are you reporting an issue that has been in place already with previous versions as well ? Anyhow, please raise a Jira issue with this information. Kind Regards Werner On 07.04.2011 06:35, 吕晓一 wrote: The attached is my test code. Based on Castor1.3.2. My main map xml file is TestModel1Map.xml, it includes another map file named TestModel2Map.xml, I found below code cannot load the TestModel2Map.xml. InputStream in = getClass().getClassLoader().getResourceAsStream(mappingFile); InputSource source = new InputSource(in); Mapping mapping = new Mapping(); mapping.loadMapping(source); XMLContext context = new XMLContext(); context.addMapping(mapping); and below code will work correctly URL fileUrl = getClass().getClassLoader().getResource(mappingFile); Mapping mapping = new Mapping(); mapping.loadMapping(fileUrl); XMLContext context = new XMLContext(); context.addMapping(mapping); - 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
Re: [castor-user] Castor XML: how to reuse the field-handler by implementintg the ClonableFieldHandler
Hi Craig, Hi ?, the test case used in this issue used to work for me before applying that patch. So in case there's still code that does not work, I'd love to know. Kind Regards Werner On 07.04.2011 16:27, Craig Tataryn wrote: Hello, this is a known issue. We thought we might have had a solution for 1.3.2 but the unit test attached to the JIRA still fails :( http://jira.codehaus.org/browse/CASTOR-2963 It's been a thorn in my side too, when I have time I'll look into why the patch Werner applied didn't work. Craig. On 2011-04-07, at 1:19 AM, 吕晓一 wrote: Hi, all My project has lots of models and map files, and has many date type fields in these models and map files, When the models are converted to xml files, the date-format in xml files are required to be same, so I want to define a field-handler in the main map file, and reuse this field-handler in any class. I has tried many times, and was told to implement the new interface of ClonableFieldHandler. So, anybody could show me an example? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [castor-user] Unable to find the Field description for an XML simple type element
Hi Mark, can I please ask you to attach those files to a Jira issue, and even better, provide me with one more more test cases that enable us to replay the problem(s) at hand. Thanks in advance Werner On 07.04.2011 17:51, Mark Harvey wrote: We are currently using Castor to un/marshal our XML, using a DTD for validation. We are considering moving over to a schema instead. I have encountered an issue when Castor appears to be looking through the mapping file for a specific field, which is mapped from a simple XML element. The field has been declared along with its parent class, as these are known to work with the DTD. We have been able to trace the issue down to what appears to be a specific combination of fields, mapped to attributes and elements. Enclosed are sample XML files which when run through the enclosed test, trigger the exception (org.exolab.castor.xml.MarshalException: unable to find FieldDescriptor for ... in ClassDescriptor of ...{File: [not available]; line: 8; column: 13}). Regards, Mark - 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