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

Fw: Trees versus event streams

  • From: "F. Chahuneau - General Manager" <fcha@B...>
  • To: xml-dev@i...
  • Date: Sat, 1 Mar 1997 12:09:01 +0100 (MET)

balise sgml
[Peter Murray-Rust (Peter@u...), Thu, 27 Feb 1997]

> My current problem may highlight this. A CML document is highly
> tree-structured and contains no mixed content, so that eventStreams don't
> contribute much. BUT it also includes chunks of HTML where a tree
> structure is quite inappropriate. If I take a Lark-based approach (or my
> own parser) the HTML gets rendered into a tree. I am now hacking this
> back into an event stream to render the hypertext. Not only does it
> take more effort, but I'm sure that holding HTML as a tree has a
> memory hit. Ideally when I'm parsing CML, and come to the
> tag <XHTML> (sic) which contains <BODY>, I'd like to tell the parser
> 'stop parsing as a tree and just hold a hypertext string until </XHTML>

Peter,

This kind of consideration is precisely what led us to define a *dual*
programming paradigm when designing the Balise SGML processing language
(http://www.balise.com).

Being able to switch back-and-forth between these two useful and
complementary abstractions for an SGML document (a "tree of typed nodes
with attributes" vs an "ESIS or ESIS+ event stream") is, from our
experience, often required when you have to express complex processing
tasks on SGML documents, but still want to keep your code as concise as
possible.

No paradigm is inherently better than the other: it all depends what you 
want to express. If you want your code to remain legible and maintainable
(i.e related in a straightforward way to the processing idea it expresses),
then you really need both in some cases. If you are interested, this idea
is further developed in the following paper: "Event Driven or Tree
Manipulation Approaches to SGML Transformation" presented at SGML'96 and 
available at "http://www.balise.com/current/articles/lecluse.htm"

> We *could* do this with a PI, but would have to all agree.

Doing this with a PI does not seem to be the best idea, since it does not
leave a choice to the application programmer which mode she wants to use 
for what, while the best choice may entirely depend on  what she wants to
do. Being able to switch betwwen tree an event-stream mode on any GI event
is what is required. For maximum generality, you also need to be able to 
generate an event stream during (sub-)tree traversal, maybe not the
*original* tree, but one which you have modified or created through your 
application.

In the world of traditional SGML applications, sheer document size is
frequently an issue, so that tree mode must often be used with parsimony.
In the case of XML or HTML fragments, this problem is probably negligible.
The rationale for maintaining an "event stream" paradigm in an XML API is,
therefore, not to save memory, but simply that it might the most
appropriate in some cases.



_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
       _/ François CHAHUNEAU                 phone: [+33] 1 40 64 43 00  _/
      _/ Directeur Général/General Manager                              _/
     _/ AIS S.A.                             FAX: [+33] 1 40 64 43 10  _/
    _/ 15-17 rue Rémy Dumoncel    email: fcha@a...  _/
   _/ 75014, Paris, FRANCE        WWW: http://www.berger-levrault.fr _/
  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (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.