Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSD Namespace to C# Namespace

Tags:

namespaces

c#

We are looking for a way to have C# autogenerate classes from an XSD and create C# namespaces using the namespace info in the XSD.

Doesnt seem like you can create a structured (xxxx.yyyy.zzzz) C# namespace from the XSD?

Is there a trick we're missing?

Thanks

like image 352
Tony Avatar asked Dec 03 '09 21:12

Tony


People also ask

What is an XSD namespace?

Namespaces are a mechanism for breaking up your schemas. Up until now we have assumed that you only have a single schema file containing all your element definitions, but the XSD standard allows you to structure your XSD schemas by breaking them into multiple files.

How do you add a namespace in XSD?

So add targetNamespace="http://abcd.com" to your schema element. You want the children of that element (which are all declared as local to the anonymous complex type of the GetInboundResponseGetInboundSMS element) to be unqualified.

What is XSD C#?

XSD is a schema language; you use it to define the possible structure and contents of an XML format. A validating parser can then check whether an XML instance document conforms to an XSD schema or a set of schemas.

What is namespace and targetNamespace in XML?

targetNamespace defines the namespace for the XML document being defined-- which tags (elements) and which attributes can be used in the XML document being defined in "this" XSD. xmlns=http://www.w3schools.com/schema/schema_schema.asp.


1 Answers

Would this do the trick? the /n allows you to specify a namespace to put the generated class in.

xsd.exe /classes MyXSDInput.xsd /n:MyCsharpNamespace
like image 56
John Buchanan Avatar answered Oct 11 '22 21:10

John Buchanan