Hi,
I have two XSDs both in seperate namespaces, Child is an extension of
the abstract Base:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Base" targetNamespace="http://tempuri.org/Base.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/Base.xsd"
xmlns:mstns="http://tempuri.org/Base.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="complexType1" abstract="true">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="complexType1" type="complexType1" />
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Child" targetNamespace="http://tempuri.org/Child.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/Child.xsd"
xmlns:mstns="http://tempuri.org/Child.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="../../XSD/test/Base.xsd"
namespace="http://tempuri.org/Base.xsd" />
<xs:complexType name="complexType2">
<xs:complexContent mixed="false">
<xs:extension xmlns:q1="http://tempuri.org/Base.xsd"
base="q1:complexType1">
<xs:sequence>
<xs:element name="Address" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="complexType2" type="complexType2" />
</xs:schema>
No problem. But, when I generate C# code for the Child using the
XmlCodeExporter it includes the code for the Base, how do I stop this,
I simply want the code for the Child and nothing else?
Example output:
namespace Child {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XS DToCode",
"1.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/Child.xsd")]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="http://tempuri.org/Child.xsd",
IsNullable=false)]
public partial class complexType2 : complexType1 {
private string addressField;
/// <remarks/>
public string Address {
get {
return this.addressField;
}
set {
this.addressField = value;
}
}
}
/// <remarks/>
// DONT WANT THIS CLASS
[System.Xml.Serialization.XmlIncludeAttribute(typeo f(complexType2))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("XS DToCode",
"1.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/Base.xsd")]
public abstract partial class complexType1 {
private string nameField;
/// <remarks/>
public string Name {
get {
return this.nameField;
}
set {
this.nameField = value;
}
}
}
}
Many thanks for any help, I have been stuck on this for 2 days!