473,320 Members | 1,572 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.

Classes generated by XSD.EXE

I have an XML schema for JobPositionPosting (from www.hr-xml.org). If I give
this to XSD.EXE as input and tell it to generate classes, I get a 1500-line
..cs file containing approximately 70 class definitions. These correspond to
the nodes in the tree defined by the schema. The actual data elements are
fields in the classes.

The data source to be used for creating objects is a legacy RDBMS (not
SQLServer), with no XML support. So basically I execute a SELECT statement
and get back a table/dataset with fields that need to be mapped to the nodes
in the tree defined by the schema.

This is easy to do "by hand" for trivial cases, the kind used as examples in
books. For this real-world case I would like to have some kind of algorithm
for matching the table fields to the class fields. But I'm having trouble
finding one, or a tool for generating one. I'd appreciate any pointer to
examples or tools.

Mike Carroll
Sigma Data Systems, Inc.
Nov 12 '05 #1
2 5640
70 class definitions are bad for you? :) j/k.
Not sure what you're trying to accomplish. I am getting my feet wet in XSD
and automatic class an DS generation myself.

If you just want to get back an XML from you legacy DB, just use the /d
option to get a typed DS class instead of an object class. This worked for
me. Also if you have a problem with 70 class definitions being in one file,
use /e option to get just one of them, though it will create one class for
each referenced complex types and I haven't figured out whether you can
suppress that or not.

Excellenet tutorial here: http://www.topxml.com/schema/default.asp

Have fun.
Jiho

"Mike Carroll" <mc******@gosigma.com> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
I have an XML schema for JobPositionPosting (from www.hr-xml.org). If I give this to XSD.EXE as input and tell it to generate classes, I get a 1500-line .cs file containing approximately 70 class definitions. These correspond to the nodes in the tree defined by the schema. The actual data elements are
fields in the classes.

The data source to be used for creating objects is a legacy RDBMS (not
SQLServer), with no XML support. So basically I execute a SELECT statement
and get back a table/dataset with fields that need to be mapped to the nodes in the tree defined by the schema.

This is easy to do "by hand" for trivial cases, the kind used as examples in books. For this real-world case I would like to have some kind of algorithm for matching the table fields to the class fields. But I'm having trouble
finding one, or a tool for generating one. I'd appreciate any pointer to
examples or tools.

Mike Carroll
Sigma Data Systems, Inc.

Nov 12 '05 #2
If I'm reading you right, you need to get the data from the database to look like the schema doc to load into the typed data set.

If so, you might want to try a xsl transform. With 70 classes creating the xsl file won't be fun, but once you have it, it is easy to use.

Get as much xml out of the database as you can. When using oracle, I just concatenate the data together so each row returns a valid string representation of an element. Run through the record sets building basic xml representation of the data using something like StringBuilder. Load the string into a XmlDocument.

Transform the xml document with your xsl file to get the new xml document. Load that into the typed dataset.

If the xml document you are creating is pretty large, I would not use the .NET XslTransform class. It is really slow. Use MSXML2 directly. and for really large record sets, this might not be the best way to go.
Nov 12 '05 #3

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

Similar topics

0
by: vanGogh | last post by:
I have generated classes based on an Xml schema file (xsd) using the XSD.exe tool. My goal is to: - write an application that can parse XML documents - fill objects (based on the generated...
2
by: Peter Bates | last post by:
Hi, I'm just getting used to XSDObjectGen and i have the following question. Can i use a class inherited from a class generated by XSDObjectGen with XmlSerialize? Specifically, I have many...
1
by: Axel Dahmen | last post by:
I'd like to generate C# classes from an XML Schema file. All the generated classes should provide a basic member function framework like Save() and a basic member element like Dirty. Moreover, I'd...
5
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices...
2
by: farseer | last post by:
Hi, First, sorry for this long post, but i'd like to explain my problem in detail... i have generated some classes from my schema. Classes are generated for the root (overall document),...
3
by: MIGUEL | last post by:
Hi all, I'm quite lost with how adding web references to a project creates proxy classes. I've developed a web service with two classes inside and that contains three references to three...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
4
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
4
by: bob_jenkins | last post by:
C# allows code to be generated, but the generated code is in its own assembly. Is there a way for that generated code to access internal classes in the assembly that produced it? To have the...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.