I am trying to substitute the content of an element with its content in a document, using
copy $e := doc("document") modify ( for $x in $e//C return replace node $x with $x/text() ) return $e
Although this seems to be a plain query, it never ends when launched, so that I am forced to quit BaseX. Any suggestions? Thanks!
PS: my document contains a lot of the elements I want to change. I do not know whether there si an "easy" alternative to "copy"/"replace"
Best, Joseph
I am trying to substitute the content of an element with its content in a document
What do you mean by that? Wouldn’t the result be the same if you substitute the content with the content?
In the given query, you are replacing the elements with their text nodes; is this what you actually want?
copy $e := doc("document") modify ( for $x in $e//C return replace node $x with $x/text() ) return $e
Although this seems to be a plain query, it never ends when launched, so that I am forced to quit BaseX. Any suggestions? Thanks!
PS: my document contains a lot of the elements I want to change. I do not know whether there si an "easy" alternative to "copy"/"replace"
Hi Joseph,
I tried your query with a smaller database (10 MB),
copy $e := db:open("test") modify ( for $x in $e//*[text()] return replace node $x with $x/text() ) return $e
and it was executed in around a second. Maybe you need to assign more memory to BaseX?
On Fri, Sep 16, 2016 at 12:07 PM, Christian Grün christian.gruen@gmail.com wrote:
I am trying to substitute the content of an element with its content in a document
What do you mean by that? Wouldn’t the result be the same if you substitute the content with the content?
In the given query, you are replacing the elements with their text nodes; is this what you actually want?
copy $e := doc("document") modify ( for $x in $e//C return replace node $x with $x/text() ) return $e
Although this seems to be a plain query, it never ends when launched, so that I am forced to quit BaseX. Any suggestions? Thanks!
PS: my document contains a lot of the elements I want to change. I do not know whether there si an "easy" alternative to "copy"/"replace"
basex-talk@mailman.uni-konstanz.de