[Developers must read] MyEclipse XML Schema (XSD) editor advanced features introduction

MyEclipse v2023.1.2 offline version download

MyEclipse technical exchange group: 742336981 Welcome to join the group discussion

1. XSD editing in MyEclipse

This document describes some of the features available in the MyEclipse XML Schema (XSD) editor, which includes advanced XSD editing such as:

  • Visual overview representation of schema elements and types
  • Visual editing of schema
  • syntax highlighting
  • Tag and Attribute Content Assist
  • Live validation (as you type)
  • Source view, Design view, and Outline view of document content
  • document format
  • Content Assist Template
2. Edit mode

Editing an XML Schema file may be slightly different than editing a standard XML file, because schemas are used to define the structure of an XML document. So an XML schema not only has an XML-like structure, but also includes syntactic symbols such as "token X occurs 1 or more times". XML Schema can also define many types of nodes, and then ultimately define a document structure that shows how these nodes are related to each other.

2.1 Design Patterns

When XML mode is turned on in design mode, you'll see a visual layout of the file similar to the following:

XSD Design Patterns

Looking at the layout above, you can see the layout of the XML schema in a visual overview. At the top you can see the namespace where the schema is defined, directives are like imports for Java, they are external references that the XML schema is using. Below it you can see the types that make up the XML Schema, to the left of the types are the elements, these items define the structure of the document, laying out the types into a tree along with rules that account for multiplicity, ordering, etc.

On the right side of the screen are the Outline and Properties views of the file.

Outline and Properties view

The Outline view shows the same information you see in the schema overview, but provides a point of reference when navigating through the overview. You can also edit the XSD from the Outline view in a similar way to what you did in the XML editing section above.

As you select elements and types in the Outline view, the Properties view updates to show the properties of the selected node. You can change these values ​​directly from the Properties view, from the overview, or using the right-click context menu, providing many ways to work with XML Schema.

Double-clicking an element opens a view specific to that element.

double click on an element

After double-clicking, the element itself and its definition are displayed.

Web-app element view

From this view, you can see that the web-app element is defined as type web-appType, see here an overview of the structure of the web-app element. Given the first leftmost group multiplicity, you can see that there can be 0 or more sequences, starting with distributable and ending with security-role.

Of course each allowed sub-element can also specify their own multiplicity, such that the top-level group specifies the order for the sub-elements, but a single multiplicity on sub-elements allows the author to specify 0 or more of the same tag one after the other ( For example, like multiple servlet tags in a web.xml file).

You can also edit the schema content in this view by right-clicking any part of the overview.

Right-clicking the overview allows you to edit

Editing in this way can also be done from the Outline view, the example below demonstrates how to use the Outline view to edit a group of types (you can also do the same from the overview if you prefer).

Edit using outline view

Finally, when starting to use the XML Schema editor, you may notice that the overview of types is different from the overview of elements.

Type overview

The difference is that the Type overview shows the type breakdown for each field, each type defining the type field you're looking at is a different type defined in the XSD. For example, an XSD can define three types:

  • id, integer
  • name, string
  • dob, datetime

Now, suppose the XSD also defines a Person type that uses all these subtypes:

  • Person
  • social-security (type: id)
  • full-name (type: name)
  • birth-date (type: dob)

This is similar to what you saw in the layout above, where you can see the explosion of subtypes that make up the type being viewed.

2.2 Source Mode

Editing an XML schema is the same as editing an XML document.

3. Parameters

XML editor parameters can control everything from the appearance of syntax highlighting (for example, the color of tags and attributes), to the formatting of the page when the formatter is run.

By selecting Window>Preferences from the menu, expand MyEclipse>Files and Editors, and select XML.

XML editor parameters

Another feature of XML editors that many developers may wish to use is template support. Templates are a way of assigning short keywords to bodies of text that can be inserted directly into the file being edited, with some For basic variable substitution (such as timestamp, username, etc.), templates can be accessed from the XML Templates subparameter item.

XML template parameters

Guess you like

Origin blog.csdn.net/AABBbaby/article/details/132596451