[SoapRMI] Re: [SoapRMI] About-XmlPullParserFactory
Aleksander Slominski
aslom_at_cs.indiana.edu
Tue, 17 Dec 2002 20:33:02 -0500
hi,
as far as i can see it is *bug* in JSX that it is not supporting fully
XML 1.0 ...
did you use the latest version of JSX (they have both JSX1 and JSX2) as
it seems thaye may be using "home grown" XML parser (see this entry
(...) /XML1.0 spec/: either " or ' now can be used to delimit attribute
values. Also, > characters are now permitted within attribute values.
Both changes are to hew closer to the XML 1.0 specification. The empty
tag was also implemented.(...) in
http://www.csse.monash.edu.au/~bren/JSX/done.html) that may indicate
that its comaptibility with XML limited (but improving) so they may
appreciate if you report the problem to their mailing list as an
incorrect assumption about what needs to be escaped in XML attribute
value: http://groups.yahoo.com/group/JSX-ideas/messages
hope it helps.
alek
nodep_at_libero.it wrote:
>Hi,
>yes I'm having parsing errors with JSX's parser (the other tool I'm using)
>because it find this:
>valueOf='<work alias-ID="0" s="23.6"> </work>',
>instead of:
>valueOf='<work alias-ID="0" s="23.6"> </work>'.
>in the output of method writeNode.
>
>The error is:
>JSX.ParserXML$ExceptionXML: Line 1: Expected matching ''', but got '"'
>...
>
>As I understand, it's looking for apostrophe and it find quotation mark.
>
>I found the workaround: in the line (*) of previous message, if I replace quotation mark(")
>with apostrophe(') inside the value of valueOf attribute, all go OK.
>(i.e. I always serialize: String state="<work alias-ID='0' s='23.6'> </work>"
>and not: String state="<work alias-ID=\"0\" s=\"23.6\"> </work>" )
>For now I use this workaround until I'm not sure if it's a XSOAP-problem or JSX-problem.
>
>Thanks!
>
>Stefano Pedon
>
>
>
>nodep_at_libero.it wrote:
>
>
>
>>I'm trying (again...) to write a (de)serializer and
>>in readObject() method I use this piece of code:
>>
>>public Object readObject(
>> DeserializeContext dctx,
>> EncodingStyle enc,
>> Class expectedClass,
>> XmlJavaTypeMap map,
>> XmlPullParser pp,
>> XmlStartTag stag)
>> throws DeserializeException, XmlPullParserException, IOException
>> {
>> byte b=pp.next();
>> XmlPullParserFactory ppf=XmlPullParserFactory.newInstance();
>> XmlNode nodeTree=null;
>> try {
>> nodeTree = ppf.newNode(pp);
>> } catch(Exception ex) {
>> throw new DeserializeException(
>> "can't deserialize input into XML node tree"
>> +pp.getPosDesc(), ex);
>> }
>> StringWriter sw=new StringWriter();
>> ppf.writeNode(nodeTree, sw, true);
>>...
>>
>>
>>
>hi,
>
>this code looks OK.
>
>
>
>> (*)<java.lang.String alias-ID="2" obj-name="state" valueOf="<work alias-ID="0" s="23.6">
>>
>>
>>
>
>
>
>>but the output of "ppf.writeNode(nodeTree, sw, true)" is:
>>
>>(*)<java.lang.String alias-ID='2' obj-name='state
>>
>>
>
>
>
>they are equivalent as from XML point of view whetehr attribute has
>apostrophe (') or quotation mark (") used for enclosing of attribute
>value is irrelevant. inside attribute value only <,>,& and " must be
>escaped if attrubute value is enclosed in apostrophes (see
>http://www.w3.org/TR/REC-xml#NT-AttValue and look that |AttValue
>requires escaping only of ||[^<&"] or ||[^<&'])|
>
>
>
>>The problem is that "writeNode" has translated the value of attribute
>>"valueOf", in the row (*), in a legible form, but it souldn't... I think.
>>
>>
>>
>this is required to escape attribute value ot make into valid XML -
>translatin back is done automatically by parser and when you read
>String vcalue of attribute "valueOf" it will be back the same as you
>have put it.
>
>
>
>>What's wrong?
>>
>>
>>
>as far as i can tell by looking on XML outout all shoul dbe just fine
>and XSOAP/XPP combo does good job if generaating corect and as small as
>possible XML serialization of XmlNode escaping only _required_
>characters. do you get any parsing error?
>
>thanks,
>
>alek
>
>
>
--
"Mr. Pauli, we in the audience are all agreed that your theory is crazy.
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr