473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XSD Code Generation problem

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!

Sep 27 '06 #1
0 1495

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
8
by: Max M | last post by:
Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl?sid=03/09/04/1415210&mode=flat&tid=108&tid=126&tid=156 It is about automatic code generation. I got interrested...
0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
1
by: Gina | last post by:
I need to add the cell generation to a templated program. I am using graphics magician, but my problem is with the math. I cannot figure out my cell generations. I do know that I need two...
9
by: Henk Verhoeven | last post by:
We are not alone! "Where other MDA tools are generating programmingcode, Codeless chooses not to generate code at all". OK, phpPeanuts is not an MDA tool (it has no fancy modeling GUI). But it...
8
by: | last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems with the 2003 version, hoping this solves the problems, but now I encounter this wierd bug??? If I have the project, and...
19
by: felixnielsen | last post by:
Some might remember that i, not so long ago, started a treath or two about a weird 3d labyrinth. I now have a working code, that i want to share, hear comments, advice, ect., but first let me...
3
by: Chris288 | last post by:
Hi, I have a problem where our app when compiled in VS2005 runs about 50% the speed it attains in VS2003. This is an unmanaged C++ app. I have tried most combinations of the optimization and...
31
by: somenath | last post by:
Hi All, I was going through one of the exercise of one C tutorial . In that they have given one small code and asked about the output. #include <stdio.h> int main(void) { int x =...
31
by: eliben | last post by:
Hello, In a Python program I'm writing I need to dynamically generate functions and store them in a dict. eval() can't work for me because a function definition is a statement and not an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.