users@jaxb.java.net

Re: "unexpected character literal " Validation Exception

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
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