kartagis / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

CDATA_SECTION_NODE is not supported in SimpleXMLElement #72

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am facing an issue with CDATA_SECTION_NODE. I had to add:

def __unicode__(self):
        "Returns the unicode text nodes of the current element"
        if self._element.childNodes:
            rc = u""
            for node in self._element.childNodes:
                if node.nodeType == node.TEXT_NODE:
                    rc = rc + node.data
                elif node.nodeType == node.CDATA_SECTION_NODE:
                    rc = rc + node.data
            return rc
        return ''

to simplexml.py

Original issue reported on code.google.com by abdullah...@gmail.com on 11 Jun 2012 at 11:30

GoogleCodeExporter commented 8 years ago
That seems good, do you want to propose a patch?
Could you include some test cases?

Original comment by reingart@gmail.com on 11 Jun 2012 at 4:37

GoogleCodeExporter commented 8 years ago
Hi there,

I have to insert CDATA in my xml response, how can i do that with pysimplesoap.
Can you pleeeeez describe it in detail here

Regards
Rai

Original comment by rai.ehti...@smsall.pk on 25 Mar 2014 at 12:00

GoogleCodeExporter commented 8 years ago
Truly I don't remember why I post this issue !

Original comment by abdullah...@gmail.com on 25 Mar 2014 at 12:38

GoogleCodeExporter commented 8 years ago
Hi Rai: could you send a code fragment / wsdl to test the issue?
A real use case would be helpful to check this and include the patch.

Original comment by reingart@gmail.com on 25 Mar 2014 at 4:19

GoogleCodeExporter commented 8 years ago
Hello again,

I have to produce a response like this
<RET_VAL>0</RET_VAL>
<RET_DESC>SUCCESS</RET_DESC>
<SERV_STAT>
<![CDATA[<RESPONSE>
<MSISDN>923335300056</MSISDN>
<SERVICE_ID>8818</SERVICE_ID>
<SERVICE_NAME>MyMail</SERVICE_NAME>
<SERVICE_STATUS>ACTIVE</SERVICE_STATUS>
<ACTIVATION_MODE>MO</ACTIVATION_MODE>
<A_TIME>02-Sep-2013 12:00:00</A_TIME>
<DEACTIVATION_MODE></DEACTIVATION_MODE>
<D_TIME></D_TIME>
<CHARGING_MODE>MT</CHARGING_MODE>
<C_TIME>03-Mar-2014 12:00:00</C_TIME>
</RESPONSE>]]>
</SERV_STAT>
</ptml:Query_Service_StatusResponse>

I don't see this happening as of now. Is there any support for this in 
pysimplesoap?

Any help in this regard will be highly appreciated.

Regards
Rai

Original comment by rai.ehti...@smsall.pk on 28 Mar 2014 at 11:40

GoogleCodeExporter commented 8 years ago
You can insert in the response any xml, returning from your function a 
SimpleXmlElement object.

Also, you could return text, it will be escaped accordingly if it contains xml 
tags.
Then, we can explore how to convert to CDATA

A concrete simple coding example would be helpful to test and evaluate this. 

Original comment by reingart@gmail.com on 29 Mar 2014 at 2:33