I'd put it on your xu:modifications element in your processor in the xpl, ie
<xu:modifications version="1.0" xmlns:dm="
http://www.myns.no/data-model">
Steve
-----Original Message-----
From: teppen [mailto:
[hidden email]]
Sent: 26 October 2009 13:41
To:
[hidden email]
Subject: [ops-users] Problems adding content to an xml file in exist using
orbeon
Hi, I'm new to Orbeon and XPL so I'm hoping you folks can help me. I've made
an registration form (XForms) which is posted to my xpl. I want to save
these data into an existing 'customers.xml' in my exist database. In other
words add a new Customer and User in customers.xml.
I've tried to use the xmldb-update processor. Everything seems to go fine in
my xpl, but i get an error when the update is executed:
org.apache.xmlrpc.XmlRpcException: org.exist.xquery.XPathException:
XPST0081: No namespace defined for prefix dm
I don't know where to put the namespace declaration, I've put it everywhere
in my xpl without success. If I omit the namespace prefix in the select
statements in xu:insert-after i get no error but the customers file is not
updated. How, and/or where, should I put the namespace declaration?
I don't know if this is the correct approach to do what I'm trying to do. I
guess there are several ways to add content to an xml file in Orbeon, but I
haven't found any examples similar to what I want. I would appreciate if
someone could point me in the right direction. Below are some of my code.
Thanks in advance.
-Tommy Skarateppen
The customer.xml in exist-db looks like this (shortened):
<Static-Data xmlns="
http://www.myns.no/data-model">
<Companies>
<Company>
...
</Company>
<Company>
...
</Company>
</Companies>
<Users>
<User>
...
</User>
<User>
...
<User>
</Users>
</Static-Data>
The instance posted from my form looks like this:
<Static-Data xmlns="
http://www.myns.no/data-model">
<Companies>
<Company>
<Name>My Company</Name>
<Address1>My street 17</Address1>
<Address2/>
<PO-Box/>
<ZipCode>1234</ZipCode>
<City>My City</City>
<Phone>12345678</Phone>
<Discount/>
<VAT-Number/>
<WebSite/>
<Invoice/>
</Company>
</Companies>
<Users>
<User>
[hidden email]
<Company ref=""/>
<FirstName>John</FirstName>
<LastName>Olsen</LastName>
<Phone/>
<Password>mysecretpassword</Password>
<Password2/>
<OpenIdUrl/>
<IP4-Ranges>
<Matcher segm1="" segm2="" segm3="" segm4=""/>
</IP4-Ranges>
<Subscriptions>
<Canceled>false</Canceled>
<StartDate/>
<ExpireDate/>
<Calculations updated="">
<MaxWebSessions>1</MaxWebSessions>
<Book ref="mybook"/>
</Calculations>
</Subscriptions>
</User>
</Users>
</Static-Data>
Snippet from my xpl:
<p:processor name="oxf:xslt-2.0">
<p:input name="data" href="#instance"/>
<p:input name="config">
<xdb:update collection="/db/abbsys"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" xsl:version="2.0">
<xu:modifications version="1.0">
<xu:insert-after
select="/dm:Static-Data/dm:Companies/dm:Company[last()]"
xmlns:dm="
http://www.myns.no/data-model">
<xsl:copy-of
select="/dm:Static-Data/dm:Companies/dm:Company"/>
</xu:insert-after>
<xu:insert-after
select="/dm:Static-Data/dm:Users/dm:User[last()]"
xmlns:dm="
http://www.myns.no/data-model">
<xsl:copy-of select="/dm:Static-Data/dm:Users/dm:User"/>
</xu:insert-after>
</xu:modifications>
</xdb:update>
</p:input>
<p:output name="data" id="update"/>
</p:processor>
<p:processor name="oxf:xmldb-update">
<p:input name="datasource" href="../datasource.xml"/>
<p:input name="query" href="#update" debug="xmldb-update"/>
</p:processor>
Here's a snippet of the xmldb-update debugging output from the orbeon.log
<xdb:update xmlns:xdb="
http://orbeon.org/oxf/xml/xmldb"
xmlns:xforms="
http://www.w3.org/2002/xforms"
xmlns:oxf="
http://www.orbeon.com/oxf/processors"
xmlns:p="
http://www.orbeon.com/oxf/pipeline"
xmlns:dm="
http://www.myns.no/data-model"
xmlns:exist="
http://exist.sourceforge.net/NS/exist"
xmlns:xu="
http://www.xmldb.org/xupdate" collection="/db/abbsys">
<xu:modifications version="1.0">
<xu:insert-after
select="/dm:Static-Data/dm:Companies/dm:Company[last()]">
<Company xmlns="
http://www.myns.no/data-model">
<Name>My Company</Name>
<Address1>My street 17</Address1>
<Address2/>
<PO-Box/>
<ZipCode>1234</ZipCode>
<City>My City</City>
<Phone>12345678</Phone>
<Discount/>
<VAT-Number/>
<WebSite/>
<Invoice/>
</Company>
</xu:insert-after>
<xu:insert-after select="/dm:Static-Data/dm:Users/dm:User[last()]">
<User xmlns="
http://www.myns.no/data-model">
[hidden email]
<Company ref=""/>
<FirstName>John</FirstName>
<LastName>Olsen</LastName>
<Phone/>
<Password>mysecretpassword</Password>
<Password2/>
<OpenIdUrl/>
<IP4-Ranges>
<Matcher segm1="" segm2="" segm3="" segm4=""/>
</IP4-Ranges>
<Subscriptions>
<Canceled>false</Canceled>
<StartDate/>
<ExpireDate/>
<Calculations updated="">
<MaxWebSessions>1</MaxWebSessions>
<Book ref="mybook"/>
</Calculations>
</Subscriptions>
</User>
</xu:insert-after>
</xu:modifications>
</xdb:update>
--
View this message in context:
http://n4.nabble.com/Problems-adding-content-to-an-xml-file-in-exist-using-orbeon-tp276774p276774.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws