myeclipse 自定义xml模板,供新建xml文件时自动导入 (转)

最近在看spring in action ,在配置bean的xml文件时,要加入长长的名字空间描述,如:

     <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

     为了避免每一次新建项目时,手动输入这些配置文件,可以自定义xml模板文件,便于自动导入,方法如下:

     1、Myeclipse下选择Window -> preferences -> MyEclipse -> Files and Editors -> XML -> XML Templates,在右边对话框中选择

       new,进入新建对话框,填写name(自己定义),context下拉条选择New XML(这里一点要选择这个,如果选择了其他的话会出问题),Description中自定义描述内容,在Pattern中输入自定义的配置xml模板内容,最后注意的是要勾选那个autoinsert选项,点击OK,完成。

      在使用时,选择New -> XML(Basic Templates) -> next -> create XML file from an XML template -> next ,选择自定义的模板name即可。

原文地址:https://www.cnblogs.com/com-wushuang/p/5303119.html