Okay, noted that castor doesn't play well with bytes and InputStreams, so
changed it to Clob, CharSequence, and Reader. Wrote a handler that returned
the string:
<field cst:name="objectChars"
cst:handler="com.abc.persist.castor.XMLHandler"
cst:type="string">
<bind-xml name="object" node="element"/>
</field>
This got the same as just treating it like a string:
'...<object><sip>xxxx</sip></object>...'
When I try to unmarshal a correct xml fragment
'...<da:object><sip>xxxx</sip></da:object>...', I get an exception:
2796 [main] INFO PersistCommandTest#111 - caught
java.lang.NullPointerException
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:763)
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1127
)
...
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 5:42 PM
To: [email protected]
Subject: Re: [castor-user] [xml] dealing with xs:anyType
Dean,
By default Castor marshals byte arrays as base64 encoded, because a byte
array often contains characters that are invalid for xml encoding. This
behavior can be changed by writing a custom field handler that converts
the byte array into a string value.
--Keith
Andrews, Dean (END-CHI) wrote:
> I have a xsd schema that includes an xs:anyType.
> My class exports this as either byte[] (get...Bytes) or InputStream
> (get...Stream) it is backed by a blob. The Mapping generator produced
> output for both these accusers as if they where attributes. On another
> class this includes a pair dealing with remainder, i.e., the un mapped
> elements.
>
> Okay the first issue is how to get the content of these into the output as
> xml?
> If I select the bytes, it encodes them:
> <field cst:name="objectBytes" cst:type="bytes">
> <bind-xml name="object" node="element"/>
> </field>
> <field cst:name="objectStream"
> cst:type="java.io.InputStream" transient="true"/>
>
> <object>eHh4eA==</object>
>
> If I select the stream it just gives me:
> <field cst:name="objectBytes" cst:type="bytes"
> transient="true"/>
> <field cst:name="objectStream"
> cst:type="java.io.InputStream">
> <bind-xml name="object" node="element"/>
> </field>
>
> <object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="java:java.io.ByteArrayInputStream"/>
>
>
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------