|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XML Schemas: Best Practices
Namespaces should be explicit, at least, when each namespace is describes a different domain. For example, if I build a camera namespace and need to have hypertext embedded at certain locations, the best approach is to import the standard XHTML namespace and use qualified XHTML elements for example <xhtml:p> for paragraph. This allows existing XHTML processing code to work on the embedded XHTML. If a distinct, but semantically similar "Camera Hypertext Markup Language" was created, existing XHTML processing code would have to be modified to recognize <camera:p> as being identical in semantics to <xhtml:p>. The example you contrived has multiple namespaces that cover at closely related information, hence the impetus to unify these in the instance document vs in the schema. A much better design would be for the camera namespace to declare the framework for the document and individual vendor namespaces to be used for vendor-specific information. For example: <camera xmlns="http://www.example.com/camera"> <lens> <fubar:lens xmlns:fubar="http://www.fubar.com/camera" partNo="fb10204" inspector="#3454"/> <zoom>10x6</zoom> </lens> <body> <zeon:body xmlns:zeon="http://www.zeon.com/camera" material="titanium"/> <width>5</width> <height>7</height> </body> </camera> The camera namespace can be declare to allow elements from outside namespaces using the <xsd:any> particle or equiv classes could be used (for example, fubar:lens could be in the camera:vendorLens equiv class). ---------------- [Interestingly, for the video-game schema I don't see how to make geometry, lighting, and voice global. Any thoughts?] They are only global (and only accessible from other namespaces) if they appear at the top level in the imported schemas.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








