You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Don Saxton <ds...@pacbell.net> on 2003/04/14 20:04:38 UTC

xupdate update in cocoon

Hi

I have a good start in putting xindice 1.1b together with cocoon 2.04 (jdk
1.4 tomcat 4.1.18), but I am really stuggling with Xupdate.

I got this far by using the experiences of several people on this list.
Thank you greatly. Frequently  I read that others get xupdate to work, so I
am hoping that someone can help me over the last hurdle.

Below are xupdate query that I input to the cocoon transformer
XMLDBTransformer and the result.
With xmldbgui I can successfully xupdate with the modifications node set of
the update query below.

The query side works well and I am able to snag a fragment from a document
or a document from a collection. I can do it through cocoon, xmldbgui,
xincon, and almost with "the ugly debug tool" (can't glue the xpath query
onto the http collection request, but it's still a keeper).

One suspect is xmldb-api-20021118.jar.  I could not find
xmldb-api-20021126.jar or how to get to xmldb cvs. My other suspect is
XMLDBTransformer which seems to require an oid attribute eventhough a query
of type="update" is documented as not needed. It doesn't seem to matter what
the value of oid is. Related to these is that I can't find documented (well,
meaningfully documented) the difference between these two:

XUpdateQueryService.update(String document)
XUpdateQueryService.updateResource(String key, String document)

Thanks for everything

Don

<!--    _________the query_________ -->
<?xml version="1.0" encoding="UTF-8"?>
<xindice:query xmlns:xupdate="http://www.xmldb.org/xupdate"
   xmlns:xindice="http://apache.org/cocoon/xmldb/1.0"
   type="update" oid="whatever">
   <xupdate:modifications version="1.0">
     <xupdate:remove select="//person[@id='p1']"/>
     <xupdate:append select="//persons">
       <xupdate:element name="person">
         <xupdate:attribute name="id">p1</xupdate:attribute>
         <xupdate:attribute name="name">Don</xupdate:attribute>
         <parents
            xmlns:chiba="http://chiba.sourceforge.net/2001/09/xforms"
            xmlns:xforms="http://www.w3.org/2002/08/xforms/cr"
            xmlns:xlink="http://www.w3.org/1999/xlink"
            xmlns:collection="http://apache.org/cocoon/xmldb/1.0"
            xmlns:src="http://xml.apache.org/xindice/Query">
           <personref person="p2"/>
           <personref person="p7"/>
         </parents>
       </xupdate:element>
     </xupdate:append>
   </xupdate:modifications>
</xindice:query>
<!--    _________end query_________ -->

<!--    _________the result_________ -->
<?xml version="1.0" encoding="UTF-8"?>
<xindice:query oid="whatever" type="update" result="failure"
  xmlns:xupdate="http://www.xmldb.org/xupdate"
  xmlns:xindice="http://apache.org/cocoon/xmldb/1.0">
 Failed to update resource whatever: 1
</xindice:query>
<!--    _________end result_________ -->