How to create a xml schema from a C++ structure or class?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.xml.

Post a new message to this list...

Roberto Rocco
Hello,

I need to automatically create a xml schema from a C++ structure or class.
Is that possible? Do you know a tool?

Thanks a lot for your help.

Roberto.

Reply to this message...
 
    
Kirk Allen Evans
The utility "xsd.exe" comes with the .NET Framework. With it, you can
generate schemas for an existing .NET assembly. This assumes that you are
using the managed extensions for C++. If you have Visual Studio .NET, go to
the Visual Studio .NET command prompt and type "xsd.exe /?". Here is the
output.

C:\>xsd.exe /?
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.0.2914.16]
Copyright (C) Microsoft Corp. 1998-2001. All rights reserved.

xsd.exe -
Utility to generate schema or class files from given source.

xsd.exe <schema>.xsd /classes|dataset [/e:] [/l:] [/n:] [/o:] [/uri:]
xsd.exe <assembly>.dll|.exe [/outputdir:] [/type: [...]]
xsd.exe <instance>.xml [/outputdir:]
xsd.exe <schema>.xdr [/outputdir:]

- OPTIONS -

/classes
Generate classes for this schema. Short From is '/c'.

/dataset
Generate sub-classed DataSet for this schema. Short From is '/d'.

/element:<element>
Element from schema to process. Short From is '/e:'.

/language:<language>
The language to use for the generated code. Choose from 'CS',
'VB', 'JS' or provide a fully-qualified name for a class implementing
System.CodeDom.Compiler.CodeDomProvider. The default is 'CS' (CSharp).
Short form is '/l:'.

/namespace:<namespace>
The namespace for generated class files. The default namespace
is the global namespace. Short form is '/n:'.

/out:<directoryName>
The output directory to create files in. The default
is the current directory. Short form is '/o:'.

/type:<type>
Type from assembly to generate schema for. Multiple types may be
provided.
If no types are provided, then schemas for all types in an assembly
are generated. Short form is '/t:'.

/uri:<uri>
Uri of elements from schema to process. Short From is '/u:'.

- ARGUMENTS -
<schema>.xsd Name of a schema containing elements to import
<assembly>.dll|exe Name of an assembly containing types to generate schema
for.
<instance>.xml Name of an xml file to infer xsd schema from.
<schema>.xdr Name of an xdr schema to convert to xsd.
Multiple file arguments of the same type may be provided.

Kirk Allen Evans
http://www.vbdna.net

"Roberto Rocco" <Click here to reveal e-mail address> wrote in message
news:u4RoVBGSBHA.1568@tkmsftngp05...
[Original message clipped]

Reply to this message...
 
    
Roberto Rocco
Hello Kirk,

thanks a lot! I knew there was a tool! Unfortunately it doesn't take a plain
C++ class or structure as input, but I think I can convert that somehow to
make an assembly out of it.
(Keeping my fingers crossed!)

Thanks again,

Roberto.

"Kirk Allen Evans" <Click here to reveal e-mail address> wrote in message
news:eHa6zlmSBHA.1472@tkmsftngp05...
[Original message clipped]

Reply to this message...
 
    
Pascal H
I have more or less the invert situation.
I have an XML schema, and from there generate the CSharp code.
Everything works fine in the "Makefile" world. But as soon as I enter
the Visual Studio, I face a wall.

How can I ask visual studio to generate the csharp file from the xsd
file, and then compile this csharp file so it will be a module in an
assembly ? What type of project, post processing should I set ?

Any ideas ?

P.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
 
 
System.CodeDom.Compiler.CodeDomProvider
System.Data.DataSet




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com