Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

XmlModify gives me the error “Cannot perform a modification on an XmlValue that isn either Node or Document”. What is the problem?

0
Posted

XmlModify gives me the error “Cannot perform a modification on an XmlValue that isn either Node or Document”. What is the problem?

0

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

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123