Page 1 of 1

Uncommenting code when writing XQuery

Posted: Thu Dec 21, 2017 11:42 am
by Martin Honnen
Suppose I write an XQuery where I first have e.g.

Code: Select all

>
<root>
<foo>a</foo>
<bar>1</bar>
</root>
and then decide to comment out the "foo" element node by selecting it with the mouse and using the context menu in XML Editor 19.1, build 2017121318, "toggle comment", then oXygen gives me

Code: Select all


<root>
(:<foo>a</foo>:)
<bar>1</bar>
</root>
that is, it wraps the element node into XQuery comment delimiters. This, however, does not comment out the element node, when I run the query the result is

Code: Select all


<root>
(:<foo>a</foo>:)
<bar>1</bar>
</root>
, meaning the attempt of oXygen to comment out the element has only resulted into inserting text before and after the element.

I think the right way to comment out something in content is to use an enclosed expression

Code: Select all


<root>
{(:<foo>a</foo>:)}
<bar>1</bar>
</root>
So it seems the "toggle comment" menu feature for XQuery editing could be enhanced to make sure that a necessary enclosed expression is used to comment out literal content.

Re: Uncommenting code when writing XQuery

Posted: Thu Dec 21, 2017 3:08 pm
by Radu
Hi Martin,

Thanks for the suggestion, I will add an internal issue to look into this.
Of course there is also this way to add a comment inside that XML:

Code: Select all

<root>
<!--<foo>a</foo>-->
<bar>1</bar>
</root>
if the end user actually wants the XML comment to appear in the output.
So I'm not sure what the end user actually wants when invoking the "Toggle comment" in an XML document inside an XQuery.

Regards,
Radu

Re: Uncommenting code when writing XQuery

Posted: Thu Dec 21, 2017 3:59 pm
by Martin Honnen
I agree that using an XML comment with

Code: Select all


<root>
<!--<foo>a</foo>-->
<bar>1</bar>
</root>
is also an option a user editing XQuery might want or expect with the "Toggle comment" feature. On the other hand, I for sure was looking for a way for the editor to assist me in commenting out that element and not to produce a comment with the element.