[SoapRMI] About-XmlPullParserFactory

nodep@libero.it nodep_at_libero.it
Fri, 13 Dec 2002 15:02:45 +0100


Hi,
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);
...


Now, the message received and passed to (de)serializer is:

POST / HTTP/1.0
Host: localhost
User-Agent: SoapRMI/1.2
Content-Type: text/xml; charset=utf-8
Content-Length: 1003
SOAPAction: ""
Connection: Close

<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body>
<m:transfer xmlns:m='urn:WellcomeLogo'>
<box xsi:type='ns1:Object' xmlns:ns1='urn:WellcomeLogo'><?jsx version="1"?>
<servilogo.LogoMessage alias-ID="0"
 n="2">
  <java.lang.String alias-ID="1" obj-name="mex_type" valueOf="A"/>
  (*)<java.lang.String alias-ID="2" obj-name="state" valueOf="&lt;work alias-ID=&quot;0&quot; s=&quot;23.6&quot;&gt; &lt;/work&gt;"/>
  <java.util.Hashtable alias-ID="3" obj-name="_fields">
    <java.lang.String alias-ID="4" valueOf="location"/>
    <java.lang.String alias-ID="5" valueOf="http://localhost:8080"/>
  </java.util.Hashtable>
</servilogo.LogoMessage>

</box>
</m:transfer>
</SOAP-ENV:Body>
</S
pe>


but the output of "ppf.writeNode(nodeTree, sw, true)" is:

<servilogo.LogoMessage alias-ID='0' n='2'>
<java.lang.String alias-ID='1' obj-name='mex_type' valueOf='A'/>
(*)<java.lang.String alias-ID='2' obj-name='state' valueOf='&lt;work alias-ID="0" s="23.6"> &lt;/work>'/>
<java.util.Hashtable alias-ID='3' obj-name='_fields'>
<java.lang.String alias-ID='4' valueOf='location'/>
<java.lang.String alias-ID='5' valueOf='http://localhost:8080'/>
</java.util.Hashtable>
</servilogo.LogoMessage>'

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.
That row is a serialization of: 
	String state="<work alias-ID=\"0\" s=\"23.6\"> </work>";
If I use:
	String state="<work alias-ID='0' s='23.6'> </work>";
then all goes ok.

What's wrong?

Thanks!

Stefano Pedon