Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

Adding include elements

If your schemas are large, you might choose to divide their content among several schema documents to make them easier to maintain, reuse, and read. You can use the include element to bring in definitions and declarations from the included schema into the current schema. The included schema must be in the same target namespace as the including schema.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To add an include element, complete the following steps:

  1. Open your XML schema in the XML schema editor.
  2. In the Design view, right-click in the Directives section and click Add Include.
  3. In the Select XML schema file wizard, you can include an XML schema that is located in your workspace or you can include a schema from an HTTP Web address. The XML schema file that you select must have the same namespace as the current schema.
    • If you want to include an XML schema located in your workspace:
      1. Select Workbench projects and click Next.
      2. Select the schema that you want to import and click Finish.
    • If you want to include an XML schema located at an HTTP Web address:
      1. Select HTTP and click Next.
      2. Type the URL of the XML schema and click Finish.
        Note: A local copy of the schema is not stored in your workspace. If you validate your schema, the schema's contents are checked from the URL that you specify.
  4. Optional: Use the Properties view to define additional properties for your import element.
    1. If you want to edit the location of the included XML schema file, click the General tab and type the new location display in the Schema location field.
    2. Click the Documentation tab if you want to provide any information about this include element. The Documentation page is used for human readable material, such as a description.
    3. Click the Extensions tab if you want to add application information elements to your annotations of schema components. The Extensions page allows you to specify the schema and add XML content to your annotations.

Once you have added the include element to your XML schema, when you define new elements, attributes, complex types, or simple types where you can specify type information, any declarations from the included schema will be available in the Type list for the element, attribute, complex or simple type.

For example, if Address.xsd has the following content:

<complexType name="Address">
    <sequence>
        <element name="name" type="string">
        <element name="street" type="string">
    </sequence>
</complexType>
and you have an XML schema called PurchaseOrder.xsd that has added an include for Address.xsd, then when defining a new element in PurchaseOrder, you can select Address as its type.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire