Please enable JavaScript to view this site.

Altova SchemaAgent 2020

In our tutorial example, the schema book_store.xsd has a different namespace from the schema library.xsd. Therefore, to use elements from book_store.xsd in library.xsd, these elements must be imported. In this section, you will learn how to import a type that stores information about books from book_store.xsd to library.xsd.

spy_schema-overview-library

Notice that the schema contains an import statement, which was automatically added when you connected the two schemas in the Import section discussed previously. Also note that the namespace is specified in the ns field of the import statement. In this section, you will use a type from the imported schema in the importing schema.

 

 

To make the component book into a global complex type:

1.Open the book_store.xsd schema in XMLSpy.

2.In XMLSpy, click the Display Diagram ic_component icon for the element book_store to display its content model.

3.Click the "+" icon to expand the bookInfo element.

book_store_content_model3

4.Right-click the book element and select Make Global | Complex type from the context menu.

5.Save the file.

 

 

To import bookType to library.xsd:

1.Open the library.xsd schema in XMLSpy.

2.In XMLSpy, click the Display Diagram ic_component icon for the element library to show its content model.

library_content_model

3.Click the "+" icon to expand the bookInfo element.

library_content_model2

4.Right-click the sequence icon after the bookInfo element and select Add child | Element from the context menu.

5.Enter "bookDetails" as the name for the element.

6.With this element still selected, in the Details entry helper, select ns2:bookType from the type drop-down list. Components from both schemas are in black, all others are in blue.

spy_details_bookDetail

7.Save and close all files that are currently open in XMLSpy. You have now imported a type from the schema book_store.xsd to the schema library.xsd.

library_content_model4

© 2019 Altova GmbH