From: Robert K. <ro...@ko...> - 2006-10-30 14:20:16
|
Hi again, Pierrick Brihaye wrote: > Hi, >=20 > Robert Koberg a =E9crit : >=20 >> Using the latest, I am not able to do XUpdates with namespaced=20 >> elements in attribute values anymore. >=20 > It may be a more general serialization problem. You should try to creat= e=20 > an test case... Yes. Even with adding the namespace as I describe below, they still get=20 stripped out somewhere in the XQuery eval/compile(???). This did not=20 happen somewhere in the middle of last week - but I can't figure out=20 what changed... (somewhere in the antlr generated code??) However, when I made the changes to the DocumentBuilderReceiver as I=20 describe below, it broke the DOMTest test case - don't know why... So I=20 went back to including a namespaced attribute to force inclusion of the=20 namespace. It seems now, that each line in the XUpdate is passed as is to=20 org.exist.xquery.functions.xmldb.XMLDBXUpdate. So that means if you have=20 a namespace declared on the root element, you will get the exception on=20 each (well, the first) XUpdate element child that does not have the=20 namespace declared. For example, the test case for=20 eXist-1.0/src/org/exist/xupdate/test/modifications/namespaces.xml works=20 because it only has one line: <xu:modifications version=3D"1.0" xmlns:xu=3D"http://www.xmldb.org/xupdat= e"> <!-- update a node value --> <xu:update xmlns:t=3D"http://test.com" select=3D"/t:root/t:node">Hello= =20 World!</xu:update> </xu:modifications> So, I guess the test case (that you asked for Pierrick) would be to=20 change namespaces.xml to be: <xu:modifications version=3D"1.0" xmlns:xu=3D"http://www.xmldb.org/xupdat= e"=20 xmlns:t=3D"http://test.com"> <!-- update a node value --> <xu:update select=3D"/t:root/t:node">Hello World!</xu:update> </xu:modifications> -------------------------------- I thought XUpdate was a nice, clean separation for my needs. But it=20 seems no one is using it?? Otherwise, I would not be the only one with=20 this problem. I spent about 6 hrs on this last night, but could not get=20 very far. I guess I will start experimenting with:=20 http://exist.sourceforge.net/update_ext.html thanks for your help/time, -Rob >=20 >> Previously I had used a 'dummy' attribute to force the content handler= =20 >> to include the namespace, but it does not do that anymore. >=20 > Yes, that's possible : better a real fix than workarounds :-) >=20 >> I was wondering if a workaround could go something like this: >> >> Add a namespace prefix and uri map to DocumentBuilderReceiver. On=20 >> startPrefixMapping add the uri as the key and the prefix as the value.= =20 >> When the prefix is found in a startElement or attribute, remove the=20 >> uri+prefix from the map. On endDocument loop through the map and use=20 >> the MemTreeBuilder.getDocument().getDocumentElement() and pass it a=20 >> fake QName made with the map entry. >> >> What do you think? >=20 > It may be worth a try. Feel free to provide a patch... and a test case=20 > that demonstrates that you have fixed the issue. >=20 > Good luck ! >=20 > Cheers, >=20 > p.b. >=20 >=20 |