I have a complexType that\'s defined across two .XSD files.
Parent.xsd:
If you want the first embedded
to be in the urn:Embedded
namespace along with the second embedded
, you can move it there via xs:element/@ref
:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:Parent"
xmlns:emb="urn:Embedded"
targetNamespace="urn:Parent"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="urn:Embedded" schemaLocation="Embedded.xsd"/>
<xs:element name="ParentType">
<xs:complexType>
<xs:sequence>
<xs:element ref="emb:embedded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:emb="urn:Embedded"
targetNamespace="urn:Embedded"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="embedded" type="emb:EmbeddedType"/>
<xs:complexType name="EmbeddedType">
<xs:sequence>
<xs:element name="numeric" type="xs:int"/>
<xs:element name="embedded" type="emb:EmbeddedType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<ParentType xmlns="urn:Parent"
xmlns:emb="urn:Embedded"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:Parent Parent.xsd">
<emb:embedded>
<emb:numeric>12</emb:numeric>
<emb:embedded>
<emb:numeric>5</emb:numeric>
</emb:embedded>
</emb:embedded>
</ParentType>