views:

111

answers:

1

Is the following XML declaration valid?

<message metadata="SomeMetaData" xsi:nil="true"/>

where xsi is defined as "http://www.w3.org/2001/XMLSchema-instance"

If I am trying to create the above data for transfer through a ASP.NET Web Service Application in C#, how do I go about coding the above?

Say for example I have a web service method written in C# called

SomeMethod(Msg someMessage)

How to I indicate that the message field found in class Msg contains an attribute called metadata and that the field message itself is also an element which can be null(contains no data as shown in following example)?

<message metadata="SomeMetaData"></message>

In other cases, it can contain some data as follows:

<message metadata="SomeMetaData">
    <data>1234</data>
    <data>5678</data>
</message>
+1  A: 

The XML is valid, provided that the "xsi" namespace is defined.

What do you mean by "create the above data"? Example?

RickNZ
I have updated the question. Is it possible to do away with xsi:nil="true"?
Lopper
It depends on the requirements of the web service you're calling, right?
RickNZ