Re: Parser failed for unicode characters

Aleksander Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
Nikhil C. Khedkar wrote:

>   well I will be using PullParser2_1_8_SMALL.jar
>only. Can you please fix the problem and mail me? I am
>attaching the xml file.
>  
>
hi Nihil,

thanks for test file it was very helpful

get the current version from CVS:

cvs -d :pserver:[email protected]:/l/extreme/cvspub login
CVS password: cvsanon

cvs -d :pserver:[email protected]:/l/extreme/cvspub co xsoap-java/PullParser

i have also uploaded it to 
http://www.extreme.indiana.edu/xgws/xsoap/xpp/download/
as 1.2.9 RC2.

here is what i get when i run simple XPP count sample:

C:\Forge\codes\xsoap\java\PullParser>run commandline.XppCountMain -f 
org.gjt.xpp.impl.PullParserFactoryFullImpl -c UTF8 i18n.xml
JAVA_HOME=c:\jdk1.3
c:\jdk1.3\bin\java   -cp 
build\lib\PullParser2_1_9rc2_X2.jar;build\lib\PullParser2_1_9rc2_SMALL.jar;
build\lib\PullParser2_1_9rc2_INTF.jar;build\lib\PullParser2_1_9rc2.jar;build\classes;build\samples;b
uild\tests;lib\xerces2_patched\xercesImpl_2_0_1_event_position_patch.jar;lib\junit\junit37.jar;  
com
mandline.XppCountMain  -f org.gjt.xpp.impl.PullParserFactoryFullImpl -c 
UTF8 i18n.xml
StartTag={ 'h' attArr=[  'xmlns:h'='http://www.actuate.com/i18n'  
'xmlns:xsi'='http://www.actuate.co
m/i18n/XMLSchema-instance'  'xsi:schemaLocation'='http://www.actuate.com 
i18n.xsd'  ] }
Content={'\n\n'}
StartTag={ 'h:????' }
Content={'\n  '}
StartTag={ 'h:????' attArr=[  '??name'='?????????'  ] }
Content={'\n\t???????\n  '}
EndTag={ 'h:????' }
Content={'\n'}
...
EndTag={ 'h:noteikt?s' }
Content={'\n\n'}
EndTag={ 'h' }
statistics: 25 elems, 15 attrs, 510 chars

also make sure that you set manually correct encoding for XPP2 or it 
will fail (it does not do auto detection)
- you need to construct correct Reader to pass to XmlPullParser
(to achieve use something like this new InputStreamReader(new 
BufferedInputStream(in), charsetName)
and see src/java/samples/commandline/XppCountMain.java for more details)
if you do not set it correctly then XPP2 uses your machine default and it
is typically 8bit encoding (like ISOLatin2) and not  UTF8 that is in 
your XML file ...

c:\jdk1.3\bin\java   -cp 
build\lib\PullParser2_1_9rc2_X2.jar;build\lib\PullParser2_1_9rc2_SMALL.jar;
build\lib\PullParser2_1_9rc2_INTF.jar;build\lib\PullParser2_1_9rc2.jar;build\classes;build\samples;b
uild\tests;lib\xerces2_patched\xercesImpl_2_0_1_event_position_patch.jar;lib\junit\junit37.jar;  
com
mandline.XppCountMain  -f org.gjt.xpp.impl.PullParserFactoryFullImpl 
i18n.xml
Exception in thread "main" org.gjt.xpp.XmlPullParserException: only 
whitespace content allowed outsi
de root element at line 2 and column 3 seen "...<?xml version="1.0" 
encoding="utf-8"?>\r"... (parser
 state CONTENT)
        at org.gjt.xpp.impl.pullparser.PullParser.next(PullParser.java:417)
        at shared.count.XppCount.prettyParse(XppCount.java:119)
        at shared.count.XppCount.runTest(XppCount.java:216)
        at commandline.XppCountMain.run(XppCountMain.java:131)
        at commandline.XppCountMain.main(XppCountMain.java:60)

let me knwo if it fixed your problem (or what is still not working).

thanks,

alek

-- 
The ancestor of every action is a thought. - Ralph Waldo Emerson 



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/2U_rlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.