Here we only introduce XMLBuddy, which mainly provides functions such as DTD verification and code assistant, and XMLBuddy Pro, which extends many functions compared with XMLBuddy, for example, it supports Schema, XSLT, And relax ng, but it requires Money. XMLBuddy is enough for general XML writing, and it is free and easy to get, so I will focus on it here.
1. Download and install
1. Download
XMLBuddy home address is: http://www.xmlbuddy.com/
Please note that the download is XMLBuddy, not XMLBuddy Pro. Here is an example of XMLBuddy 2.0.38:
Http://xmlbuddy.com/2.0/78945789020508924908525/8902390238490587584751/xmlbuddy_2.0.38.zip
Note: This version matches eclipse 3.0.1-3.1M5.
For ease of explanation, I used eclipse 3.0.1 and installed a Chinese Language Pack without installing other plug-ins.
2. Installation
Install XMLBuddy 2.0.38, decompress the downloaded file, and copy the com. objfac. xmleditor_2.0.38 directory to the plugins directory under the eclipse installation directory. You can also install XMLBuddy in links mode.
Start eclipse again and you will find that XMLBuddy has been installed.
3. Customization
To customize XMLBuddy, you can use WINDOW> preference> XMLBuddy to modify it:
Ii. Use XMLBuddy
The following describes how to use XMLBuddy:
· Create a Java project named "XMLBuddyDemo" and create a web. xml file. As follows:
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
· If the Internet is not connected at this time, for example:
At this time, if you enter the code, the code prompt function will not appear.
Connect to the Internet, re-open the web. xml file, pause for a moment (XMLBuddy will automatically download the web-app_2_3.dtd), and then perform the operation:
You can also use "Alt +/" for code prompts.
· Code after completion:
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>
404
</error-code>
<location>
/error.jsp
</location>
</error-page>
</web-app>
How is it convenient!
Supplement:
If you open the eclipse directory workspace. metadata. pluginscom. objfac. xmleditor. the "f1" file under the cache (not necessarily the f1 name, may be f2, f3 and other names), will find that this file is a web-app_2_3.dtd.
If you cannot connect to the Internet, or the link contained in the namespace is invalid, You can first get the web-app_2_3.dtd file through another channel, such as placing it in the D:/xml directory, then you can directly reference it as follows:
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"file:///D:/xml/web-app_2_3.dtd">
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
You can try to put the namespace (that is! Can be deployed in Tomcat.
· XMLBuddy has other functions, such as "formatting" code.
3.
And some digress
Other plug-ins, such as Lomboz and JBoss-IDE, can also edit XML files, but their performance is not as good as XMLBuddy.
Note that after multiple plug-ins are installed, the default Opening Method of the XML file is not necessarily XMLBuddy (this is the result after JBoss-IDE is installed, you can right-click the XML file to be opened and select XMLBuddy to open it. eclipse will call XMLBuddy by default when the XML file is opened again. Of course, you can also choose another plug-in to open it. You can also modify the default opening method of an XML file (WINDOW> preferences> workbench> File Association), or even call an external software (such as XML Spy) operate XML files (if you think these plug-ins are not suitable ).
In general, XMLBuddy is still very good for files whose XML document type is DTD, but it is not good for files whose XML document type is W3C XML Schema mode. Of course, you can use the XMLBuddy Pro version for editing, but it does not seem easy to use. Fortunately, most of them are DTD, so XMLBuddy is still used.
Now, there is a Project under eclipse, which is "Eclipse Web Tools Platform Project". The current version is 1.0M3, which is mainly used to develop J2EE and WEB applications, of course, you can edit the XML file. I tried it for a while and it was quite good. I will give you a picture below to quench your thirst:
In fact, I always think that XML files are a way for programs to communicate with programs, but they should not be a way for programs to communicate with programmers. I always think it's too cool, so I can't stand it, just like tang miao (joke and relax ). Therefore, I am reluctant to write XML files. XDoclet is often used to generate XML files. These are all irrelevant.