MyEclipse XML Editor Tutorial
来源:互联网 发布:网络巫师泰剧中字全集 编辑:程序博客网 时间:2024/06/16 12:59
摘自MyEclipse 6.0帮助文件)
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/images/logo.gif)
MyEclipse XML Editor Tutorial
Outline
- Preface
- Introduction
- XML Editing
- XML Design Mode
- XML Source Mode
- Preferences Page
- Resources
- User Feedback
1. Preface
This document was written using Sun JDK 1.4.2, Eclipse 3.2.2 and MyEclipse 5.5. All screenshots are based upon the default user interface settings for Eclipse, MyEclipse Enterprise Workbench, and Windows XP. If you experience difficulty with the instruction of this document, please see the User Feedback section for how to provide feedback to the MyEclipse documentation team.
2. Introduction
This document will cover some of the functionalities available in the MyEclipse XML Editor. The MyEclipse XML editor includes advanced XML editing functionalities like:
- Syntax highlighting
- Tag and attribute content-assist
- Real-time validation (as you type)
- Source, Design and Outline views of the document's contents
- Document formatting
- Content-assist templates
3. XML Editing
Editing XML using the MyEclipse XML Editor can be done in two different modes: Design Mode and Source Mode. You switch between the two modes using the tabs at the bottom of the editor:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_switch_modes.gif)
Switching between the two modes can be done any time as they are both kept in sync with each other automatically. First we will take a look at the Design Mode.
3.1 XML Design Mode
When you first open an XML document and switch to the Design Mode, it will look something like this:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_design_mode.gif)
In this mode the contents of your XML document are shown to you in something of a glorified outline-view. Along the left column you have the tags that make up your document and in the second column you have the values for those tags. You can double-click on any of the values in the second column and edit them directly in this view, making it very easy to visually understand and edit an XML file without worrying about syntax problems.
Another nice feature of using the Design Mode is that you can add, remove and edit tags visually and the designer will make sure to only provide you with options that properly adhere to the DTD or Schema referenced by the document. More specifically, the design won't allow you to insert an invalid tag somewhere.
As an example, let's say we wanted to add a description to the first context-param argument in our XML document:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_design_add_child.gif)
You will notice at this point in the document, according to the Schema referenced by our document, the only valid tags that can be inserted here is a child description tag, a comment tag or a generic processing instruction tag. If we click on the description tag, it is added and we can quickly edit the description to something we want:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_design_add_child_description.gif)
Editing any of the tag values or adding/removing child tags can be done in this fashion without ever needing to switch to the Source Mode for editing. Although editing the source directly can be faster sometimes and some developers prefer it, so let's take a look at that next.
3.2 XML Source Mode
While editing XML documents in design mode can certainly be easier at times and save you from making errors, it's also necessary (or preferred) to work directly with the source code. If that is the case MyEclipse's XML Editor provides extensive source-editing features that we will take a look at below.
When you first open your XML document to edit it, it will look something like this:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_source_mode.gif)
You'll notice a collection of views available to help you edit your document. The source view on the left will look familiar to many, then you have a simplified Outline view on the top right, and Properties view on the bottom right (NOTE: Due to the flexible nature of laying out MyEclipse's views, you can move them anywhere you like and may not look identical to the screenshot above).
All these views will stay in sync with the file you are editing as you work. As you click inside of tags the Properties view will show you the values for that tag, if you decide to remove or add nodes using the Outline view as shown here:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_source_outline.gif)
The Outline view actually provides very similar visual-editing functionality that the Design Mode does if you'd prefer to use it.
If you decide to edit the XML source from the editor you will notice some very nice assistance as you work. For example, mistyping a tag or attribute name will get marked immediately for you as an error (checked against the DTD or Schema referenced by the doc):
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_source_errors.gif)
And to help make editing easier, content-assist is available for tags and attributes. The content-assist is also context-away, so it will not suggest illegal completion options to you based on the position of your cursor:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_source_contentassist.gif)
Alot of the functionality provided by the MyEclipse XML Editor is dependent on your document correctly referencing a DTD or Schema such that the editing tools can verify your work and provide content-assist against a specification. If you are editing a plain XML file that provides no DTD or Schema, the editor will still provide syntax highlighting and basic best-guess content-assist for you as well as basic validation (like unclosed tags) but some of the more advanced features for your editing won't be available.
4. Preferences
The XML editor preferences can control everything from how the syntax highlighting looks (e.g. color of tags and attributes), to how the page formats when the formatter is run.
All of these preferences can be accessed from Window > Preferences > MyEclipse > Files and Editors > XML:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/editor_preferences.gif)
Another feature of the XML editor that many developers may be interested in making use of is the template support. Templates are a way to assign a short keyword to a body of text that can be inserted directly into a file that is being edited along with some basic variable replacement (like timestamps, usernames, etc.). That functionality can be accessed from the XML Templates sub-preference here:
![](http://127.0.0.1:56606/help/topic/com.genuitec.myeclipse.doc/html/quickstarts/xmleditor/images/xml_templates.gif)
5. Resources
This section provides some links to resources used during this guide.
- web.xml - Example XML file used for the XML editing portion of this document.
6. User Feedback
If you have comments or suggestions regarding this document please submit them to the MyEclipse Documentation Forum.- MyEclipse XML Editor Tutorial
- 设置MyEclipse中XML Editor的DTD分析方式
- XML Editor
- MyEclipse 8.6 properties editor
- MyEclipse Struts Config Editor打开struts-config.xml时错误的解决方法
- myEclipse 打开struts-config.xml无法打开报错!--Error opening the editor
- struts-project.xml无法用MyEclipse JSP Editor打开,报错原因
- MyEclipse ICEfaces Tutorial备忘
- myeclipse Properties Editor 配色路径
- VTD-XML Tutorial (0)
- myEclipse 打不开struts-config.xml 报Could not open the editor: An unexpected exception was thrown 错误(转载)
- myEclipse 打不开struts-config.xml 报Could not open the editor: An unexpected exception was thrown 错误(转载)
- myeclipse不能使用默认编辑器打开导入的struts项目的struts-config.xml,Therefore the MyEclipse Struts Editor may not be u
- eclipse xml editor plugin安装
- Free XML Editor from Microsoft
- 一款实用的 xml editor
- Linux vi and vim editor: Tutorial and advanced features
- myeclipse启动HQL Editor出错问题解决
- VC2008 mfc90ud.dll无法找到问题如何解决
- Eclipse——User Interface Guidelines
- 在桌面应用中使用JAVA DB
- 对数据仓库进行数据建模
- 61条面向对象设计的经验原则
- MyEclipse XML Editor Tutorial
- MAX 材质学习_有关反射,折射及光线跟踪
- 保护您的 J2ME/MIDP 应用程序
- Oracle 10g 完整卸载手顺
- NetBeans 6.0 CLDC/MIDP 开发快速入门指南
- J2EE实践第一部分-创建一个简单的JSF Web程序(简单网页计算器)
- 10分钟内创建一个 Ruby 博客程序
- 使用 NetBeans Enterprise Pack 在 BPEL 模块项目中进行重构
- 设计模式——葵花宝典