Programmers who use Java development often learn, may involve the use of configuration files, when using eclipse like the IDE to edit configuration profiles, if the configuration file does not automatically associate, it is a more annoying thing. The author here to take MyBatis configuration can not automatically prompt for example.
Problem description
The following configuration code can not be automatically prompted in the IDE when you are learning from the official documentation.
<?xml version= "1.0" encoding= "UTF-8"?><! DOCTYPE configuration Public "-//mybatis.org//dtd Config 3.0//en" "Http://mybatis.org/dtd/mybatis-3-config.dtd" ><Configuration> <Environmentsdefault="Development" > <EnvironmentId="Development" > <TransactionManagerType="JDBC"/> <DataSourceType="Pooled" > <PropertyName="Driver"Value="${driver}"/> <PropertyName="url"Value="${url}"/> <PropertyName="Username"Value="${username}"/> <PropertyName="Password"value="${password}"/> </datasource> </ environment> </environments> <mappers> <mapper resource= "Org/mybatis/example/blogmapper.xml"/> </mappers></configuration> Process steps
1. First need to ensure that the local presence of the corresponding DTD file in the XML file, generally provided in the official download package has been provided, you can also directly access the HTTP://MYBATIS.ORG/DTD/MYBATIS-3-CONFIG.DTD address download to local;
2. Then configure it in the IDE, Window--preference--xml--xml catalog, add,
3. On the Add page the different key type corresponds to a different value, the location represents the local path,
4. Configure the Wencheng after the corresponding configuration file can be prompted,
Postscript
Other similar configuration files can be referred to this idea for processing, should all be done. In the end, the DTD is an effective way to ensure that the XML document is well formed, and you can compare the XML document and the DTD file to see if the document conforms to the specification and whether the elements and labels are used correctly.
Eclipse turn on Mybatis-config.xml profile Smart Tips