I know it's not ideal, but for Marshalling you'll most likely have to convert your String value back into an AnyNode instance which can be done using the Unmarshaller. :-)

So something like:

    public Object convertUponGet(Object value) {
        if (value == null) return null;\
        try {
            Unmarshaller unm = new Unmarshaller(AnyNode.class);
            return unm.unmarshal(new StringReader(value.toString());
        }
        catch(Exception ex) {
            // TODO: add error handling
        }
        return null;
    }

The only other solution I can think of is to find a way to prevent the Xerces Serializer from escaping your string, either by using your own custom serializer (SAX ContentHandler) or by configuring the output format options from the Xerces Serializer and adding the parent element of the <inner> element to the list of non-escaping elements.

--Keith


Matt Secoske wrote:
OK. The marshalling doesn't work, like you predicted. I get this: <inner xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"; xsi:type="java:java.lang.String ">
...followed by escaped XML, including the declarator.

Any thoughts?

- Matt



On 3/29/06, * Matt Secoske* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Yeah, I haven't done that yet (not needed like you said), and was
    kindof worried about that.  I will try some things with it and see
    what I come up with.

    No problem on the how-to.  I know I spent a good deal of time trying
    to figure this out, so I'm sure someone else could find a use for it.

    - Matt


    On 3/29/06, * Stephen Bash* <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:

        Matt-

        Have you tried marshalling the objects created by Castor using the
        same mapping file?  If it isn't important to your application, you
        probably don't need to worry about it, but I think in the past
        there
        has been a problem with the serializer escaping XML in strings
        so that
        the file doesn't look as expected (lots of &lt; entities floating
        around).

        Thanks for working on the how-to!

        Stephen





--
Matt Secoske
http://blog.secosoft.net


-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to