r/learnprogramming • u/zaphodikus • 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
u/BranchLatter4294 Oct 29 '26
You might try this extension.
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml
3
u/mredding 29d ago
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.
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/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
3
u/xenomachina 29d ago edited 29d ago
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
11
u/[deleted] Oct 29 '26
[removed] — view removed comment