MirlvsMaximvs
MirlvsMaximvs

Reputation: 1483

Generate XSD schema from xml file in visual studio in just only one file

I've been trying generate xsd schema from xml file in order to obtaining the classes (applying the xsd tool). In visual studio with my xml open: main menu -> Xml -> Generate Schema and visual studio generates the schema in several files: One main file referencing the other ones. After that I have to copy the others files content into the main file to apply the xsd tool and generate the classes I want.

My question is, it would be possible generate all in just only one file?

Upvotes: 0

Views: 5408

Answers (2)

Yair Nevet
Yair Nevet

Reputation: 13013

Each namespace in your XML file is considered as a separate schema (XSD).

Consider consolidate your namespaces into one so you could enjoy 1 file generation.

In addition, as a good reference, look at this related good answer: xsd.exe generates two files, how to join them into one?

Upvotes: 1

philicomus
philicomus

Reputation: 133

Can you change the xml file so all types are in the same namespace, thereby forcing xsd to create a single-file schema? See Why does XSD.EXE Create Two .XSD Files, and How to Use Them?

Upvotes: 1

Related Questions