Re: Making classes from Metaclasses globally available

From: Michele Simionato (michele.simionato_at_poste.it)
Date: 06/17/04


Date: 17 Jun 2004 01:17:13 -0700


"Jean-François Doyon" <jfdoyon@methane.ca> wrote in message news:<5d6Ac.34929$7H1.1286929@news20.bellglobal.com>...
> Why?
>
> Well, basically I'm looking at writing an IDE of sorts. It should allow the
> viewing editing of text files.
>
> Catch is, said text files are structured much like XML, but they're NOT XML.
>
> I want the application to be extensible, and not be stuck to a particular
> version/schema of this file.
>
> So the idea is, create one or more "schemas" to describe what I'm going to
> be looking for and then parsing.
>
> Because the format of said text file is structured in a very XML-like way, I
> thought it'd make sense to simply
> dynamically create a tree of objects, which are instances of relevant
> classes. But because of my statement above
> I don't know in advance what classes there might be and so on.
>
> So I figured I'd use something like MetaClasses to do it. I've got the
> basic schema parsing and class creation
> in place already, the problem is that I want to keep the class creation and
> the parsing fairly seperate.
>
> I'm thinking the parsing functionality will be extra polated from the schema
> also, but be part of the classes (The
> file structure is consistent enough to allow this I think ...).
>
> Anyways, it's not all entirely clear in my mind yet ... But that's the basic
> idea.
>
> But I just want classes created from the schema to be available globally so
> that when the classes need to interact with each
> other (More precisely, one instance needs to instanciate another class and
> make it an attribute of self) I don't need to pass
> a list of classes or soemthing similar around everywhere.
>
> Did that make any sense ? :)
>
> Admitedly, I've kind of thought up a way to do it with a unique class ...
> But I don't like that design as much ... The model
> I describe above fits really well with the application in question. I've
> even seen something similar done in PHP with a
> web interface, though it was much more restricted in it's flexibility and
> capability to adapt to any kind of schema.
>
> Metaclasses seem to open the door to greater flexibility by not having to
> know ANYTHING in advance.
>
> If you're familiar with the generateDS script, I've got something like that
> in mind, but not for XML.
>
> If anyone has a better idea on how to go about this, or knows of
> tools/examples that implement this kind of scenario,
> I'd love to hear about it!
>
> Thanks,
> J.F.
>

Do you know about David Mertz's article on XML and declarative mini-languages?
It appeared some time ago on IBMdeveloperWorks. In the scenario you are
showing to us metaclasses could be indeed a sensible solution, but not
necessarely the best one.

               Michele Simionato



Relevant Pages

  • Re: Making classes from Metaclasses globally available
    ... Catch is, said text files are structured much like XML, but they're NOT XML. ... be looking for and then parsing. ... So I figured I'd use something like MetaClasses to do it. ... I'm thinking the parsing functionality will be extra polated from the schema ...
    (comp.lang.python)
  • Re: Dataset and XSD schema
    ... I am not sure I understand why the order is important, as XML is concerned ... with hierarchies rather than order. ... Are you parsing the file without using ... > I have a dataset that i read schema from the XSD file in to. ...
    (microsoft.public.dotnet.framework)
  • Re: how to return xml document from a web service
    ... what specific XML you expect. ... If you have a schema that defines what you expect, ... The second issue with this approach is that XML is not a string. ... >> methods from the wire transport. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • my first Tck/Tk program... and an XML question
    ... program which takes an XML Schema file, ... a basic XML tree and allows the user to save it. ... proc open_schema { ...
    (comp.lang.tcl)
  • RE: Data Insertion
    ... >The physical database structure is already in place. ... >I can determine the XML file and whether it contains a schema. ... In this particular case XML Schema is used to create a DataSet schema (set ... you're probably wondering how it's possible to load XML without XML ...
    (microsoft.public.dotnet.framework.compactframework)