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

Re: Element oriented programming

  • From: "Michael Kay" <M.H.Kay@e...>
  • To: "Charles Reitzel" <creitzel@m...>, <xml-dev@i...>
  • Date: Mon, 28 Sep 1998 16:40:25 +0100

Re: Element oriented programming
>Likewise, it
>must be possible to fire both when the event when the
element is first
>encountered (pre-XXX) and after all of its contents have
been read in are
>available to the event (post-XXX).


In my GedML (genealogy) app, which makes extensive use of
ID/IDREF relationships, I do the semantic validation of an
element in four phases:
1 - when the start element tag is encountered (check that
the context is OK and the attributes are valid)
2 - when the end element tag is encountered (check element
content, and consistency of subelements)
3 - when all elements have been read (check that all
referenced elements exist and are of the right type, and fix
up IDREF pointers)
4 - when all elements have been through stage 3 (check
inter-element consistency, e.g. that the family tree is
non-cyclic.)

So I define four standard events for each element type.

I don't know whether this represents any kind of general
model or whether it is peculiar to my application. I suspect
it applies to any application that handles data structures
that are not purely sequential or hierarchic.

Note: some of the validation I do duplicates that done by a
validating XML processor, but this is such a small part of
the whole that I decided to put it in anyway. E.g. in phase
3 I have to check that the target element is of the right
type, so it's little extra effort to check first that it
exists, even though a validating parser will have done this
already. (Anyway, I can't be sure that the user chose a
validating parser - a SAX limitation?)

I think there's something to be said for separating
"validity checking" events from any other behaviour. The
above discussion all relates to the problem of ensuring that
the XML document conforms to application-defined validity
rules. Of course, it would be much nicer if most of this
could be done declaratively though XSchema extensions.

Mike Kay


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


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.