The order of the elements is important for the Jenkins UI presentation.
ChoiceFirst -> Name -> Address -> ChoiceEnd
However currently xmltodict would merge the same child elements in to a dict, and mess up the order:
ChoiceFirst -> ChoiceEnd -> Name -> Address, even with force_list=('parameterDefinitions')
So I am adding a parameter force_seperate_dict and will allow users to force the elements of "ChoiceParameterDefinition" to become individual dict by specifying force_seperate_dict=('ChoiceParameterDefinition') to keep the order.
I am using xmltodict to parse the
config.xml
of my Jenkins project settings.The parameters section is with repetitive elements:
The order of the elements is important for the Jenkins UI presentation.
ChoiceFirst -> Name -> Address -> ChoiceEnd
However currently xmltodict would merge the same child elements in to a dict, and mess up the order:
ChoiceFirst -> ChoiceEnd -> Name -> Address
, even withforce_list=('parameterDefinitions')
So I am adding a parameter
force_seperate_dict
and will allow users to force the elements of "ChoiceParameterDefinition" to become individual dict by specifyingforce_seperate_dict=('ChoiceParameterDefinition')
to keep the order.Two tests are added for this and also refactor the
_should_force_list
function to avoid duplication.