Refactoring: comment out elements

Are you missing a feature? Request it's implementation here.
Posts: 54

Refactoring: comment out elements

Thu Jan 14, 2016 11:23 pm

There have been times when I've wanted to temporarily disable a whole class of elements. It would be nice, in the Refactoring options, to allow users to choose via XPath one or more elements to comment out.
Posts: 2478

Re: Refactoring: comment out elements

Tue Feb 02, 2016 6:04 pm


I've logged a feature request on our issue tracking tool to implement this in a future version. We will notify this thread when this is implemented.

Meanwhile, you could make use of an XQuery Update script that does this. You have to enable XQuery Update in Options > Preferences, XML / XSLT-FO-XQuery / XQuery / Saxon-HE/PE/EE, Enable XQuery Update and make sure you use the Saxon-EE XQuery engine.

Code: Select all

let $params :=
<output:serialization-parameters xmlns:output="">
<output:omit-xml-declaration value="yes"/>
for $par in doc("myfile.xml")//*:myelement return
replace node $par with comment {serialize($par, $params)}
where myfile.xml is the file to update and myelement the element to comment. Alternatively, you can adjust the XPath after doc() as required.

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 0 guests