<% %> and <%= %> in xml for javascript code injection

Answered

I have a case to use <% %> and <%= %> syntaxes in XML to inject javascript code.

first, the syntaxes are showing errors because they are not allowed in the XML file.

second, the javascript code is not recognized.

Is there a way to define the syntaxes in XML and inject the code in the syntaxes

0
1 comment

XML does not allow such tags, so it would not be possible to use them in xml file without IDE reporting a error.

But you can give such file some custom extension name, e.g. my_xml_file.js.xml and register *.js.xml extension patter for the HTML file type in Settings (Preferences on macOS) | Editor | File Types | Editor | File Types settings. Then IDE will treat such files as html files and you would be able to use injections for these tags:

0

Please sign in to leave a comment.