TaxDev
TaxDev

Reputation: 21

Generate Sample XML: Could not find any element declaration for a root element

I am trying to generate sample XML from an XSD. I am using Altova XMLSpy to generate schemas. When I go to "Generate Sample XML File" I receive an error saying

Could not find any element declaration for a root element.

The program has worked perfectly for all other XSD files I have tried. How can I get this file converted or another program I can use to generate this sample XML?

Upvotes: 1

Views: 2324

Answers (1)

kjhughes
kjhughes

Reputation: 111726

Without seeing your XSD, we might guess that it lacks any global element definitions. It could, for example, be a collection of xsd:simpleType and xsd:complexType definitions. If this is the case, you should still be able to create some sample XML if you can provide a root element:

  1. Decide the type of the root element of the XML you wish to generate.
  2. Create an xsd:element declaration of the desired type.
  3. Place the created xsd:element into the XSD directly, or place it in its own file and import or include the type definitions into the new XSD.

Providing the sample XSD (or preferably a minimum version of it that still exhibits the issue) would have allowed us to be more specific in answering your question.

Upvotes: 3

Related Questions