Xml is formatted incorrectly
Issue Type: Bug
select from a table with xml field data saved like
<PersonName><FormattedName>Alfred Jefferson</FormattedName><GivenName>Alfred</GivenName><FamilyName>Jefferson</FamilyName></PersonName>
'''
when clicking on the xml to view it then displays with extra new lines and spaces within the element values actaully changes the data in the elements as follows
``` xml
<PersonName>
<FormattedName>
Alfred Jefferson
</FormattedName>
<GivenName>
Alfred
</GivenName>
<FamilyName>
Jefferson
</FamilyName>
</PersonName>
the proper pretty print for the original xml that does not change the value of the nodes is
<PersonName>
<FormattedName>Alfred Jefferson</FormattedName>
<GivenName>Alfred</GivenName>
<FamilyName>Jefferson</FamilyName>
</PersonName>
Azure Data Studio version: azuredatastudio 1.37.0 (d904740d93d7df76a0ba361f20e4351813b57645, 2022-06-14T01:05:12.352Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 63.72GB (34.54GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Extensions (10)
| Extension | Author (truncated) | Version |
|---|---|---|
| azuredatastudio-select-top-n | jim | 0.0.5 |
| admin-tool-ext-win | Mic | 0.0.4 |
| dacpac | Mic | 1.10.1 |
| query-history | Mic | 0.1.0 |
| schema-compare | Mic | 1.14.1 |
| server-report | Mic | 0.2.3 |
| azdata-sanddance | msr | 3.3.0 |
| extra-sql-script-as | pac | 0.5.0 |
| simple-data-scripter | sea | 0.1.6 |
| vscodeintellicode | Vis | 1.2.1 |
Also occuring in v1.46.0.
Version: 1.46.0 (user setup) Commit: 39449bbe88a0bc4092c9b205cad10d0a556beffd Date: 2023-09-16T01:40:10.706Z VS Code: 1.79.2 Electron: 22.3.14 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22000
In addition to this correct behavior, formatting settings are needed. It’s even better to add some good existing VS Code plugin to the list of supported ones.
Now you can install the plugin from VS Code through the VSIX installation. For example, download the XML Tool plugin and set it as default formatter after installation.
The viewer corrupts the file content.
Store an XML string to a column, query the table and click on the XML value to open it to the viewer; all the element contents are line breaked and indented.
If you decide to manually do some changes to the data and push it back to the table through an update query (update myTable Set Xml = N'xmlCopyPastedFromTheViewerHere'), all the line breaks become part of the element contents, which they originally were not.
No such problem with the old SSMS.
Unless your file handling trims all the whitespace out of the values, you can expect some interesting UI glitches in your app.
Version: 1.51.1 (system setup) Commit: 95e6a0e2142d267ff827c86b8e8155fa055a73df Date: 2025-02-08T00:29:26.043Z (3 mos ago) VS Code: 1.82.0 Electron: 30.5.1 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.26100