[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Defining an XML Schema using multiple namespaces?
> I am having trouble spotting documentation for the XSD > question below, can anyone point me to the right part of the > specs or example schemas? It's scattered all over the specs, rather than being in once place. You need one schema document per namespace. Any schema document that references components (for example elements, types, or attributes) defined in a different namespace must do an xs:import for that namespace, and the references must be written as QNames. For example you can do <xs:element name="invoice"> <xs:complexType> <xs:sequence> <xs:element ref="a:address"/> to reference element "address" defined in another namespace. The schema containing the declaration of invoice will then (a) contain a namespace declaration xmlns:a="the-a-namespace-uri", and (b) contain an xs:import for targetNamespace="the-a-namespace-uri". Michael Kay http://www.saxonica.com/ > > The issue: > Suppose I have two XML namespaces, one defining core concepts > such as 'Address' and the other one defining things more at a > business level, for example 'PurchaseOrder'. Both are just > namespaces, defining the concepts not schemas defining any > content models. > > Using concepts from those two namespaces, I now want to > assemble an XML schema to express content models for the > concepts in the namespaces (and I also want to mix in xlink > attributes). > > For example, I might want to say that a bo:Person must have a > core:Address child and that it must have a bo:Parent child > that must have an xlink:href attribute. > > I there a way to do this (especially using element names from > different namespaces)? > > > (AFAIK the xlink attributes would be done with allowing any > attribute from xlink, is that correct? Can one be more > constraining here?) > > > Many thanks in advance! > > Jan > > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org > <http://www.xml.org>, an initiative of OASIS > <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://www.oasis-open.org/mlmanage/index.php> >
|
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
|