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

Corrected Re-post with SGML metamorphosed to XML

  • From: Sean Mc Grath <digitome@i...>
  • To: xml-dev@i...
  • Date: Mon, 22 Dec 1997 17:23:57 GMT

xml loader corrected files
>[walter.kriha@s...]
>
>Force:  flexible and adaptive software needs meta-information:
>
[Much interesting stuff deleted]

Here is a technique we use here that I find *very* useful and *very* general.
Someone out there might find it useful or know a better way to do it.

When building particular configurations - either of software or documents - we
build a "project file" (in XML of course). They all look at bit like this (this
one is for a Document Database):

<FinancialInformationDatabase>
 <Level title = "Company Law">
  <Level title = "Companies Acts">
    <Level title = "Companies Act 1985">
     <file name = "uk85p1"/>
    </Level>
  </LeveL>
 <Level title = "Auditing Guidelines">
  <Level title = "Statements of Accounting Practice">
  <!-- more files here -->
   ...
  </Level>
 </Level>
</FinancialInformationDatabase>

This is a "configuration" file basically. We might have a dozens of
different processing scripts to run against this project to
build different things.

We don't want to have to manage oodles of little
scripts all over the place, most of which need the meta-information.

We tack the scripting stuff on to the configuration file
(here using Python):-

<Python name = "Do Something With The Files">
<[CDATA[
        # THis script *knows* about the project file it itself is in
        # it is in the Project variable
        # Move to the Companies Act 1985 Node
        Project.Seek ("Level","title","Companies Act 1985")
        flist = GetChildren(...)
        # Do something useful
]]>
</Python>

<Python name = "Some Other Interesting Script">
<[CDATA[
...
]]>
</Python>
</FinancialInformationDatabase>

To run a particular script we load this XML file, locate
the named Python Node and Execute its contents. The loader
ensures that the code has acccess to the XML Tree
structure in the variable "Project".

This is a bit weird at first sight. A project file
that contains the meta-data about a project
and also the scripting required to operate on the meta-data:-)

I find this hugely useful in practice. Note that the
technique relies on the fact that
Python allows you to evaluate a lump of code at
run-time. Perl is the same.
Dunno about Java.



Sean Mc Grath
sean at digitome dot com




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...)

Sean Mc Grath
sean at digitome dot com




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.