Of course, if you're not designing the XML, then you don't
get any choice in the matter - I was just saying that I don't think using
xsi:nil is good design.
If it's not working under Saxon-SA then you're probably not
pressing the right buttons to get schema-validated input.
I would try it from the command line first: make sure
saxon9sa.jar is on the classpath, and use the option -val:strict on the command
If you want to do this using JAXP interfaces alone, then
(a) make sure you are using
(b) call factory.setAttribute(FeatureKeys.SCHEMA_VALIDATION_MODE,
Before playing with fn:nilled, try something simpler
which will say "true" if the input has been successfully
Actually it is useful in SOA applications, because there are several platforms
(Progress OpenEdge, used by thousands of companies everywhere, for example)
that send null fields as xsi:nil elements instead of omitting them, and
require xsi:nil elements to be sent when fields are null. When working with these platforms, you might want to check
for xsi:nil elements and either remove or transform them to something
The fn:nilled function is a better
solution than @xsi:nil = 'true', the de facto workaround. Since my last post, I've tried getting it to work with both
Saxon-B and Saxon-SA without success, though I may have insisted to use JAXP
(DocumentBuilderFactory with Schema and XMLReader with ValidationHandler)
for too long. Let me know if I should try the Saxon API instead.
If you want more information about use
cases like this, we can talk off-list.
simplest way of explaining fn:nilled() is that it returns true if two
conditions are satisfied:
(a) the element specifies xsi:nil="true"
(b) the element is validated against a
honest, I don't know of any practical use case for this function. I think
that the "nilled" property was needed in the data model to make the formal
semantics work, and having got the property in the data model, people felt
it ought to be accessible to applications. If you find a good use for it,
let me know, because I can't think of one!
Generally xsi:nil is a bit
of a disaster anyway. I don't see why you can't represent absent data by
omitting the element, rather than having it present with no
From: Fernando Ribeiro [mailto:firstname.lastname@example.org]
January 2009 16:57
Subject: [saxon] Use of
To: Mailing list for the SAXON XSLT and
I've been trying to use the nilled
function but it seems like I am missing something about it. I'd appreciate
if you could take a look at the attached example and find out why it
doesn't work as expected.
Note that there ain't a schema (with
nillable=true) attached to the source, as in the actual case (ain't an
option) upon which the example is based.
I am currently using 18.104.22.168,
which is embedded with the runtime in question.
SF.net email is sponsored by:
to tell your story.
mailing list archived at http://saxon.markmail.org/