r/learnprogramming • • Oct 29 '26

No XML file editors? Or something I am miss-understanding about when to use XML vs txt files

If you google for online xml editors all you get is web pages that validate your XML, they do not help you to edit it at all, and they cover 50% of the page with adverts, these are all validators. Has anyone found an actual tool for taking any old vanilla XML with no underlying schema XSD and then adding nodes easily in a WYSIYG and does not involve typing in <> repeatedly and trying to get the node and attribute names correct? There must be one out there, I'm just searching for the wrong thing, or I'm miss-understanding XML entirely and should probably be using JSon for configuration files?

Is there an online tool or a open-source editor that actually makes editing really easy? And does not require carefully copying and pasting xml tags repeatedly and forgetting to close them sometimes? Or, should I just use JSon and be never trying to validate structure correctness?

Visual Studio lets me create a mostly sane schema file, but I am just not understanding how there is not a simple tool for just populating a file easily with more nodes, based on existing data and a schema?

6 Upvotes

28 comments sorted by

6

u/BranchLatter4294 Oct 29 '26

1

u/zaphodikus Oct 29 '26

How on earth is that free? It looks amazing, almost an entire life I seem to have wasted before seeing this tool!

4

u/BranchLatter4294 Oct 29 '26

Most of the VS Code extensions are free. There are so many great ones for most any workflow.

3

u/mredding 29d ago

or I'm miss-understanding XML entirely and should probably be using JSon for configuration files?

You are VERY much misunderstanding BOTH technologies. XML and JSON are BOTH transport protocols. XML is a markup for structuring documents for transport. Both make lousy config file formats.

And these technologies aren't very good serialization formats if all you want to do is deserialize the data therein. Are you running a DOM? Are you keeping all your data and program state in a DOM? Is your data and program document-centric? Or are you running a JS engine? Because JSON renders straight to an ECMAScript object - JSON isn't just data, it's actual code.

And if you're not working with either of those things, there's probably something better for you. INI is an old config format, but it's about perfect for serializing data into native program state.

YAML isn't just a config file format - A) it's Turing Complete, and B) only Ruby can parse the whole format spec correctly, every other parser has unfixable parsing flaws and incomplete feature sets. C++ is VERY dodgy, Python is the next closest, and it has one known edge case flaw they can't fix.

https://mikehadlow.blogspot.com/2012/05/configuration-complexity-clock.html

That is a very entertaining read.

As for what problem you're trying to solve, I'd look more into what you're trying to do, and what might be a better or conventional fit.

1

u/zaphodikus 29d ago

Fact is too many apps use xml for configuration, I'm looking at MS here. The fact it validates and represents stuff like hierarchical structure better than .INI does is why it has been so popular. As I replied on another comment, I would have preferred to use yaml, but the xml inertia is really bigger than it should be sometimes. I'm still deciding the size of this file. I do now however know one thing. It would not fit into .INI

I have previous experience of how C++ is not very awesome at yaml, a pity because yaml is nice to edit and pleasing on the eye.

1

u/mredding 29d ago

Configuration and hierarchy kind of don't make sense to me. Once you get into hierarchies, now you're talking data to me, and thinking of it as the config of that data structure isn't helpful, not the right fit.

In this case, yes, I can agree a hierarchical data persistence technology is going to be a better fit. I would recommend actually using a HDBMS rather than a hierarchial structure, in terms of a transport protocol, in a flat file.

2

u/Majestic_Rhubarb_ Oct 29 '26

Visual studio code is good for xml and json … you have you use whatever format the software requires how the configuration should be formatted … sometimes they might cope but it’s not high probability

1

u/zaphodikus Oct 29 '26

I'm using Studio 2019 and 2022 - cannot use VSCode unless I install it just for this one task. Will soon move to 2026 anyway, a real pity MS split the ecosystem.

1

u/Vizeroth1 29d ago

