• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

nil or nill

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Don Liu
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome!
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tony, thanks for your explanation.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic