OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: XML Schemas: Best Practices

[ Lists Home | Date Index | Thread Index ]
  • From: "Arnold, Curt" <Curt.Arnold@hyprotech.com>
  • To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
  • Date: Fri, 22 Sep 2000 12:18:04 -0600

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.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS