users@jaxb.java.net

Re: "unexpected character literal " Validation Exception

From: Sam Cheung <sylcheung_at_hotmail.com>
Date: Wed, 25 Feb 2004 18:35:42 +0000

Ryan,

I tried your suggestion, it points to the SAME location.

And I check the schema, the element casuing the problem is defined as this:
<xs:element name="Details" type="tns:anyDataType" minOccurs="0"/>
....
<xs:complexType name="anyDataType">
                <xs:annotation>
                        <xs:documentation>Any element and attribute </xs:documentation>
                </xs:annotation>
                <xs:complexContent>
                        <xs:restriction base="xs:anyType">
                                <xs:sequence>
                                        <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
                                </xs:sequence>
                        </xs:restriction>
                </xs:complexContent>
        </xs:complexType>


My souce is this:
".... <Details>No valid recipients</Details> ...."

Is there anyway to work around this bug? Kohsuke said it is a JAXB bug.
I appreciate any help.

I try to get the value of 'details' from the class built by JAXB, it is
empty.

Thank you.




>From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
>Reply-To: users_at_jaxb.dev.java.net
>To: users_at_jaxb.dev.java.net
>Subject: Re: "unexpected character literal " Validation Exception
>Date: Wed, 25 Feb 2004 10:12:07 -0500
>
>Sam Cheung wrote:
>
>>
>>Kohsuke,
>>
>>Thank you for your help.
>>
>>But I am not sure how to correct my document.
>>
>>I reformat and dumb out the content (the stream I send to unmarshaller)
>>to the screen.
>>
>>The locator has different values (since I reformat the input)
>>columnNumber = 47
>>lineNumber = 7
>>
>>When I check line 7, the content is " <Details>No valid
>>recipients</Details>".
>>
>>I evaluate this " <Details>No valid
>>recipients</Details>".length() in my debugger,
>>and it returns (int) 46
>>
>>And this line it only has 46 characters. And JAXB is looking at 47?
>>
>>if so, how can I work around this other than return true in my event
>>handler?
>>
>>Thanks for any more tips.
>>
>
>Sam,
>
>Validation event location info isn't very complete when you unmarshal
>from InputStream. You might want to try placing your xml data in a
>file and then try unmarshalling it as both a File and an InputStream,
>just to see if there is any difference in behavior:
>
> Object o1 = u.unmarshal(new File("foo.xml"));
> Object o2 = u.unmarshal(new FileInputStream("foo.xml"));
>
>Thanks,
>
>--Ryan
>
>
>
>>
>>
>>
>>
>>>From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
>>>Reply-To: users_at_jaxb.dev.java.net
>>>To: users_at_jaxb.dev.java.net
>>>Subject: Re: "unexpected character literal " Validation Exception
>>>Date: Tue, 24 Feb 2004 15:55:06 -0800
>>>
>>>
>>> > What should I do in my own event handler?
>>> > Currently , i just return true. Will the unmarshaller continue to
>>>unmarshal
>>> > with the rest of the inputstream?
>>>
>>>It tries to do its best, but you probably want to fix the error in your
>>>document anyway.
>>>
>>> > And column 393 is the close tag of an element.
>>>
>>>So the text right before the end tag was unexpected.
>>>
>>>regards,
>>>--
>>>Kohsuke Kawaguchi
>>>Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>

_________________________________________________________________
Get a FREE online computer virus scan from McAfee when you click here.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net