qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] Re: TreeList implementation


From: Joseph Coffland
Subject: Re: [Qexo-general] Re: TreeList implementation
Date: Thu, 26 Feb 2004 01:39:58 -0500

Per Bothner,

I appreciate your patience with me poking around at your design.

> for now a complete implementation of XQuery is the main priority
That is a good goal.

I'm still a little unsure about XQuery.  There are some parts about
the language I really don't like.  

1) I'm not convinced the type system is necessary.
2) I don't want to rely on FLOWR expressions for scoped local variables.
3) I want program blocks instead of commas.

I think some of the standards that the W3
has produced are quite good, but their specs are growing increasingly
complicated as more people get involved.  There is something to
be said for having a few smart people design a simple yet efficient
language.  The W3 suffers from too many cooks in the kitchen.

As I've said before despite its flaws XQuery seems to be the best
XML processing language right now.  Whether it will catch on or not
is questionable.  If you look at the results of the W3's other
specs it seems to have a good chance.  However, one of the best XML
APIs by far is SAX which W3 had little to do with.

I have used XPath quite a lot.  I've hacked it up to squeeze out 
the extra features I've needed.  Here is a little example of some 
of extreme XPath 1.0:

block(set("ohead", issame($context, $newedgeheadport/..)),
      set("otail", issame($context, $newedgetailport/..)),
      set("hdir", string($newedgeheadport/@dir)),
      set("tdir", string($newedgetailport/@dir)),
      set("hdir", if($ohead, if($hdir="in", "out", if($hdir="out", "in",
      $hdir)), $hdir)),
      set("tdir", if($otail, if($tdir="in", "out", if($tdir="out", "in",
      $tdir)), $tdir)),
      $hdir="in" and $tdir="out" and not($ohead and $otail))

Notice I added the functions block, set and if.

So really I want a language different than XQuery.  That should explain
why I've been talking so much about hacking in features that are not in
the XQuery spec.

Ultimately I think I'm going to just write a simple language that uses
XPath, allows updating, has a very simple type system, but uses schema
validation, can define functions and has if and foreach.  But, this will 
have to wait until (if ever) I have the time.

In the mean time I have a paid contract for which I need to do some
XML processing and I'm trying to find a simple solution for what I need
now.  I've been able to do quite a lot with Qexo, but have gotten hung
up for lack of a couple of features.  1) the ability to pass in
parameters from the command line and 2) the ability to append data to 
an existing XML tree.  


The first problem can be solved as you mentioned on the qexo list
by creating an XML document of a predetermined name which contains 
pointers to the document you would like to pass in.  This is a big
kludge, but that is what I'm currently doing.


The second problem can be described as follows:

Given two documents:

<a att1="" ... attN="">
 <child1/>
 ...
 <childN/>
</a>

<b>
 <child1/>
 ...
 <childN/>
</b>

I want to append b to the root node a to get this document:

<a att1="" ... attN="">
 <child1/>
 ...
 <childN/>
  <b>
   <child1/>
   ...
   <childN/>
  </b>
</a>

If XQuery had append it would be easy.

I'm telling you all this mainly to give you an idea of where I'm
coming from.  If you have any suggestions let me know.

On another note, I've been looking into implementing the type system
for Qexo.  Xerces provides PSVI, but I haven't been able to figure
out how to check if a string matches a given data type.  Xerces must
do this when it validates a document against a schema.  This should
not be a problem for compile time type checking, but for run time
type checking I think it is necessary.  Any ideas on how to approach
this?


Regards,

Joseph
-- 
  Joseph Coffland
  address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]