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 Co...@za.didata.com on 2002/06/13 15:00:50 UTC

Problem with xupdate using xml-rpc.

Hi 

Can anyone tell me if i am doing something wrong?  I did search the mailing
lists, but could not find any helpful info.

I am using the xindice xml-rpc functionality with python.

My system is as follows:

Linux 2.4
xinidce version 1.0
xindice-xmlrpc-0.6
python 2.2

My XPath queries work perfectly, but the xupdate queries does not work.

My program is as follows:

	import xmlrpclib
	import re

	server = xmlrpclib.Server( "http://localhost:4080" )

	updatequery = """<xu:modifications version='1.0'
xmlns:xu='http://www.xmldb.org/xupdate'>
		<xu:update select='document/revision'>10</xu:update>
	</xu:modifications>"""

	# define the namespace for xupdate
	l = {}
	l['xu'] = 'http://www.xmldb.org/xupdate'

	# perform the xupdate query
	d = server.db.queryDocument( "/db/homesite", "XUpdate", updatequery,
l )
	print d

	# perform the xpath query
	d = server.db.queryDocument( "/db/homesite", "XPath",
'/document/revision', {}, "index" );
	print d

The output of the XUpdate query is as follows:

<?xml version="1.0"?>
<result count="1">
  <src:modified
xmlns:src="http://xml.apache.org/xindice/Query">0</src:modified>
</result>

The output of the XPath query is as follows:

<?xml version="1.0"?>
<result count="1">
  <revision xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/homesite" src:key="index">$Id$</revision>
</result>

Thus:  Although the same xpath are used to locate the node (revision) for
query and update, the xupdate query does not actually update the value, thus
the result that 0 nodes are modified.

I have been using xindice for a week and think it is great.  It was a snap
configure it and perform xpath 
queries to it from zope.

Regards,
Cobus Nel


This message contains information intended solely for the addressee,
which is confidential or private in nature and subject to legal privilege.
If you are not the intended recipient, you may not peruse, use,
disseminate, distribute or copy this message or any file attached to this
message. Any such unauthorised use is prohibited and may be unlawful. If
you have received this message in error, please notify the sender
immediately by e-mail, facsimile or telephone and thereafter delete the
original message from your machine. 
 
Furthermore, the information contained in this message, and any
attachments thereto, is for information purposes only and may contain the
personal views and opinions of the author, which are not necessarily the
views and opinions of Dimension Data (South Africa) (Proprietary) Limited
or is subsidiaries and associated companies ("Dimension Data"). Dimension
Data therefore does not accept liability for any claims, loss or damages
of whatsoever nature, arising as a result of the reliance on such
information by anyone. 
 
Whilst all reasonable steps are taken to ensure the accuracy and
integrity of information transmitted electronically and to preserve the
confidentiality thereof, Dimension Data accepts no liability or
responsibility whatsoever if information or data is, for whatsoever
reason, incorrect, corrupted or does not reach its intended destination.  
 	


AW: Problem with xupdate using xml-rpc.

Posted by Daniel Kroeger <ze...@zesolo.net>.
Hi Cobus.

am I right, if I say you forgot the id of the document to xupdate?

Both types of queries with "queryDocument", XPath or XUpdate need a doc-id.
(At least in using perl over XML-RPC)

Daniel

> -----Ursprüngliche Nachricht-----
> Von: Cobus.Nel@za.didata.com [mailto:Cobus.Nel@za.didata.com]
> Gesendet: Donnerstag, 13. Juni 2002 15:01
> An: xindice-users@xml.apache.org
> Betreff: Problem with xupdate using xml-rpc.
>
>
> Hi
>
> Can anyone tell me if i am doing something wrong?  I did search
> the mailing
> lists, but could not find any helpful info.
>
> I am using the xindice xml-rpc functionality with python.
>
> My system is as follows:
>
> Linux 2.4
> xinidce version 1.0
> xindice-xmlrpc-0.6
> python 2.2
>
> My XPath queries work perfectly, but the xupdate queries does not work.
>
> My program is as follows:
>
> 	import xmlrpclib
> 	import re
>
> 	server = xmlrpclib.Server( "http://localhost:4080" )
>
> 	updatequery = """<xu:modifications version='1.0'
> xmlns:xu='http://www.xmldb.org/xupdate'>
> 		<xu:update select='document/revision'>10</xu:update>
> 	</xu:modifications>"""
>
> 	# define the namespace for xupdate
> 	l = {}
> 	l['xu'] = 'http://www.xmldb.org/xupdate'
>
> 	# perform the xupdate query
> 	d = server.db.queryDocument( "/db/homesite", "XUpdate", updatequery,
> l )
> 	print d
>
> 	# perform the xpath query
> 	d = server.db.queryDocument( "/db/homesite", "XPath",
> '/document/revision', {}, "index" );
> 	print d
>
> The output of the XUpdate query is as follows:
>
> <?xml version="1.0"?>
> <result count="1">
>   <src:modified
> xmlns:src="http://xml.apache.org/xindice/Query">0</src:modified>
> </result>
>
> The output of the XPath query is as follows:
>
> <?xml version="1.0"?>
> <result count="1">
>   <revision xmlns:src="http://xml.apache.org/xindice/Query"
> src:col="/db/homesite" src:key="index">$Id$</revision>
> </result>
>
> Thus:  Although the same xpath are used to locate the node (revision) for
> query and update, the xupdate query does not actually update the
> value, thus
> the result that 0 nodes are modified.
>
> I have been using xindice for a week and think it is great.  It was a snap
> configure it and perform xpath
> queries to it from zope.
>
> Regards,
> Cobus Nel
>
>
> This message contains information intended solely for the addressee,
> which is confidential or private in nature and subject to legal privilege.
> If you are not the intended recipient, you may not peruse, use,
> disseminate, distribute or copy this message or any file attached to this
> message. Any such unauthorised use is prohibited and may be unlawful. If
> you have received this message in error, please notify the sender
> immediately by e-mail, facsimile or telephone and thereafter delete the
> original message from your machine.
>
> Furthermore, the information contained in this message, and any
> attachments thereto, is for information purposes only and may contain the
> personal views and opinions of the author, which are not necessarily the
> views and opinions of Dimension Data (South Africa) (Proprietary) Limited
> or is subsidiaries and associated companies ("Dimension Data"). Dimension
> Data therefore does not accept liability for any claims, loss or damages
> of whatsoever nature, arising as a result of the reliance on such
> information by anyone.
>
> Whilst all reasonable steps are taken to ensure the accuracy and
> integrity of information transmitted electronically and to preserve the
> confidentiality thereof, Dimension Data accepts no liability or
> responsibility whatsoever if information or data is, for whatsoever
> reason, incorrect, corrupted or does not reach its intended destination.
>
>