Uncommenting code when writing XQuery

Issues related to W3C XQuery.
Martin Honnen
Posts: 102
Joined: Tue Aug 19, 2014 12:04 pm

Uncommenting code when writing XQuery

Post 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.
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Uncommenting code when writing XQuery

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Martin Honnen
Posts: 102
Joined: Tue Aug 19, 2014 12:04 pm

Re: Uncommenting code when writing XQuery

Post 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.
Post Reply