Results 1 to 10 of 10

Thread: Access to the Marshaller properties

  1. #1
    Join Date
    Mar 2006
    Posts
    4

    Default Access to the Marshaller properties

    Thanks for the great work.

    In the OXM package, do you have any plans to expose the various marshaller properties? For instance the ability to 'pretty print' the XML file resides in the jaxb.formatted.output for JAXB and in the XMLOptions class for XMLBeans. Or am I missing something?

    Thanks!

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by slepage_dhs
    Thanks for the great work.
    Thanks!

    Quote Originally Posted by slepage_dhs
    In the OXM package, do you have any plans to expose the various marshaller properties? For instance the ability to 'pretty print' the XML file resides in the jaxb.formatted.output for JAXB and in the XMLOptions class for XMLBeans. Or am I missing something?
    You're not missing something, though the XmlBeansMarshaller already has a setter for a XmlOptions object. It just so happens that XmlOptions does not follow the JavaBeans contract, so that you cannot configure it in your application context. So I guess we will need to make some sort of XmlOptionsFactoryBean.

    In any case, it sound like a great feature to add. I've created a JIRA issue for it here: http://opensource2.atlassian.com/pro.../browse/SWS-16, which you can scan to track progress. We'll probably include this in the next release, scheduled for the beginning of April.

    Cheers,
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Mar 2006
    Posts
    4

    Default

    Many thanks. I look forward to seeing it.

  4. #4
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Added in CVS.

    JaxbMarshaller now has a marshallerProperties and a unmarshallerProperties. These can be used to set JAXB properties on the underlying marshaller and unmarshaller respectively. For instance, to pretty print the output XML, use "jaxb.formatted.output" as a key, and true as a value.

    Additionally, a validating property was added to the JaxMarshaller, to validate incoming XML.

    I also created an XmlOptionsFactoryBean. It has an options property, which can be used to specific XMLBeans options. For instance, to pretty print the output XML, use "SAVE_PRETTY_PRINT" as a key, and true as a value. The possible options can be found here.

    Cheers,
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  5. #5
    Join Date
    Mar 2006
    Posts
    4

    Default

    Thanks for the great and quick work.

    There is an issue with this solution however when using JAXB 2.0 mapped classes. The setValidating method is deprecated for JAXB 2.0 Unmarshallers and when called throws an UnsupportedOperation exception. According to the API we need call the setSchema(javax.xml.validation.Schema schema) to enable validation. I don't know if the intention was support JAXB 1.0 and 2.0 but in my case 2.0 was requested by the architect.

    Thoughts?

  6. #6
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by slepage_dhs
    There is an issue with this solution however when using JAXB 2.0 mapped classes.
    Yes, an issue was already created for this, and it has been fixed in CVS. However, since anonymous CVS has not been in sync with developer CVS, it pretty difficult to get the new sources :-(. Hopefully, this will be fixed by sourceforge soon.

    Cheers,
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  7. #7
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    As a quick workaround, you can comment out the setValidating() in the sources you downloaded as part of the release, and do an "ant dist" to create a new spring-oxm jar.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  8. #8
    Join Date
    Mar 2006
    Posts
    4

    Default

    I was heading in that direction. Thank you again for your quick response on this. Sorry I didn't catch the JIRA issue before I posted. Any eta on the release of the fix?

  9. #9
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by slepage_dhs
    Any eta on the release of the fix?
    Well, I don't have a release planned for this month, because there are still a lot of outstanding issues to be implemented. But I do want to make nightly builds available asap. Stay tuned.

    Cheers,
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  10. #10
    Join Date
    Apr 2005
    Posts
    6

    Default oxm namespace support for setting marshaller properties

    Hi Arjen,

    Is it possible that we can extend the functionality so that you can also set these properties by using the oxm schema namespace?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •