Questions tagged [xml-nil]

About XML nil attributes

From W3C

XML Schema:Structures introduces a mechanism for signaling that an element should be accepted as "valid" when it has no content despite a content type which does not require or even necessarily allow empty content. An element may be "valid" without content if it has the attribute xsi:nil with the value true. An element so labeled must be empty, but can carry attributes if permitted by the corresponding complex type.

70 questions
181
votes
7 answers

What is the correct way to represent null XML elements?

I have seen null elements represented in several ways: The element is present with xsi:nil="true": Beowulf The element is present, but represented as an empty element (which I…
Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
68
votes
3 answers

What does i:nil="true" mean?

I have an xml and it has nodes with i:nil="true" in it. What does that mean? For example: Does that mean something different than: If so, what is the difference?
dtc
  • 10,136
  • 16
  • 78
  • 104
22
votes
4 answers

What's the difference between and ?

do you know if there's a difference between these tags on XML/XSD? and e.g: 3M 4587
Dark Defender
  • 273
  • 2
  • 4
  • 9
14
votes
8 answers

Selecting null value from XML in SQL Server

I'm trying to select from XML that has a null as one of the attributes. Instead of returning a null, it returns a 0. What am I doing wrong? See code below to replicate: declare @a xml select @a = '
asdf
  • 141
  • 1
  • 1
  • 3
14
votes
6 answers

Prevent on Nullable Value Types when Serializing to XML

I have added some nullable value types to my serializable class. I perform a serialization using XmlSerializer but when the value is set to null, I get an empty node with xsi:nil="true". This is the correct behaviour as I have found at Xsi:nil…
Ryall
  • 12,010
  • 11
  • 53
  • 77
11
votes
1 answer

Jaxb marshaller always writes xsi:nil (even when @XmlElement(required=false, nillable=true))

I have a java property annotated with @XmlElement(required=false, nillable=true). When the object is marshalled to xml, it is always outputted with the xsi:nil="true" attribute. Is there a jaxbcontext/marshaller option to direct the marshaller not…
Keith
  • 113
  • 1
  • 1
  • 5
10
votes
2 answers

Suppress xsi:nil but still show Empty Element when Serializing in .Net

I have a c# class that has 20+ string properties. I set about a fourth of those to an actual value. I would like to serialize the class and get an output of for a property public string EmptyAttribute…
runxc1 Bret Ferrier
  • 8,096
  • 14
  • 61
  • 100
8
votes
3 answers

Can XmlSerializer deserialize into a Nullable?

I wanted to deserialize an XML message containing an element that can be marked nil="true" into a class with a property of type int?. The only way I could get it to work was to write my own NullableInt type which implements IXmlSerializable. Is…
Alex Scordellis
  • 492
  • 5
  • 16
8
votes
3 answers

java unmarshalling - NULL value or missing tag?

I have a nillable field in a class that is being set by the unmarshaller: @XmlElement(name = "value", nillable = true) private BigDecimal valueVariable; My problem is that I can't tell if the xml element has been omitted or set to nil: A. element…
user1414745
  • 1,317
  • 6
  • 25
  • 45
6
votes
3 answers

c# xml serialization doesn't write null

when I serialize a c# object with a nullable DateTime in it, is there a way to leave the null value out of the xml file instead of having
Patrick
  • 2,730
  • 4
  • 33
  • 55
6
votes
5 answers

How do I check if XML value is nil in XSLT

In an XML document I have some address data.. 08001 and 08002 4512 On only want to bother displaying the zip plus value if there is a value to use. (for the purposes of this…
StingyJack
  • 19,041
  • 10
  • 63
  • 122
5
votes
3 answers

Extracting data from XML using OpenXML in SQL Server

I have a xml which I want it to be extracted using OpenXML within SQL Server Here is the sample XML 7 552 20
Rush
  • 97
  • 1
  • 1
  • 7
5
votes
1 answer

XSLT remove unwanted elements

I have XML Code Something Something
Eazy
  • 3,212
  • 5
  • 24
  • 40
4
votes
1 answer

Soap WSDL with Null

I need to specify a parameter in a function which is nullable. This doesn't work:
Simon
  • 3,235
  • 5
  • 36
  • 47
4
votes
1 answer

Using xsi:nil in XML

I am generating an XML file from a VB.NET app. The document was generating fine before I tried to add nillable elements. I am now testing putting in just one nil element as: Once this element is in place and I try to…
Matt
  • 2,078
  • 2
  • 27
  • 40
1
2 3 4 5