MS didn’t split the ecosystem, they embraced the community and took market share from many competitors. Many developers will never use an IDE over a programmer’s text editor, and Microsoft was the last company that was going to convince developers to change their minds on that issue. Many of those developers turned out to be slightly less reluctant to use a text editor developed by Microsoft.

1

u/Aggressive_Ad_5454 29d ago

I use notepad++ with an xml plugin, shipped with the editor.

Web browsers will render xml too. As will VS and VSCode

1

u/zaphodikus 29d ago

my ask was for a non eye-straining thing that can be used to edit XML not to verify it's correctness, and that thing is yaml. The extensions to editors that autoclose tags and autosuggest tags to really reduce the amount of typing was what I was looking for, and so far the notepad++ plugin is doing the job fine.

3

u/xenomachina 29d ago edited 29d ago

Has anyone found an actual tool for taking any old vanilla XML with no underlying schema XSD and then adding nodes easily in a WYSIYG and does not involve typing in <> repeatedly and trying to get the node and attribute names correct?

Without a schema (or DTD) how are you expecting it to know which element and attribute names are the correct ones?

For what it's worth, I used to edit XML in vim quite frequently. In vim you can set up completion that's based on words that exist in the current file, so that's probably the best that you could do to make schema-less editing more ergonomic.

Edit: typos

2

u/LetUsSpeakFreely Oct 29 '26 edited 28d ago

You don't need a dedicated editor for XML. If you want autocompletion or realtime schema validation then there are loads of plugins for every popular IDE and robust text editor like Notepad++.

2

u/newytag 29d ago

I used Microsoft's XML Notepad years ago for working with schema-compliant XML docs. Haven't used it since VSCode came on the scene. But it still seems to get the occasional update.

1

u/kamomil Oct 29 '26

Notepad

1

u/DanKegel Oct 29 '26

I personally prefer rm but it's not for everyone :-)

-1

u/seanv507 Oct 29 '26

I would discourage XML... It feels like yesterday s technology.

Yaml is probably the standard for config files... I would go with that

4

u/Rudeus_Kino Oct 29 '26

Yaml in big config files ia a nightmare.

1

u/zaphodikus Oct 29 '26

It is, and if I was knowing more about my requirements in my head beforehand, I would also have ditched XML by now. But I'm trying to not rock the boat with other team members who still love XML.

1

u/Rudeus_Kino Oct 29 '26

What about editing json and convert result to xml?

1

u/zaphodikus Oct 29 '26

I'm actually using it to write an editor for .INI files . So this all becomes a little circular if I let it because .INI files are great. But start looking mad when you want to impose structure and levels and not have loads of section names with '.' DOTS all over the show, and then starting to get out of order eventually. .INI is really powerful, as is yaml for human-readable type jobs.

4

u/catbrane 29d ago

YAML is horribly complicated.

It has 63 (sixty three, and no this isn't a joke, it really does) different syntaxes for multiline strings. The previous 2009 version of the spec was an 83 page, highly technical PDF. The current 2021 spec is even longer and only available as a huge web page (as far as I can see). The maintainers don't plan to freeze it, they intend to evolve the spec and make it even more complicated.

The grandiose, extravagant, dizzying complexity makes it very hard for humans to read or write or maintain. How exactly will this be parsed? It's hard to say. How will this be parsed in 10 years? No one knows.

11

u/[deleted] Oct 29 '26

[removed] — view removed comment

3

u/zaphodikus Oct 29 '26

I shall grab that extension, thanks. It's always good to get things simplified rather than made harder in this lifetime.

I am wondering if JSon is a better container than XML, but will delay switching until I am sure the implicit checking XML gives anyway is not helpful long term.

3

u/Rudeus_Kino Oct 29 '26

json + json-schema.

1

u/jajajajaj 29d ago

My personal preference is to write json or yaml and avoid xml until the last possible second, converting with xq. People have other favorites for that part.