# XML editor: order of attributes in code completion popup

**URL:** <https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363>\
**Category:** AlterNET Studio Support\
**Created:** [January 18, 2023, 10:03am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363 "2023-01-18T10:03:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wknauf](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/w/606060/32.png) [@wknauf](https://forum.alternetsoft.com/u/wknauf)\
**Post date:** [January 18, 2023, 10:03am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/1 "2023-01-18T10:03:22Z")

</div>

Hi,

this happens for our XSD based xml editor: just noticed that the attributes in the code completion popup are not sorted alphabetically. As far as I know, the order of attributes does not matter in XML. So, I suggest to sort them after parsing the XSD. Of course, I could also add code to do this when generating the XSD. But when using a predefined XSD file, this is not possible.

 ![attributes](https://forum.alternetsoft.com/uploads/default/original/1X/b01c1fbe79ba9987473f5935e45662666bf0b683.png)

Same could also apply to the “child elements” popup, but here I am not sure whether it could cause problems. As far as I know, you suggest only valid elements, so a child element list defined as “xsd:all” could be sorted alphabetically?

Best regards

Wolfgang

---

<div class="post-metadata">

**Author:** ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)\
**Post date:** [January 19, 2023, 12:05pm UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/2 "2023-01-19T12:05:40Z")

</div>

Hi Wolfgang,

Thank you for reporting this problem. We have reproduced this issue and will look at it shortly.

Kind regards,  
Dmitry

---

<div class="post-metadata">

**Author:** ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)\
**Post date:** [March 7, 2023, 5:13am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/3 "2023-03-07T05:13:44Z")

</div>

Hi Wolfgang,

We have just published a new version(8.1.10) to NuGet, where the issue with attribute sorting should be fixed.

Kind regards,  
Dmitry

---

<div class="post-metadata">

**Author:** ![wknauf](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/w/606060/32.png) [@wknauf](https://forum.alternetsoft.com/u/wknauf)\
**Post date:** [March 7, 2023, 2:27pm UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/4 "2023-03-07T14:27:43Z")

</div>

Great, many thanks! But I don’t have time to update our application, will do in the next few weeks.

Best regards  
Wolfgang

---

<div class="post-metadata">

**Author:** ![wknauf](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/w/606060/32.png) [@wknauf](https://forum.alternetsoft.com/u/wknauf)\
**Post date:** [April 13, 2023, 7:38am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/5 "2023-04-13T07:38:30Z")

</div>

I can confirm that the attribute sorting is working fine.

The elements are not sorted, but here I was not sure in my initial question whether this might cause problems.

Best regards

Wolfgang

---

<div class="post-metadata">

**Author:** ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)\
**Post date:** [April 23, 2023, 11:42am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/6 "2023-04-23T11:42:54Z")

</div>

Hi Wolfgang,

Thank you for confirming. I don’t think that elements must be sorted alphabetically. For example, sequence elements need to appear in the order defined by the schema.

Kind regards,  
Dmitry

---

<div class="post-metadata">

**Author:** ![wknauf](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/w/606060/32.png) [@wknauf](https://forum.alternetsoft.com/u/wknauf)\
**Post date:** [February 21, 2024, 4:35pm UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/7 "2024-02-21T16:35:17Z")

</div>

Just noticed that attribute values from an enumeration are not sorted, either. Would you consider it reasonable to sort them also alphabetically?

 ![attribute_value_order](https://forum.alternetsoft.com/uploads/default/original/1X/8d055277938a2a776d530abafd6a00e9bb15c4a1.png)

XSD snippet (I can send you the full XSD if necessary):

```auto
<simpleType name="FormatTerminXML_TerminFeld">
	<restriction base="string">
		<enumeration value="Leer"/> 
		<enumeration value="Other"/> 
		<enumeration value="Von"/> 
		<enumeration value="Bis"/> 
		<enumeration value="VonBis"/> 
		<enumeration value="VonBisPub"/> 
		<enumeration value="VonPub"/> 
		<enumeration value="BisPub"/> 
		...
	</restriction>
</simpleType>

```

Best regards

Wolfgang

---

<div class="post-metadata">

**Author:** ![wknauf](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/w/606060/32.png) [@wknauf](https://forum.alternetsoft.com/u/wknauf)\
**Post date:** [February 22, 2024, 7:06am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/8 "2024-02-22T07:06:54Z")

</div>

Not sure about my suggestion - the author of the XSD could have had an intention when specifying the order of the enum values.  
And I can easily sort the values myself when generating the XSD, so forget about my question 😉

Best regards

Wolfgang

---

<div class="post-metadata">

**Author:** ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)\
**Post date:** [February 24, 2024, 12:08am UTC](https://forum.alternetsoft.com/t/xml-editor-order-of-attributes-in-code-completion-popup/363/9 "2024-02-24T00:08:23Z")

</div>

Hi Wolfgang,

I’ve checked in Visual Studio; it does not seem to sort enum values either.

 ![image](https://forum.alternetsoft.com/uploads/default/original/1X/33add079581215a010f7da6f29b9a03ed89324a4.png)

I guess you’re right here that the schema should define the order of enum values.

Kind regards,  
Dmitry
