Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: when to validate XML while being created programmatically..

From: dave <ceek63@-----.--->
To: Michael Kay <mike@--------.--->, xmlschema-dev@--.---
Date: 12/20/2007 3:53:00 PM

Let's say, the W3C schema has key/keyref constraints.
LEt's also assume the Key is made up of some 5
elements/attributes. How does on-the-fly validation
work here when you are in the middle of setting the
Key constraint values in your app. How do we tell the
Validator when we completed the Key definition. I may
choose to define partial Key at one place and rest
defined elsewhere.
Am trying to understand the on-the-fly validation
behavior. Am afraid I I may get a Validation exception
if I am middle of constructing the XML instance unless
I command the validator at proper increments??

appreciate inputs.
-D

--- Michael Kay <mike@s...> wrote:

> 
> > This is related to validating a brand new XML
> instance WHILE 
> > being created programmatically:
> 
> If you use XSLT or XQuery to create the XML
> instance, and you enable
> validation, then Saxon will insert a valldator into
> the serialization
> pipeline and check each element/attribute as it is
> written. You can do the
> same thing if you are generating XML from a Java
> application, though the API
> might be a little low-level for your taste.
> 
> > If Yes, how would you 
> > correct these validation errors programmatically?
> It looks 
> > like a daunting task.
> 
> I've no idea how you would go about correcting
> validation errors
> programmatically whether it's done on the fly or
> otherwise. If you're told
> that an attribute value doesn't match the pattern
> facet for the attribute
> type, what would you expect a program to do about
> it?
> > 
> >  OR
> > 
> > Does it even make sense to perform on-the-fly
> validation 
> > while constructing a new XML instance? 
> 
> Yes, see above, it makes eminent sense.
> 
> > If Yes, how would you 
> > tell the system when the instance is even
> incrementally valid 
> > before turning ON the validation. 
> 
> Sorry, I don't understand the term "incrementally
> valid".
> 
> > I can imagine there must be 
> > an API to enable/disable on-the-fly validation
> during the 
> > creation of XML instance. I might be wrong as it
> may not make sense.
> 
> With Saxon (if you're really prepared to delve deep
> into the API) you can
> enable validation at the level of an element node.
> You can't switch
> validation off: once you're validating an element,
> you keep validating until
> you get to the end of that element.
> > 
> > Does the application design needs to ensure that
> the 
> > generated XML is always valid?
> > 
> Well, if the XML was always valid then you wouldn't
> need to validate it; but
> I think you should treat a validation failure as an
> error either in the
> application or perhaps (arguably) in its source
> data.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> 



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


From mike@s... Fri Dec 21 09:11:51 2007
Received: from aji.w3.org ([133.27.228.225])
	by frink.w3.org with esmtp (Exim 4.63)
	(en


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent