This article mainly introduces how to support XML development in the Eclipse platform, focusing on the XMLBuddy plugin.
Here is only one of Money, which is XMLBuddy. It is mainly provided to be validated by DTD, the code assistant and other functions; if there is an XMLBuddy Pro, which extends many features relative to XMLBuddy For example, support for Schema, XSLT, RELAX NG. For XML general writing, XMLBuddy is already enough, and it is free, it is easy to get, so you will pay attention to it.
First, download and installation
Download
XMLBUDDY's home page address is:
http://www.xmlbuddy.com/
Download Warranty is XMLBuddy, not XMLBuddy Pro. Here is a download address in XMLBuddy 2.0.38:
http://xmlbuddy.com/2.0/78945789050508924908525/8902390238490587584751/Xmlbuddy_2.0.38.zip
Note: This version matches Eclipse 3.0.1-3.1m5.
In order to explain, the Eclipse version I use is 3.0.1, and the Chinese language package is installed, and there is no other plugin installed. Figure:
2. Installation
Install XMLBuddy 2.0.38
First decompress this downloaded file, then copy the directory of com.objfac.xmleditor_2.0.38 to the plugins directory in the Eclipse installation directory; or installation can be installed in a LINKS.
Start Eclipse again, you should find that XMLBuddy has been installed.
3. Customize
If you want to customize XMLBUDDY, you can pass
Window -> Preferences -> XMLBuddy to modify:
Second, use XMLBuddy
Let's start explaining how to use XMLBuddy:
· Newly built a Java project named "XMLBuddyDemo" and then build a web.xml file. as follows:
XML Version = "1.0" encoding = "GBK"?>
Public "- // Sun microsystems, Inc.//dtd Web Application 2.3 // en"
"http://java.sun.com/dtd/web-app_2_3.dtd">
welcome-file-list>
web-app>
· If there is no connection to the Internet at this time, as shown below:
At this time, if you enter the code, there will be no functionality of the code prompt.
· Connect the Internet, reopen the web.xml file, pause the moment (XMLBuddy will automatically download the web-app_2_3.dtd), then follow the figure:
You can also use "ALT /" to perform code hints.
· The completed code:
XML Version = "1.0" encoding = "GBK"?>
PUBLIC "- // sun microsystems, inc." "Http://java.sun.com/dtd/web-app_2_3.dtd">
welcome-file-list>
404
error-code>
/ERROR.JSP
location>
Error-Page>
web-app>
How, convenient!
supplement:
If you open the "F1" file under Eclipse Directory / Workspace/.metadata/.plugins/com.objfac.xmleditor/.cache (not necessarily F1 this name, maybe F2, F3, etc.), will find this file is Web-app_2_3.dtd.
• If you cannot connect the Internet, or the link contained in the namespace is invalid, you can get the web-app_2_3.dtd file by other ways, such as putting it in the D: / XML directory, then directly reference, as follows:
XML Version = "1.0" encoding = "GBK"?>
Public "- // Sun microsystems, Inc.//dtd Web Application 2.3 // en"
"file: /// D: /Xml/weB-app_2_3.dtd">
welcome-file-list>
web-app>
You can try the namespace (ie
! DOCTYPE tags) Remove, which can be deployed in Tomcat.
· XMLBuddy has other functions, such as "formatting" code.
Third, some questions
Other plugins, such as Lomboz, JBoss-IDE, etc., although you can edit the XML file, but it is not as XMLBuddy, not so much here.
However, it is important to note that when multiple plug-ins is installed, the default open mode of the XML file is not necessarily XMLBuddy (this is the result after installing JBoss-IDE), at this time, you can select the XML file to open, right click, Select XMLBuddy to open, when opening this XML file next time, Eclipse will call XMLBUDDY by default. Of course, you can also choose other plugins to open. You can also operate by modifying the default open mode of the XML file (
Window -> Preferences -> Workbench-> file associations can even call an external software (such as XML SPY) to operate the XML file (if you think that these plugins are not intentional).
In general, XMLBuddy is still very good for the XML document type DTD, but it is not very good for the XML document type for the W3C XML Schema mode, of course, you can use XMLBuddy. PRO version editing, but it seems that it is not easy to use. Fortunately, most of them are still DTD, so XMLBuddy is still used. Now, there is a project under Eclipse, "Eclipse Web Tools Platform Project", the current version is 1.0M3, mainly used to develop J2EE and web applications, of course, you can edit the XML file. Try it is still very good, here is given a picture to give you a thirst:
In fact, I have always believed that the XML file is a way to communicate with procedures, but should not be a way to communicate with programmers. I always feel that it is too arrogant, I can't stand it, I am like Tang Yan (a joke, relax relaxation). So I generally don't want to write XML files, often using xdoclets to generate an XML file. These are all outside the question, they will be reluctant.