You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephan Michels <st...@vern.chem.tu-berlin.de> on 2002/02/28 20:51:28 UTC

XUpdate

Hi,

I have some trouble by using the XMLDBTransformer and xindice. I used the
examples from http://www.xmldb.org/xupdate/xupdate-wd.html

Following things have I done:

> cat example.xml
<?xml version="1.0"?>
<addresses version="1.0">
 <address id="1">
  <fullname>Andreas Laux</fullname>
  <born day='1' month='12' year='1978'/>
  <town>Leipzig</town>
  <country>Germany</country>
 </address>
</addresses>

> xindiceadmin ac -c /db -n addressbook
Created : /db/addressbook

> xindice ad -c /db/addressbook -f example.xml -n example
Added document /db/addressbook/example

> xindice xpath -c /db/addressbook -q /addresses/address[1]
<?xml version="1.0"?>
<address id="1" xmlns:src="http://xml.apache.org/xindice/Query"
         src:col="/db/addressbook" src:key="example">
  <fullname>Andreas Laux</fullname>
  <born day="1" month="12" year="1978" />
  <town>Leipzig</town>
  <country>Germany</country>
 </address>

> cat xupdate-example.xml
<?xml version="1.0"?>
<example>
 <xindice:query type="update" oid="example"
                xmlns:xindice="http://apache.org/cocoon/xmldb/1.0">

  <xupdate:modifications version="1.0"
    xmlns:xupdate="http://www.xmldb.org/xupdate">
   <xupdate:insert-after select="/addresses/address[1]" >
    <xupdate:element name="address">
     <xupdate:attribute name="id">2</xupdate:attribute>
     <fullname>Lars Martin</fullname>
     <born day='2' month='12' year='1974'/>
     <town>Leizig</town>
     <country>Germany</country>
    </xupdate:element>
   </xupdate:insert-after>
  </xupdate:modifications>

 </xindice:query>
</example>

> grep -A 7 "xupdate" sitemap.xmap
   <map:match pattern="xupdate-example.xml">
    <map:generate src="xupdate-example.xml"/>

    <map:transform type="xmldb">
     <map:parameter name="base" value="xmldb:xindice:///db/addressbook"/>
    </map:transform>

    <map:serialize type="xml"/>
   </map:match>

> wget http://localhost:8080/cocoon/xupdate-example.xml
--20:34:00--  http://localhost:8080/cocoon/xupdate-example.xml
           => `xupdate-example.xml.1'
Verbindungsaufbau zu localhost:8080... verbunden!
HTTP Anforderung gesendet, auf Antwort wird gewartet... 200 OK
Länge: nicht spezifiziert [text/xml]

    0K                                                        @ 218.75
KB/s

20:34:00 (31.25 KB/s) - »xupdate-example.xml.1« gespeichert [224]

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

Can anyone help? Where is the error?

Thank you, Stephan Michels.


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>