Hi there,

I've been playing with the XUpdate implementation available in dbXML and find
that although extremely useful (and much more efficient than pulling XML over
to the client to perform DOM manipulation there) that the syntax is slightly
limiting and unfriendly. Not sure whether this is the right forum/mailing list
for these comments (apologies if this should be somewhere else) but here
goes... !!

To do a node insertion (or anything where an xupdate:element is required such
as appending), say for example to insert:

   <day today="false"><month>January</month></day>

after every "date" node I have to do something like:

   <xupdate:modifications version="1.0"
      xmlns:xupdate="http://www.xmldb.org/xupdate";> 
      <xupdate:insert-after select="//date" >
         <xupdate:element name="day">
            <xupdate:attribute name="today">false</xupdate:attribute>
            <month>January</month>
         </xupdate:element> 
      </xupdate:insert-after> 
   </xupdate:modifications>

This is messy as the root node/attributes of my "insert tree" have to be
converted to <xupdate:element>/<xupdate:attribute> nodes respectively, whereas
all sub-nodes stay as they are. I can't see any real reason for this, it would
be much neater and easier to use as:

   <xupdate:modifications version="1.0"
      xmlns:xupdate="http://www.xmldb.org/xupdate";> 
      <xupdate:insert-after select="//date" >
         <xupdate:element>
            <day today="false"><month>January</month></day>
         </xupdate:element> 
      </xupdate:insert-after> 
   </xupdate:modifications>

This way my inserted tree can stay as it is, with no modifications required
(such as translating the root of my insert tree into xupdate:element and
xupdate:attribute nodes).

In addition I can't see an easy way of doing node replacement with XUpdate.
The "xupdate:update" command allows me to replace child nodes _within_ a given
node but actually replacing a node is very difficult. Why not allow something
like:

   <xupdate:modifications version="1.0"
      xmlns:xupdate="http://www.xmldb.org/xupdate";> 
      <xupdate:update select="//date" >
         <xupdate:element>
            <date><day today="false"><month>January</month></day></date>
         </xupdate:element> 
      </xupdate:insert-after> 
   </xupdate:modifications>

which would replace all date nodes with the given sub-tree (date nodes with
day and month sub-nodes). This allows update within the node, as allowed at
present, by duplicating the top-level node (as in the example above), but also
allows replacing/renaming the selected node as a whole. In fact, if this
format were supported some of the XUpdate node construction tags may become
redundant as you can just pass in the tree as it stands, thus simplifying the
language. xupdate:attibute would, of course, still be required for doing
attibute updates however.

I think all that is needed is to change the way xupdate:element works (it
contains the required elements, rather than housing the new element within
itself) and the way xupdate:update works (actually replaces the selected nodes
rather than updating within the nodes - maybe it should be renamed to
update:replace ?) but these changes almost certainly have repercussions that I
haven't considered :(

Anyway - just a thought...

Cheers,

Richard Kent

---------------------------------------------------------------------------
               Name         - Richard Kent
               EMail        - [EMAIL PROTECTED]
---------------------------------------------------------------------------
----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to