XML:这有效吗?
以下 XML 声明有效吗?
<message metadata="SomeMetaData" xsi:nil="true"/>
其中 xsi
定义为“http://www.w3.org/2001/XMLSchema-instance
”
如果我尝试创建上述数据以通过 ASP 传输C# 中的 .NET Web 服务应用程序,如何对上述内容进行编码?
举例来说,我有一个用 C# 编写的 Web 服务方法,名为“
SomeMethod(Msg someMessage)
如何指示 Msg
类中找到的 message
”字段包含一个名为 metadata
的属性> 并且字段 message
本身也是一个可以为 null
的元素(不包含数据,如下例所示)?
<message metadata="SomeMetaData"></message>
在其他情况下,它可以包含一些数据,如下所示:
<message metadata="SomeMetaData">
<data>1234</data>
<data>5678</data>
</message>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果定义了“xsi”命名空间,则 XML 有效。
“创建上述数据”是什么意思?例子?
The XML is valid, provided that the "xsi" namespace is defined.
What do you mean by "create the above data"? Example?