|
||||||||||||||
Outline |
||||||||||||||
1. PrefaceThis 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. IntroductionThis document will cover some of the functionalities available in the MyEclipse XML Schema (XSD) Editor. The MyEclipse XML Schema (XSD) editor includes advanced XSD editing functionalities like:
|
||||||||||||||
3. XML Schema EditingEditing XML Schema files can be a bit different than editing standard XML files because Schemas are used to define a structure of an XML Document; like a grammar. Because of this XML Schemas not only have an XML-like structure to them but include grammatical notations like "1 or more occurances of tag X". XML Schemas can also define many different types of nodes and then ultimately a document structure that says how those nodes are related to each other.
Let's take a look at the
Design Mode for XML Schema editing first.
|
||||||||||||||
3.1 XML Schema Design ModeWhen opening an XML Schema in Design Mode you will likely see the visual layout of your file something similar to this:
Looking at the layout above you can see your XML Schema laid out for you in a visual overview. Across the top you have the namespace that your schema is defined in. Your Directives are like Java Imports, they are external references that the XML Schema is making use of. Below that you have the Types that make up your XML Schema and to the left of the Types are the Elements. These are the structural definition of the document laying out the Types into a tree along with rules stating multiplicity, ordering and so on. On the right hand side of the screen you should see the Outline and Properties views for the file as well, that look something like this:
The Outline view shows you the same information you saw in the overview, but as you navigate through the overview, in and out of types and elements the Outline view will always give you a reference point of where you are. You can also edit the XSD from the Outline view, very similar to how it was done during the XML Editing section above.
As you make selections of
Elements and
Types in the
Outline view the
Properties view will update, showing you the properties
for the node you have selected. You can change the values
directly from the
Properties view, overview or context menus. Giving you
plenty of ways to work with your XML Schemas.
Double-clicking on an Element can jump you immediately into a view that is specific to that element like below:
After double clicking you will be shown that element displayed by itself and how it is defined:
From this view we can see that the
web-app element was defined as type
web-appType. So we see here a structural overview of the
web-app element. Given the first grouping multiplicity
on the far left, we see we can have 0 or more of the sequence
starting with
distributable and ending with
security-role.
Of course each of those allowable children can have their own multiplicity specified as well. That way the top level group specifies an ordering for the child elements, but the individual multiplicity on the children allows authors to specify 0 or more of the same tag one after the other (e.g. like multiple servlet tags in a web.xml file). You can also edit the content of the schema from this view by right-clicking on any portion of the overview and being presented with a context menu:
Editing in this fashion can also be done from the Outline view, very similar to the XML Editor above. In the following example screenshot we are showing how to edit the grouping of a type directly from the Outline view (you can do the same from the overview if you prefer):
Lastly, as you begin using the XML Schema editor you may notice that the overview for Types looks different than the overview for Elements, something like this:
The difference is that the Type overview shows a break-out of the types for each field. Each of these types that define the fields of this type are themselves other types defined in the XSD. As an example, an XSD might define 3 types:
Now let's say the XSD also defines the type Person that uses all these sub-types:
That is similar to what you are seeing in the layout above. You
are simply seeing a breakout of the sub-types that make up the
type you are looking at. You can drill further down into the
sub-types if you want to determine more information about the XML
Schema.
|
||||||||||||||
3.2
XML Schema Source Mode
|
||||||||||||||
4. PreferencesThe 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:
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:
|
||||||||||||||
5. ResourcesThis section provides some links to resources used during this guide.
|
||||||||||||||
6. User FeedbackIf you have comments or suggestions regarding this document please submit them to the MyEclipse Documentation Forum. |