[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Are there invariants in XML processing?

  • From: "Liam R. E. Quin" <liam@fromoldbooks.org>
  • To: Roger L Costello <costello@mitre.org>, xml-dev <xml-dev@l...>
  • Date: Sun, 01 May 2022 14:15:19 -0400

Re:  Are there invariants in XML processing?
On Sun, 2022-05-01 at 17:38 +0000, Roger L Costello wrote:
> Hi Ken,
> 
> What is an invariant?


An aspect of invariant-led programming that's sometimes forgotten is
that it leads to code that's not in a user-centric sense robust - it
can lead to programs that crash whenever the input is in the least
unexpected, which users tend to call buggy or fragile or useless.

Of course, over time the programs get more robust.

There was an article in Byte once that used assertions with a text
editor as the sample program - so if there was an internal error, the
program would crash and you'd lose all your text.  Nope.

So, decide whether early exit is appropriate - it often is, in a
validation scenario - or whether error recovery is more helpful. For
example, if you are processing 100,000 documents in a batch and one of
them violates a constraint, well, log it and go on to the next one.

A second aspect that often _is_ considered is this: most systems,
including Saxon, let you turn off assertions for production use.  Now,
your program won't crash when it gets wrong input. Instead, it will go
wrong silently in ways you never tested.  With assertions turned off,
some of your code is not being run, so if the expressions in your
assertions had side-effects, you're in trouble.

Again, you can plan for this, but it does take care and understanding.

In XSLT 3 and XQuery 3, try/catch can be used in conjunction with
assertions to mitigate some of these issues, but again, it has to be in
a framework, a way of approaching problems, that you do consciously.

liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.