How to Pass NULL Eelment Value back to the client

N

N S S

I have a webservice which queries the database, but some of the columns,
contains null value, and don't show in the final XML that is sent to the
client.

The client Application breaks as the, XML sent is very dynamic.

How can send all the column values, whether or not null?
 
J

John Saunders

N S S said:
I have a webservice which queries the database, but some of the columns,
contains null value, and don't show in the final XML that is sent to the
client.

The client Application breaks as the, XML sent is very dynamic.

How can send all the column values, whether or not null?

NULL in the database is not a value. It means that no value is known for
that column.

You need to find out what the client wants to see in that case, then send
it. It's possible that the client doesn't want to process the rows with NULL
values at all, or it's possible it wants to see the number 0, or an empty
string as the value. You'll have to ask to be sure.

John
 
N

N S S

Well empty String/element would be good, i am using NVL function in Oracle
and passing "." instead when value is NULL, but there are too many fields to
be taken care of And SQL is getting Ugly, so i am looking for some setting
which would allow NULL Values to be passed.

I am trying to search for some setting wherein Elemnets should not missing,
even if it is NULL, something like this(empty Element) <ADDRESS2/> or
<ADDRESS2 NULL=TRUE> would be good solutions.

The Obejctive is that element should not be missing, whether it has value or
not.
 
J

John Saunders

N S S said:
Well empty String/element would be good, i am using NVL function in Oracle
and passing "." instead when value is NULL, but there are too many fields
to
be taken care of And SQL is getting Ugly, so i am looking for some setting
which would allow NULL Values to be passed.

I am trying to search for some setting wherein Elemnets should not
missing,
even if it is NULL, something like this(empty Element) <ADDRESS2/> or
<ADDRESS2 NULL=TRUE> would be good solutions.

The Obejctive is that element should not be missing, whether it has value
or
not.

Keeping in mind that whatever solution you come up with will have to be
usable by the client code, there is a standard way to do this. If an element
is defined in the schema as being nillable, then you can do something like
this:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ROOT">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ADDRESS2" type="xsd:string" minOccurs="1"
maxOccurs="1" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

<?xml version="1.0"?>
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Nillable.xsd">
<ADDRESS2 xsi:nil="true"/>
</ROOT>

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top