An attempt to sort this out yielded a noteworthy result.When I changed the schema validation mode of the Saxon DocumentBuilderFactory with FeatureKeys.SCHEMA_VALIDATION_MODE, an exception was thrown saying that I needed Saxon-SA instead, even though Saxon-SA doesn't have a different implementation of DocumentBuilderFactory. Thanks.
 
On Fri, Jan 30, 2009 at 10:45 AM, Fernando Ribeiro <webmaster@fernandoribeiro.eti.br> wrote:
I've also tried using the Saxon SchemaFactory with the Xalan DocumentBuilderFactory in the JDK, which overrides setSchema, but that didn't work either. Thanks.
 
On Fri, Jan 30, 2009 at 10:42 AM, Fernando Ribeiro <webmaster@fernandoribeiro.eti.br> wrote:
Michael,
 
It worked when using SAX (XML Reader w/ ValidatorHandler) * thanks * but not when using DOM (DocumentBuilderFactory w/ SchemaFactory).
 
I've noted that the DocumentBuilderFactory in Saxon doesn't override the setSchema yet and probably still works as in  https://jaxp.dev.java.net/article/jaxp-1_3-article.html, even though I didn't get to use the JAXP attributes names, should I use something else instead?
 
Thanks,
 
Fernando
On Fri, Jan 30, 2009 at 6:31 AM, Michael Kay <mike@saxonica.com> wrote:
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 line.
 
If you want to do this using JAXP interfaces alone, then
 
(a) make sure you are using com.saxonica.SchemaAwareTransformerFactory,
 
(b) call factory.setAttribute(FeatureKeys.SCHEMA_VALIDATION_MODE, "strict")
 
Before playing with fn:nilled, try something simpler like
 
<xsl:template match="/">
  <xsl:message><xsl:value-of select="* instance of schema-element(my:top-level-element)"/></xsl:message>
 
which will say "true" if the input has been successfully validated.
 
Michael Kay


From: Fernando Ribeiro [mailto:webmaster@fernandoribeiro.eti.br]
Sent: 30 January 2009 02:37

To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Use of fn:nilled

Michael,
 
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 else.
 
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.
 
Thanks,
 
Fernando
 
On Thu, Jan 29, 2009 at 9:30 PM, Michael Kay <mike@saxonica.com> wrote:
The 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 schema
 
To be 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 value.
 
Michael Kay


From: Fernando Ribeiro [mailto:webmaster@fernandoribeiro.eti.br]
Sent: 29 January 2009 16:57

To: Mailing list for the SAXON XSLT and XQuery processor
Subject: [saxon] Use of fn:nilled

All,
 
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.
 
The only reference I could find for problems with nilled is http://sourceforge.net/tracker2/?func=detail&aid=1717100&group_id=29872&atid=397617, but it is already closed.
 
I am currently using 8.9.0.4, which is embedded with the runtime in question.
 
Thanks,
 
Fernando

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/saxon-help