Therefore, the only solution to importing elements and attributes
with no namespace is to import a schema without any target namespace.
Let's say that we want to describe a document in
which the vocabulary to describe people has no namespace:
<?xml version="1.0"?>
<xs:schema targetNamespace="http://dyomedea.com/ns/library"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:lib="http://dyomedea.com/ns/library"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="very-simple-2-ns-ppl-nons.xsd"/>
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<xs:element name="book" type="lib:bookType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="authors">
<xs:complexType>
<xs:sequence>
<xs:element ref="person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
</xs:schema>
The included schema is:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person" type="personType"/>
<xs:complexType name="personType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
</xs:schema>
In this case, all the components are considered unqualified. All the
other behavior, including the difference between referencing elements
or attributes and using datatypes, is relevant.