Announcement Announcement Module
Collapse
No announcement yet.
CastorMarshaller and multiple mapping files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CastorMarshaller and multiple mapping files

    Hi

    [ I've moved this thread from the Core forum to it's correct home ]

    Does anyone know how to configure CastorMarshaller so that it can take in multiple mapping files?

    This is what I have at the moment, which works fine:

    Code:

    <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarsha ller" lazy-init="true">
    <property name="mappingLocation" value="classpath:castor-mapping.xml"/>
    </bean>

    But, I want it to take two mapping files. I've tried various ways of entering more than one, but none of them seem to work. Is it a limitation of this class?

    If so, could anyone suggest how to extend it (perhaps) so it can accept more thank one mapping file?

    Thanks!

  • #2
    I don't know if Castor actually supports multiple mapping files. I would check the Javadoc, but the castor web site appears to be down right now.

    If it does support multiple mappings, you can create a JIRA issue, and I will implement the feature.

    Comment


    • #3
      Hi

      Yep, if you call:

      Code:
      mapping.loadMapping(new InputSource(resource.getInputStream()));
      multiple times, it adds subsequent mapping files rather than replacing the original ones. I've tried it here and it works nice if mappingLocations is an ArrayList.

      Incidentally, I might be talking nonsense here, but I would have liked to extend CastorMarshaller and simply override createClassDescriptorResolver() with my behaviour. But since it's private, I couldn't. Would it be worth making it protected instead?

      BTW my reason for wanting multiple mapping file support is probably one that other people will have too, so it'll probably be useful. Basically, we have a standard 'letter envelope' that is shared by lots of systems. The envelope mapping is standard, then each system has their own 'letter contents' mapping file. I'll add a request to JIRA.

      Regards

      Richard

      Comment


      • #4
        Originally posted by richardgundersen View Post
        Hi

        Yep, if you call:

        Code:
        mapping.loadMapping(new InputSource(resource.getInputStream()));
        multiple times, it adds subsequent mapping files rather than replacing the original ones. I've tried it here and it works nice if mappingLocations is an ArrayList.
        Ok, I will fix the issue you registered.

        Originally posted by richardgundersen View Post
        Incidentally, I might be talking nonsense here, but I would have liked to extend CastorMarshaller and simply override createClassDescriptorResolver() with my behaviour. But since it's private, I couldn't. Would it be worth making it protected instead?
        I will fix that as well.

        Comment

        Working...
        X