473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

4xupdate trouble

Hi,

I'm trying to write a script that uses diffxml along with 4xupdate
to merge XML files. So far, I'm having trouble with even the most
basic files. I have tried different versions of the components, to no
avail. Are there any alternatives? I've put sample files below.

Thanks,
Eyal.

====================================

I want to merge this:

<?xml version="1.0"?>
<root>
<codecs a="10" b="20" />
<timeouts c="10" d="20" e="30" />
<reporting f="10" g="20" />
<lims h="10" />
</root>

with this (note the difference in the reporting node. If the reporting
node does not change, or attributes are added, but none are removed,
4xupdate works):

<?xml version="1.0"?>
<root>
<codecs a="1" b="2" />
<timeouts c="1" d="2" e="3" />
<reporting f="1" z="3" />
<lims h="1">
<lim0 i="1" />
<lim1 i="2" />
<lim2 i="3" />
<lim3 i="4" />
</lims>
<HW j="1" />
</root>

and I get a bunch of errors:
Traceback (most recent call last):
File "/usr/bin/xmldiff", line 5, in ?
xmldiff.run(*sys.argv)
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/xmldiff.py",
line 218, in run
encoding, html)
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/xmldiff.py",
line 114, in process_files
strategy.process_trees(tree1, tree2)
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/fmes.py", line
104, in process_trees
self._formatter.end()
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/format.py",
line 212, in end
AbstractFormatter.end(self)
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/format.py",
line 80, in end
self.format_action(action)
File "/usr/lib/python2.3/site-packages/logilab/xmldiff/format.py",
line 203, in format_action
self._stream.write(action[A_N2])
TypeError: argument 1 must be string or read-only character buffer, not
list

and a diff file looking like this:

<?xml version="1.0"?>
<xupdate:modifications version="1.0"
xmlns:xupdate="http://www.xmldb.org/xupdate">
<xupdate:insert-after select="/root[1]/reporting[1]" >
<xupdate:element name="lims"> <xupdate:attribute
name="h">1</xupdate:attribute>
<lim0 i="1"/>
<lim1/>
<lim2 i="3"/>
<lim3 i="4"/>
</xupdate:element>
</xupdate:insert-after>

<xupdate:rename select="/root[1]/lims[2]" >HW</xupdate:rename>

<xupdate:append select="/root[1]/reporting[1]" > <xupdate:attribute
name="z">3</xupdate:attribute>
</xupdate:append>

<xupdate:rename select="/root[1]/HW[1]/@h" >j</xupdate:rename>

<xupdate:update select="/root[1]/codecs[1]/@a" >1</xupdate:update>

<xupdate:update select="/root[1]/codecs[1]/@b" >2</xupdate:update>

<xupdate:update select="/root[1]/timeouts[1]/@c" >1</xupdate:update>

<xupdate:update select="/root[1]/timeouts[1]/@d" >2</xupdate:update>

<xupdate:update select="/root[1]/timeouts[1]/@e" >3</xupdate:update>

<xupdate:update select="/root[1]/reporting[1]/@f" >1</xupdate:update>

<xupdate:rename select="/root[1]/reporting[1]/@g" >i</xupdate:rename>

<xupdate:move select="[2, '@iName', 'i', [[3, '@i', '2', [], [...], 0,
1, 1, 1]], [1, 'lim1', 'lim1', [[...]], [1, 'lims', 'lims', [[2,
'@hName', 'h', [[3, '@h', '1', [], [...], 0, 1, 1, 1]], [...], 1, 1, 1,
1], [1, 'lim0', 'lim0', [[2, '@iName', 'i', [[3, '@i', '1', [], [...],
0, 1, 1, 1]], [...], 1, 1, 1, 1]], [...], 2, 1, 1, 1], [...], [1,
'lim2', 'lim2', [[2, '@iName', 'i', [[3, '@i', '3', [], [...], 0, 1, 1,
1]], [...], 1, 1, 1, 1]], [...], 2, 1, 1, 1], [1, 'lim3', 'lim3', [[2,
'@iName', 'i', [[3, '@i', '4', [], [...], 0, 1, 1, 1]], [...], 1, 1, 1,
1]], [...], 2, 1, 1, 1]], [1, 'root', 'root', [[1, 'codecs', 'codecs',
[[2, '@aName', 'a', [[3, '@a', '1', [], [...], 0, 1, 1, 1]], [...], 1,
0, 1, 1], [2, '@bName', 'b', [[3, '@b', '2', [], [...], 0, 1, 1, 1]],
[...], 1, 0, 1, 1]], [...], 4, 1, 1, 1], [1, 'timeouts', 'timeouts',
[[2, '@cName', 'c', [[3, '@c', '1', [], [...], 0, 1, 1, 1]], [...], 1,
0, 1, 1], [2, '@dName', 'd', [[3, '@d', '2', [], [...], 0, 1, 1, 1]],
[...], 1, 0, 1, 1], [2, '@eName', 'e', [[3, '@e', '3', [], [...], 0, 1,
1, 1]], [...], 1, 0, 1, 1]], [...], 6, 1, 1, 1], [1, 'reporting',
'reporting', [[2, '@fName', 'f', [[3, '@f', '1', [], [...], 0, 1, 1,
1]], [...], 1, 0, 1, 1], [2, '@zName', 'z', [[3, '@z', '3', [], [...],
0, 1, 1, 1]], [...], 1, 1, 1, 1]], [...], 4, 1, 1, 1], [...], [1, 'HW',
'HW', [[2, '@jName', 'j', [[3, '@j', '1', [], [...], 0, 1, 1, 1]],
[...], 1, 1, 1, 1]], [...], 2, 1, 1, 1]], [6, '/', '', [[...]], None,
21, 0, 0, 1], 20, 1, 1, 1], 14, 1, 1, 1], 2, 1, 1, 1], 1, 1, 0, 1]" >

Apr 25 '06 #1
1 1624
The title of this query is misleading - my problem is with the xupdate
file created by xmldiff. I'm using libxml2 2.5.11, since according to
the documentation, this is the newest version that is known to work
with xmldiff.

Thanks.

Apr 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James | last post by:
Hi I am having some trouble getting a asp page to load. Im a noob to the asp side. I have followed knowledege base Article 301305. I am running 2000 adv, IIS 5.0 I have the following...
4
by: Jacek Dziedzic | last post by:
Hi! First of all, I hope my problem is not too loosely tied to the "standard C++" that is the topic of this group. I have some code that exhibits a strange behaviour: on one computer, where I...
0
by: Paul C | last post by:
Hello, everybody. I am having trouble running some of the VS.NET samples, specifically the CarSelector web app, which is very simple. The symptom is that the web controls (drop down listboxes and...
0
by: Alexandre Jaquet | last post by:
Hi does anybody know how to solve my trouble, when I try to create a MS Office project I always got trouble. I can't create office project when I try to create one vs.net restart ... :s
1
by: Jim Bancroft | last post by:
Hi everyone, I'm running into a problem with my ASP.Net application. I've just created a new aspx page which uses some new components of mine that inherit from ServicedComponent and are...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
2
by: JLupear | last post by:
I am having trouble with my code again, I had prepared a question and the code to upload, however I am having trouble posting it, are there limits to the amount of lines you can post? I split it...
0
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.