generating xml from schema

Having trouble installing Oxygen? Got a bug to report? Post it all here.
susans
Posts: 4
Joined: Wed Jul 05, 2017 12:59 pm

generating xml from schema

Post by susans »

I am new to oxygen and xml. I have 2 schemas in the same folder. One I was able to generate an xml for. But the second schema gives me the following error in the xml when I try to generate an xml from tools>generate sample xml content
Attribute "xmlns" bound to namespace "http://www.w3.org/2000/xmlns/" was already specified for element "group". It doesn't matter what I specify I get an error. I also got an error for element / complexContent etc


The code at the beginning of my schema is below - Please advise - thanks
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:group name="article">
<xs:sequence>
<xs:element name="article-area">
<xs:complexType>
<xs:choice>
<xs:element name="concepts"/>
<xs:element name="constants"/>
<xs:element name="seasons"/>
<xs:element name="passages"/>
</xs:choice>
</xs:complexType>
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: generating xml from schema

Post by Costin »

Hi Susan,

I've already replied to your email regarding this on the official support email.
However, I am posting my reply also here, in case there are other users who might need this information.
- We analyzed the sample XSD you provided and it seems that your schema does not have any global element defined in it and implicitly there is no element which could be set as root. It consists only of groups (<xs:group/>), but no global elements.
Indeed, the base (root) group in the schema is "article", but, in order to generate an XML instance out of the XML schema, you still need to define at least one element.
For example, you could refer the "article" group in a global element (like in the below example), which in turn would be referred as the root element in the "Schema" tab of the Generate Sample XML Files dialog.

Code: Select all

<xs:element name="root">
<xs:complexType>
<xs:group ref="article"></xs:group>
</xs:complexType>
</xs:element>
In case you still encounter an error with the other schema, in order to see what triggers it, please send us a screenshot depicting the error and even a sample file (you can send it on our support email) for which you encounter the issue.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Post Reply