开发者

Eclipse JavaScript support in XML

开发者 https://www.devze.com 2023-03-29 14:24 出处:网络
Eclipse provides 2 Plugins to Work with XML and javascript, namely \"Eclipse XML Editors and Tools\" and \"Javascript Development Tools\".

Eclipse provides 2 Plugins to Work with XML and javascript, namely "Eclipse XML Editors and Tools" and "Javascript Development Tools".

If I open a *.js file, I get javascript support, if I open a *.xml file, I get XML support. Those tools work.

If I open a *.xhtml file, I get those combined (XML support for the xhtml tags and javascript support for the included javascript tags).

Now I have another XML file format, which is NOT xhtml, but also contains embedded ja开发者_C百科vascript code. For example:

<xui>
  <name>Test</name>
  <script type="text/javascript"><![CDATA[
    alert( 1 );
  ]]></script>
</xui>

Is there any way to get XML support and javascript support to work within the same file?


I don't think so. The reason its working this way is because there was an editor written explicitly for the file you're opening. There isn't really a way to say "combine the functionality of these two editors". Also, even if you did find such a thing, you have you're script wrapped in a CDATA element, which tells any xml parsers to ignore it, and so if you're editor is looking for xml it will ignore the script.

If I were you, I would try and remove the cdata, and open it in the html editor. Since it is possible to embed javascript in html, the eclipse editor might account for that and provide some useful syntax highlighting (even though I don't know this for sure, its worth a shot). If not, you could also give notepad++ a shot if you're on a windows box (or VI on anything else). There also might be some Aptana plugins that you might find useful; even though I can't name any off of the top of my head.

0

精彩评论

暂无评论...
验证码 换一张
取 消