Skip to Content
0
Former Member
Oct 14, 2016 at 01:37 PM

Communication Error when generating XML using CDATA in SQL Anywhere V10

125 Views

Hi Gurus,

We are using SQLA10 and in one of the functionalities we generate XML using FOR XML EXPLICIT.

We are using CDATA directive for some columns and when the value is NULL, SQLA10 Engine stops and throw "Communication Error".

This is know if anyone faced a similar problem and fixed this issue at DB Engine level. There is a workaround we have is to put '' id the value is NULL but that is just a workaround.

Below is the code which can be tried..

Create table Customer
( "emp_ID" int default autoincrement,
"emp_Name" char(50),
"emp_age" int,
"emp_status" char(1)
)

insert into Customer ("emp_Name","emp_age","emp_status") values ('Ram',32,'A')
insert into Customer ("emp_Name","emp_age") values ('test',32)
insert into Customer ("emp_Name","emp_status") values ('test1','A')


SELECT
1 AS tag,
NULL AS parent,
emp_name AS [Employe_name!1!emp_name],
emp_age AS [emp_age!1!!cdata]
FROM customer
FOR XML EXPLICIT;