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

parsing choice sequence loses element ordering #29

Open
martaver opened this issue Nov 26, 2019 · 2 comments
Open

parsing choice sequence loses element ordering #29

martaver opened this issue Nov 26, 2019 · 2 comments

Comments

@martaver
Copy link

Trying to parse an XML file with a schema that contains a choice sequence:

      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="Title" type="xs:string" />
        <xs:element name="Subtitle" type="xs:string" />
        <xs:element name="Html" type="xs:string" />
        <xs:element name="Vimeo" type="VimeoPart" />
        <xs:element name="Youtube" type="YoutubePart" />
        <xs:element name="Soundcloud" type="SoundcloudPart" />
        <xs:element name="Image" type="ImagePart" />
        <xs:element name="Link" type="LinkPart" />
      </xs:choice>

The above generates the following in a type:

        Html: string[];
	Image: ImagePart[];
	Link: LinkPart[];
	Soundcloud: SoundcloudPart[];
	Subtitle: string[];
	Title: string[];
	Vimeo: VimeoPart[];
	Youtube: YoutubePart[];

However, this structure loses the ordering of the elements. In my case, order is important because it contains site content.

I would have expected the following types, perhaps:

choices: (Html | Image | Link | Soundcloud | Subtitle | Title | Vimeo | Youtube)[]
@FranklinChen
Copy link

Unfortunately, I noticed this severe limitation several months ago when looking for a data binding tool for TypeScript. I never did find a suitable one comparable to, say, Java JAXB. Also, I think this project has been abandoned. There was mention of a rewrite of cxml but I never heard back about its status: charto/cxml#15

@martaver
Copy link
Author

martaver commented Nov 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants