473,379 Members | 1,252 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,379 software developers and data experts.

xsd.exe generated classnames?

Is there a way to control generated classnames when generating classes from
an XSD using xsd.exe? When generating typed datasets it's possible to
provide some direction via the "codegen" namespace by adding attributes to
the XSD itself. These same attributes don't seem to work for class
generation however (unless I just did it wrong?)

Anway, is there a way for me to specify the classname(s) to be used in the
generated code?

Thanks in advance,
Bill

Nov 12 '05 #1
5 3999
Hi Bill,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to specify the
class name when generating class using xsd.exe. If there is any
misunderstanding, please feel free to let me know.

As far as I know, when generating a class using xsd.exe, we can specify the
name of top element to modify the class name. The following is a schema
that produces a class named pubs. Change the name attribute in the top
element will change the class name. <xs:element name="pubs">

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XSDSchema1.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XSDSchema1.xsd"
xmlns:mstns="http://tempuri.org/XSDSchema1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="pubs">
<xs:complexType>
<xs:sequence>
<xs:element name="publishers" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
As I understand, you are suggesting that the way to change the (generated)
class name is to change the element name. My situation is that I cannot
change the element name, but would like to use a classname of my own
choosing. As I mentioned I can do this when generating a type *dataset* via
use of the codegen namespace attributes; however this approach seems not to
work when generating a class rather than a namespace.

So, is there a way to "override" the name generated for an element (or
attribute) when generating a class without actually modifying the
element/attribute name in the schema?

Thanks for the response.

Bill

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:5m*************@TK2MSFTNGXA01.phx.gbl...
Hi Bill,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to specify the
class name when generating class using xsd.exe. If there is any
misunderstanding, please feel free to let me know.

As far as I know, when generating a class using xsd.exe, we can specify the name of top element to modify the class name. The following is a schema
that produces a class named pubs. Change the name attribute in the top
element will change the class name. <xs:element name="pubs">

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XSDSchema1.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XSDSchema1.xsd"
xmlns:mstns="http://tempuri.org/XSDSchema1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="pubs">
<xs:complexType>
<xs:sequence>
<xs:element name="publishers" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Hi Bill,

As far as I know, we cannot achieve this without modifying the element. If
we cannot modify the element, we have to provide an argument in the
xsd.exe. However, xsd.exe doesn't have such argument to specify the class
name. So I don't think we can do this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
Kevin
Thank you . That answers my question.

Bill
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:ff**************@TK2MSFTNGXA01.phx.gbl...
Hi Bill,

As far as I know, we cannot achieve this without modifying the element. If
we cannot modify the element, we have to provide an argument in the
xsd.exe. However, xsd.exe doesn't have such argument to specify the class
name. So I don't think we can do this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #5
You're welcome, Bill.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #6

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

Similar topics

4
by: Irmen de Jong | last post by:
Hello, I don't understand why the following doesn't work. What I want to do is dynamically import some generated Python code and I'm doing this using compile and exec'ing it in the dict of a new...
3
by: Headless | last post by:
Should linking generated content work? Example: span:before{content:"foobar"} <a href="foobar.htm"><span></span></a> I stumbled across this bit in the CSS2 spec: >Generated content does...
6
by: Dave | last post by:
Hello all, Consider this function template definition: template<typename T> void foo(T) {} If foo is never called, this template will never be instantiated. Now consider this explicit...
0
by: Bill Cohagan | last post by:
Is there a way to control generated classnames when generating classes from an XSD using xsd.exe? When generating typed datasets it's possible to provide some direction via the "codegen" namespace...
1
by: Robert Stearns | last post by:
I have two related questions. Why did I have to: SET INTEGRITY FOR is3.animals OFF; before doing: alter table is3.animals add column pseudo_id generated always as (coalesce(regnum,...
2
by: msnews.microsoft.com | last post by:
AOA I am using httpwebrequst and httwebresponse classes in order to execute an html page. The html generaed is then emailed. My problem is that I am calling the GenerateHtmlText() method which is...
1
by: Peter McEvoy | last post by:
Hi all, another question related to Schema and WSDL... I'd like to have a bit more control over the WSDL that is generated for my ..asmx. In particular, I'd like to override the generated WSDL...
17
by: Darek | last post by:
Hi, I have a table, something similar to: create table my_table ( id char(32) not null primary key, num integer not null, code varchar(2) not null, name varchar(60) not null,
4
by: Fabio | last post by:
An ASP.NET 2.0 web site contains a web form and a web service. The web form consumes the web service. There is a Book class in the App_Code folder. The web service exposes a method that returns a...
14
by: Jeff | last post by:
Let's say we have this: <div class="some_class some_other_class"> Is it possible to change *one* of the classnames. Jeff
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.