You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "Michael J. Hudson" <mh...@blueprinttech.com> on 2001/05/22 00:30:41 UTC

CDATA being stripped out of an XML payload.

So... is this a bug, or what's suppose to happen?
You send an XML file as a "string"-typed payload through SOAP,
and on the other end... all the "CDATA" wrappers are stripped from
the XML file (thus causing some illegal errors... since the text
within CDATA is no longer wrapped in the CDATA wrapper).

I've located where it happens...
In the class DomUtils in the util.xml package, you have the method

 String getChildCharacterData (Element parentEl)

This method seems to be used to convert a DOM Text Node or DOM CDATA
node into it's XML representation.  In both cases... this is basically
just the actual text within the node.  However, shouldn't the CDATA
text be wrapped around the "<![CDATA[ ... ]]>" wrapper when it is 
returned to the calling method???   
The way the method is implemented... it treats Text nodes and CDATA
nodes exactly the same way... and I don't think this is right...
but I could be wrong.

For my own personal use, I added the CDATA wrapper around it... and
that made my XML messages work.  But, shouldn't that actually be the
way it works???

Thanks,
-----------------
Michael J. Hudson
Software/Framework Engineer
mhudson@blueprinttech.com

cell-phone: 703.362.8039
voice-mail: 703.827.0638 ext. 4786
fax: 703.734.0987

Blueprint Technologies
"Great software starts with great architecture"
http://www.blueprinttech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


RE: CDATA being stripped out of an XML payload.

Posted by "Matthew J. Duftler" <du...@watson.ibm.com>.
Hi Michael,

We just committed some changes (by Mike Spreitzer) to the serialization
mechanism that should fix this. Now, when you pass a String containing CDATA
sections, they will not be stripped out.

Previous behavior:

If you sent as a String: Hello <![CDATA[Michael]]> Hudson
You would get on the wire: Hello <![CDATA[Michael]]> Hudson
And, the service would receive: Hello Michael Hudson

Now, the behavior is:

If you sent as a String: Hello <![CDATA[Michael]]> Hudson
You will get on the wire: Hello &lt;![CDATA[Michael]]&gt; Hudson
And, the service will receive: Hello <![CDATA[Michael]]> Hudson

I think the deserialization is working as it should, it was the
serialization that was incorrect.

Please try the latest code out and let us know either way.

BTW, in case you don't want to mess with the CVS, or wait for the next
nightly build, there should be a v2.2 Release Candidate posted shortly.

Thanks,
-Matt

> -----Original Message-----
> From: Michael J. Hudson [mailto:mhudson@blueprinttech.com]
> Sent: Monday, May 21, 2001 6:31 PM
> To: soap-user@xml.apache.org
> Subject: CDATA being stripped out of an XML payload.
>
>
>
> So... is this a bug, or what's suppose to happen?
> You send an XML file as a "string"-typed payload through SOAP,
> and on the other end... all the "CDATA" wrappers are stripped from
> the XML file (thus causing some illegal errors... since the text
> within CDATA is no longer wrapped in the CDATA wrapper).
>
> I've located where it happens...
> In the class DomUtils in the util.xml package, you have the method
>
>  String getChildCharacterData (Element parentEl)
>
> This method seems to be used to convert a DOM Text Node or DOM CDATA
> node into it's XML representation.  In both cases... this is basically
> just the actual text within the node.  However, shouldn't the CDATA
> text be wrapped around the "<![CDATA[ ... ]]>" wrapper when it is
> returned to the calling method???
> The way the method is implemented... it treats Text nodes and CDATA
> nodes exactly the same way... and I don't think this is right...
> but I could be wrong.
>
> For my own personal use, I added the CDATA wrapper around it... and
> that made my XML messages work.  But, shouldn't that actually be the
> way it works???
>
> Thanks,
> -----------------
> Michael J. Hudson
> Software/Framework Engineer
> mhudson@blueprinttech.com
>
> cell-phone: 703.362.8039
> voice-mail: 703.827.0638 ext. 4786
> fax: 703.734.0987
>
> Blueprint Technologies
> "Great software starts with great architecture"
> http://www.blueprinttech.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


RE: CDATA being stripped out of an XML payload.

Posted by "Matthew J. Duftler" <du...@watson.ibm.com>.
Hi Michael,

We just committed some changes (by Mike Spreitzer) to the serialization
mechanism that should fix this. Now, when you pass a String containing CDATA
sections, they will not be stripped out.

Previous behavior:

If you sent as a String: Hello <![CDATA[Michael]]> Hudson
You would get on the wire: Hello <![CDATA[Michael]]> Hudson
And, the service would receive: Hello Michael Hudson

Now, the behavior is:

If you sent as a String: Hello <![CDATA[Michael]]> Hudson
You will get on the wire: Hello &lt;![CDATA[Michael]]&gt; Hudson
And, the service will receive: Hello <![CDATA[Michael]]> Hudson

I think the deserialization is working as it should, it was the
serialization that was incorrect.

Please try the latest code out and let us know either way.

BTW, in case you don't want to mess with the CVS, or wait for the next
nightly build, there should be a v2.2 Release Candidate posted shortly.

Thanks,
-Matt

> -----Original Message-----
> From: Michael J. Hudson [mailto:mhudson@blueprinttech.com]
> Sent: Monday, May 21, 2001 6:31 PM
> To: soap-user@xml.apache.org
> Subject: CDATA being stripped out of an XML payload.
>
>
>
> So... is this a bug, or what's suppose to happen?
> You send an XML file as a "string"-typed payload through SOAP,
> and on the other end... all the "CDATA" wrappers are stripped from
> the XML file (thus causing some illegal errors... since the text
> within CDATA is no longer wrapped in the CDATA wrapper).
>
> I've located where it happens...
> In the class DomUtils in the util.xml package, you have the method
>
>  String getChildCharacterData (Element parentEl)
>
> This method seems to be used to convert a DOM Text Node or DOM CDATA
> node into it's XML representation.  In both cases... this is basically
> just the actual text within the node.  However, shouldn't the CDATA
> text be wrapped around the "<![CDATA[ ... ]]>" wrapper when it is
> returned to the calling method???
> The way the method is implemented... it treats Text nodes and CDATA
> nodes exactly the same way... and I don't think this is right...
> but I could be wrong.
>
> For my own personal use, I added the CDATA wrapper around it... and
> that made my XML messages work.  But, shouldn't that actually be the
> way it works???
>
> Thanks,
> -----------------
> Michael J. Hudson
> Software/Framework Engineer
> mhudson@blueprinttech.com
>
> cell-phone: 703.362.8039
> voice-mail: 703.827.0638 ext. 4786
> fax: 703.734.0987
>
> Blueprint Technologies
> "Great software starts with great architecture"
> http://www.blueprinttech.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org