Hi,
I have a problem in Chiba 1.0.0 with submitting a form with replace set to
'instance' when instance has a namespace prefix. It works fine with
instance placed in no namespace (xmlns="").
Symptom: replacement instance document is received and parsed correctly,
but no updates are shown on the form - it still contains data from before
the submit.
To reproduce: take the (say) actions example and modify the instance to
have all elements within the (say) 'test' namespace with 't' as prefix.
Then modify the generate-instance.jsp in the same way. Open the example
form and click the submit button that uses replace="instance". Nothing
happens - instance data is ignored.
I've tracked this down to the way JXPath context is handled in the Instance
class. The exact sequence of events that leads to the incorrect behaviour
is quite convoluted (please ask if you need details and I'll post them).
The short story is that the JXPathContext within an Instance object needs
to be reinitialised whenever a new document is set using
Instance.setInstanceDocument. You can get away with not reinitialising the
context if you don't use namespaces due to the way JXPath functions
internally. However, as soon as namespaces are used, JXPathContext updates
its state in such a way as to remember the root pointer into the old
document. This pointer is never refreshed again, even after
Instance.setInstanceDocument is called, so it continues pointing into the
old document. Hence the updated values do not appear in the user interface.
My tentative fix is to pull context initialisation out of Instance.init
method into a separate initInstanceContext method and call that from init
and setInstanceDocument. Please let me know if you would like me to post
this as a patch. It appears to work for me.
Regards,
Tomislav
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|