I want a textual interface for some structured data that I want to put into a mySQL table. Currently it is in text from using the notation below.
I’m trying to understand why XML is used – basically where my fields would be in XML tags instead of using “custom markup/structure” /**/, -, and | to denote tables and fields.
I have code that will put this into mySQL and extract it. I just feel a bit like a hack for using this notation. Later the structured data file will be used for importing and exporting data, kind of like Internet explorer when you export your bookmarks.
/*Table*/
-
Field 1 | Field 2 | Field 3
-
Field 1 | Field 2 | Field 3
What are the design considerations for using a custom markup language vs XML?
Why invent your own? There are over a dozen lightweight markup languages.
EDIT: @Luc M’s answer is very good. In general, you (almost) always want to use an existing parser if one is available. Why reinvent the wheel? If you want a simple format, go with CSV, YAML, or JSON. But there’s nothing wrong with XML, and there are lots and lots of solid parsers available for it. Most employers care about getting quality software quickly and cheaply, and writing parsers seldom helps that cause.