什么我:nil = " true "的意思吗?

时间:2022-08-15 21:39:52

I have an xml and it has nodes with i:nil="true" in it. What does that mean?

我有一个xml,里面有节点I:nil="true"这是什么意思?

For example:

例如:

<FirstName i:nil="true" />

Does that mean something different than:

这意味着什么不同于:

<FirstName />

If so, what is the difference?

如果是,那有什么区别呢?

4 个解决方案

#1


80  

This means FirstName is null

这意味着FirstName为空

<FirstName i:nil="true" />

This means FirstName = ""

这意味着FirstName = "" "

<FirstName />

Assumption made on FirstName is of string type.

对FirstName的假设是字符串类型。

#2


9  

Maybe i:nil actually means xsi:nil, this means that the FirstName element is empty, i.e. does not have any content -- not even "". It refers to the nillable property in XML Schema.

也许i:nil实际上是指xsi:nil,这意味着FirstName元素是空的,也就是说没有任何内容——甚至“”。它引用XML模式中的nillable属性。

#3


4  

nil is an attribute, defined in the i namespace. For this FirstName node, the attribute has the value true.

nil是在i命名空间中定义的属性。对于这个FirstName节点,属性的值为true。

It's similar to this, just with different names and values:

与此相似,只是名字和价值观不同:

<form name="test">...

Here, form is the name of the node, similar to FirstName from your code, and name is an attribute with a value of "test", similar to your attribute nil with a value of "true".

在这里,form是节点的名称,类似于代码中的FirstName, name是一个值为“test”的属性,类似于属性nil值为“true”的属性nil。

What this means depends on the application reading the xml document.

这意味着什么取决于读取xml文档的应用程序。

If I were to venture a guess, I'd say that this looks like part of a xml document defining some kind of schema, and that the FirstName field can have a NULL or nil value, meaning empty, or unknown.

如果我猜一下,我会说这看起来像是定义某种模式的xml文档的一部分,FirstName字段可以有空值或nil值,意思是空值或未知值。

#4


-1  

Probably your DTO and your model class is not match and DTO return name null because it cant map with some attribute in model class

可能DTO和模型类不匹配,DTO返回name null,因为它不能映射模型类中的某些属性

#1


80  

This means FirstName is null

这意味着FirstName为空

<FirstName i:nil="true" />

This means FirstName = ""

这意味着FirstName = "" "

<FirstName />

Assumption made on FirstName is of string type.

对FirstName的假设是字符串类型。

#2


9  

Maybe i:nil actually means xsi:nil, this means that the FirstName element is empty, i.e. does not have any content -- not even "". It refers to the nillable property in XML Schema.

也许i:nil实际上是指xsi:nil,这意味着FirstName元素是空的,也就是说没有任何内容——甚至“”。它引用XML模式中的nillable属性。

#3


4  

nil is an attribute, defined in the i namespace. For this FirstName node, the attribute has the value true.

nil是在i命名空间中定义的属性。对于这个FirstName节点,属性的值为true。

It's similar to this, just with different names and values:

与此相似,只是名字和价值观不同:

<form name="test">...

Here, form is the name of the node, similar to FirstName from your code, and name is an attribute with a value of "test", similar to your attribute nil with a value of "true".

在这里,form是节点的名称,类似于代码中的FirstName, name是一个值为“test”的属性,类似于属性nil值为“true”的属性nil。

What this means depends on the application reading the xml document.

这意味着什么取决于读取xml文档的应用程序。

If I were to venture a guess, I'd say that this looks like part of a xml document defining some kind of schema, and that the FirstName field can have a NULL or nil value, meaning empty, or unknown.

如果我猜一下,我会说这看起来像是定义某种模式的xml文档的一部分,FirstName字段可以有空值或nil值,意思是空值或未知值。

#4


-1  

Probably your DTO and your model class is not match and DTO return name null because it cant map with some attribute in model class

可能DTO和模型类不匹配,DTO返回name null,因为它不能映射模型类中的某些属性