Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nil or nill

 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<partName xsd:nill="true"/>
should this be <partName xsd:nil="true"/>
The answer from the source says nill, but when I look for references in Skonnard's book it only refers to nill and nillable
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mary morris:
in Skonnard's book it only refers to nill and nillable


It is nill and nillable. When you use nill, you have to specify the Schema prefix.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Don Liu
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome!
 
Tony Yan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'nillable' is defined in Schema for an element's emptiness. 'nil' should be used for a Schema instance, and has to be prefixed as an Schema-instance.
I am not sure where you saw 'nill'. I searched thru the primer, couldn't find any.
The nil attribute is defined as part of the XML Schema namespace for instances, http://www.w3.org/2001/XMLSchema-instance, and so it must appear in the instance document with a prefix (such as xsi associated with that namespace. (As with the xsd: prefix, the xsi: prefix is used by convention only.) Note that the nil mechanism applies only to element values, and not to attribute values. An element with xsi:nil="true" may not have any element content but it may still carry attributes.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it was a test question in XML@Whiz.
I will have to look up the full example later.
Thanks for your reply
mm
 
Tony Yan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested today using xml-pack from Sun. xsi:nil is okay, but xsi:nill caused SAXException.
Case closed?
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the question with the nil, nill, nillable.
It was in XML@Whiz, I am not sure if it is okay to post, but I don't see why not:
An XML based application is written to parse an input XML file, verify that it conforms to a particular schema and update the database with the data from the XML file. The schema requires that an element with name partName should still appear in the input XML file, even if it has no content, so that the database can be updated with null values for that particular field. Enforcing this restriction in the XML schema can be done by adding which of the following lines in the schema.
a) <element name="partName" nullable="true"/>
b) <element name="partName" nillable="true"/>
c) <element name="partName" nill="true"/>
d) <element name="partName" default="null"/>
e) <element name="partName" default="nill"/>
So, does this not mean there is a error in their answer - as per you last post?
re: nil="true"/> and not nill="true"/>
 
Tony Yan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is an element definition, so it should be nillable="true". The instance would be something like this:
<partName xsi:nil="true"/>
as long as the xsi is prefixed to Schema-instance namespace.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony, thanks for your explanation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic