[FEATURE] XML attribute #67451
Replies: 3 comments
-
@Morozzko after you run this is the XML no longer valid? |
Beta Was this translation helpful? Give feedback.
-
@sagetherage , let me continue the thread - yes, the xml is no longer valid. For starters, it deletes the first line (the whole xml declaration) and secondly it adds namespaces to elements which prevents the .net framework from parsing this config. The possible reason would be that instead of actually just changing the attribute, xml module reads the whole file in the ElementTree and then re-writes the whole tree to the file. |
Beta Was this translation helpful? Give feedback.
-
Like @Darkformer said we rewire the XML file. We should add a flag that only sets the element and nothing else. This will help preserve visibility and avoid confusion in the future. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use this command:

salt '*' xml.set_attribute C:\\service.exe.config ".//connectionStrings//add[@name='DefaultConnection']" connectionString "Data Source=SEPVVDB-ER01;Initial Catalog=Pol_EX; Rewrite=true;"
You can see the document before and after this command, it changes structurally.
Are there any options for what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions