XmlModify gives me the error “Cannot perform a modification on an XmlValue that isn either Node or Document”. What is the problem?
This error usually means that the value you have selected to perform a modification on does not come from the exact same XmlDocument as the one given to XmlModify::execute(). This is based on reference equality, rather than the same document obtained from the database in two different ways. For instance, this will give you an error: modify.addRemoveStep(manager.prepare(“doc(‘container/foo’)//bar”, qc)); XmlDocument foo = container.getDocument(“foo”); modify.execute(XmlValue(foo), qc, uc); where as this will not: modify.addRemoveStep(manager.prepare(“.//bar”, qc)); XmlDocument foo = container.getDocument(“foo”); modify.execute(XmlValue(foo), qc, uc); The simple rule of thumb should be that the modify step’s query should always be relative – that is, it should navigate from the context item (“.”), rather than using the fn:doc() or fn:collection().
Related Questions
- Crashes/ExceptionsI receive an unexpected error message when I perform some operation, how do I report the problem so that you can diagnose it?
- XmlModify gives me the error "Cannot perform a modification on an XmlValue that isn either Node or Document". What is the problem?
- My embedded document suddenly gives me an error message about a previous version of iPaper! What do I do?