Modifying the Schema

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  XMLSpy Tutorial > XML Documents >

Modifying the Schema

Since two-digit phone extension numbers do not cover all likely numbers, let's extend the range of valid values to cover three-digit numbers. We therefore need to modify the XML Schema. You can open and modify the XML Schema without having to close your XML document.

 

Do the following:

 

1.Select the menu option DTD/Schema | Go to definition or click the Go To Definition icon ic_goto_def. The associated schema, in this case AddressLast.xsd is opened. Switch to Schema View (screenshot below) if you need to. (By default an XSD schema file will open in Schema View. The default view for every filetype, however, can be changed in the File Types section of the Options dialog (Tools | Options).)

tut_53c

2.In Schema Overview, click the Display Diagram icon ic_component of the global Person element. In the Content Model View of the Person element, select the PhoneExt element. The facet data in the Facets tab is displayed.

tut_54a

3.In the Facets tab, double-click the maxIncl value field, change the value 99 to 999, and confirm with Enter.

tut_54b

4.Save the schema document.
5.Press Ctrl+Tab to switch back to the XML document.
6.Click ic_validate to revalidate the XML document.

file_is_valid

A message that the file is valid appears in the Validation window. The XML document now conforms to the modified schema.

7.Select the menu option File | Save As... and save the file as CompanyLast.xml. (Remember to rename the original CompanyLast.xml file that is delivered with XMLSpy to something else, like CompanyLast_orig.xml).

 

Note:The CompanyLast.xml file delivered with XMLSpy is in the in the Tutorial folder.

 


© 2019 Altova GmbH