Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

CHAPTER 3 VALIDATION Namespaces You now know

Filed under: PHP and XML — webmaster @ 17:46

CHAPTER 3 VALIDATION Namespaces You now know how to combine schemas into a single schema. One thing I haven t addressed, however, is what happens if the same globally named definition or declaration appears in multiple schemas. During the development of XML Schemas, this limitation in DTDs was addressed by namespaces. XML Schemas support namespaces that can get around this problem. This section will show how to use namespaces in schemas and will introduce some new attributes in the process. Listing 3-32 shows the schemas for the course data. If you were in charge of managing the course data and its schema, you may want to ensure that your schema, if combined into another schema, remains intact and that your declarations and definitions never conflict with other schemas. Listing 3-35 is a modified version of the course schema in that it introduces namespaces into the schema. The local complex type definition for the course element has also been broken out and defined as a named type in the global scope. Listing 3-35. Namespaced Course Schema course.xsd Notice the new schema element. Three new attributes have been added as well as a new namespace declaration. Unqualified Locals The value of the targetNamespaceattribute indicates the namespace in which the global declarations and definitions reside. In this case, the courseTypedefinition and the courseelement declaration reside in the http://www.example.com/Coursenamespace. A name- space declaration was also added to associate the prefix cs with this namespace. This prefix within the schema indicates the specific data type or declaration to use. You may not have realized this, but you have been working with namespaced data types all along. Every time you have used one of the built-in data types, they have been prefixed with xsd. According to

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap 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