Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

CHAPTER 3 VALIDATION The complexTypedefinition, which was

Filed under: PHP and XML — webmaster @ 06:52

CHAPTER 3 VALIDATION The complexTypedefinition, which was defined in the local scope in Listing 3-30, has been given the name courseTypeand moved into the global scope in Listing 3-31. The attributes minOccurs and maxOccurshave also been added to the title declaration. These are not needed, as the values set are the default values already, but have been added to illustrate how to use the attributes when within a local scope on an xsd:elementand when not referencing a global element declaration. Definitions are not like declarations, because a definition becomes a data type within the schema and is used the same way as built-in data types. Notice the declaration for the courseelement in Listing 3-31. It now contains a typeattribute with a courseType value. When a course element is validated within a document, it will validate according to the definition of courseTypedefined in the global scope. Include Schemas can become quite large in size, which makes them difficult to read. Many different groups may also manage different sections of a schema. XML documents can contain aggregated data, such as one group handling data related to courses with another group handling data related to instructors. In a case like this, the group managing course data would want to control the sections of the schema pertaining to course data, and the other group would want to control the section pertaining to instructor data. Within a DTD, you would accomplish this with external subsets. You could combine the subsets to form a single DTD. One method of doing this with XML Schemas is by using the include element. You can use include elements to create a single schema from multiple schemas within a single namespace. You will use the import element when working across namespaces. You will learn more about namespaces in schemas and about using import in the next sections. For now let s look at the schemas in Listings 3-32, 3-33, and 3-34. The first two, Listings 3-32 and 3-33, are stand-alone schemas used to validate a courseelement and an instructor element. Suppose you need to create a document combining data and would like to reuse these existing schemas. Listing 3-34 illustrates a schema created from the course.xsd and instructor.xsd schemas.

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting