Vladimir,
Yes, we get the same result from our test cases and I agree with you
that doing this with some strings is probably better than files.
And please excuse my ranting about this problem - it's just that it
has been around for so long with nothing apparently being done about
it. There were even surveys taken months ago looking for anyone that
had XUpdate working. It will certainly be very good for Xindice that
the XUpdate problem finally gets resolved. I could not see Xindice
releasing 1.1 without it (XUpdate) working. Let's hope that the
xapi-dev group will address the issue quickly.
And, thanks for all your attention on this issue. :)
Regards,
-Gerry Reno
--- "Vladimir R. Bossicard" <[EMAIL PROTECTED]> wrote:
> Hi Gerry,
>
> Ok, it's not totally what I expected but I really appreciate your
> effort. And in fact you were pretty close, so here's the mail I
> would
> have liked to read:
>
> When I try to run an Xupdate query, I receive the following
> exception:
>
> org.xmldb.api.base.XMLDBException: Query error: java.lang.Exception:
> java.lang.NoClassDefFoundError: org/apache/xerces/framework/XMLParser
>
> I first wanted to write a test to reproduce the bug. I looked into
> the
> java/tests/org/apache/xindice/integration/client and noticed the
> CollectionTest and DocumentTest. So I did some copy/paste with the
> example found in the xindice/java/example/xml folder and I came up
> with
> the following test:
>
> public class XUpdateQueryTest
> extends AbstractXmlDbClientTest {
>
> public void testUpdateDocument()
> throws Exception {
> String document = "<?xml version=\"1.0\"?>" +
> "<person>" +
> "<fname>John</fname>" +
> "<lname>Smith</lname>" +
> "<phone type=\"work\">563-456-7890</phone>" +
> "<phone type=\"home\">534-567-8901</phone>" +
> "<email type=\"home\">[EMAIL PROTECTED]</email>"
> +
> "<email type=\"work\">[EMAIL PROTECTED]</email>" +
> "<address type=\"home\">34 S. Colon St.</address>"
> +
> "<address type=\"work\">9967 W. Shrimp
> Ave.</address>" +
> "</person>";
>
> this.client.insertDocument(TEST_COLLECTION_PATH,
> "xupdatedoc",
> document);
> assertEquals(1,
> this.client.countDocument(TEST_COLLECTION_PATH));
>
> String xupdate = "<xu:modifications version=\"1.0\"" +
> " xmlns:xu=\"http://www.xmldb.org/xupdate\">" +
> " <xu:remove select=\"/person/[EMAIL PROTECTED] =
> 'home']\"/>" +
> " <xu:update select=\"/person/[EMAIL PROTECTED] =
> 'work']\">" +
> " 480-300-3003" +
> " </xu:update>" +
> "</xu:modifications>";
>
> String updatedDocument = "<?xml version=\"1.0\"?>" +
> "<person>" +
> "<fname>John</fname>" +
> "<lname>Smith</lname>" +
> "<phone type=\"work\">408-300-3003</phone>" +
> "<email type=\"home\">[EMAIL PROTECTED]</email>"
> +
> "<email type=\"work\">[EMAIL PROTECTED]</email>" +
> "<address type=\"home\">34 S. Colon St.</address>"
> +
> "<address type=\"work\">9967 W. Shrimp
> Ave.</address>" +
> "</person>";
>
> Collection col =
> this.client.getCollection(TEST_COLLECTION_PATH);
> XUpdateQueryService service = (XUpdateQueryService)
> col.getService("XUpdateQueryService", "1.0");
>
> long count = service.update(xupdate);
> assertEquals(1, count);
>
> String doc = this.client.getDocument(TEST_COLLECTION_PATH,
> "xupdatedoc");
> assertNotNull(doc);
> assertEquals(updatedDocument, doc);
>
> this.client.removeDocument(TEST_COLLECTION_PATH,
> "xupdatedoc");
> assertEquals(0,
> this.client.countDocument(TEST_COLLECTION_PATH));
> }
>
> }
>
> 2 things to notice:
> - since we are testing a service, I created a new package
> - I do not work with files but with Strings. It will be easier to
> execute the tests on different platforms.
>
> When I execute the tests, I have the following error:
>
> [junit] Testcase: testUpdateDocument took 0.125 sec
> [junit] Caused an ERROR
> [junit] org/apache/xerces/framework/XMLParser
> [junit] java.lang.NoClassDefFoundError:
> org/apache/xerces/framework/XMLParser
> [junit] at
>
org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.<init>(XUpdateQueryResolver.java:142)
> [junit] at
>
org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryResolver.java:119)
> [junit] at
> org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:163)
> [junit] at
>
org.apache.xindice.core.Collection.queryCollection(Collection.java:807)
> [junit] at
>
org.apache.xindice.client.xmldb.embed.CollectionImpl.query(CollectionImpl.java:443)
> [junit] at
>
org.apache.xindice.client.xmldb.XindiceCollection.query(XindiceCollection.java:285)
> [junit] at
>
org.apache.xindice.client.xmldb.services.QueryService.query(QueryService.java:130)
> [junit] at
>
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpdateQueryServiceImpl.java:124)
> [junit] at
>
org.apache.xindice.integration.client.services.XUpdateQueryTest.testUpdateDocument(XUpdateQueryTest.java:41)
> [junit] at
> junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> [junit] at
> junitx.extensions.TestSetup$1.protect(TestSetup.java:81)
> [junit] at
> junitx.extensions.TestSetup.run(TestSetup.java:87)
> [junit] at
> junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> [junit] at
> junitx.extensions.TestSetup$1.protect(TestSetup.java:81)
> [junit] at
> junitx.extensions.TestSetup.run(TestSetup.java:87)
>
> Hurra, I have the same error (except that I run the embed version,
> but
> in this case it doesn't matter).
>
> Ok I noticed that the first line is XUpdateQueryResolver, line 142.
> This line calls the constructor of XUpdateQueryImpl. It's reasonable
> that the error comes from this code. This class is from the xmldb
> xupdate package so I checked out the xmldb project and this project
> uses
> the xerces-1.4.3.jar version. I guess it's where the problem comes
> from.
>
> I sent a mail to the xapi-dev mailing list to let them know about the
> problem.
>
> In the meantime, we have a new (failing) test and I hope that
> everything
> will be fixed pretty soon. Since it's quite urgent for me.
>
> ---- end of message --->
>
> Writing the mail took me twice the time I needed to write the test
> and
> find the problem and send the mail to the xapi-dev guys. I don't
> want
> to blame anybody, but just show that writing a test can really help
> finding the errors.
>
> Hope this will inspire other.
>
> Regards,
>
> -Vladimir
>
> --
> Vladimir R. Bossicard
> Apache Xindice - http://xml.apache.org/xindice
>
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com