Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using complex type as type in more than one elements #27

Open
AsfaMehmood opened this issue Sep 29, 2022 · 2 comments
Open

Using complex type as type in more than one elements #27

AsfaMehmood opened this issue Sep 29, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@AsfaMehmood
Copy link

AsfaMehmood commented Sep 29, 2022

Hi Kiishor,

I have just started using your xml_code_generator as well as miniML parser in my project and I received compilation error in the *.c and *.h file generated by xml_code_generator.
When I assign same complex type to two elements, the tool generates same structures twice. Similarly, if I use 3 elements of same complextype, it generates 3 structures with same names for each of my elements.

To make it work: I had to remove extra definitions of same structure from both .c and .h files.
But I do not want to edit it every time I generate files from tool. Is there a solution to it?

I am attaching the generated files as well as my .xsd and .xml files.

RootElement.c.txt
RootElement.h.txt
Sample.xml.txt
Sample.xsd.txt

@kiishor kiishor added the bug Something isn't working label Oct 1, 2022
@kiishor kiishor self-assigned this Oct 1, 2022
@kiishor
Copy link
Owner

kiishor commented Oct 1, 2022

Hi AsfaMehmood,

Thanks for reporting this bug, I will fix this bug soon.

Regards,
Nandkishor

@kiishor
Copy link
Owner

kiishor commented Oct 2, 2022

Hi AsfaMehmood,

I have gone through your sample XML schema file and generated source files.
A quick solution is to slightly modify complexType "RootElementType" element, as shown in the below snippet.

<xs:complexType name="RootElementType">
  <xs:sequence>
    <xs:element name="Element" 	type = "ElementType" minOccurs="2" maxOccurs="2"/>
  </xs:sequence>
</xs:complexType>

Let me know if it solves your problem.

Regards,
Nandkishor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants