Home > Back-end >  Identify programming language, XML without closing brackets
Identify programming language, XML without closing brackets

Time:03-17

I am trying to read the config file from another software in C# Winform but cannot get what language it is written in as some of its items has closing brackets, others don't. OpenXML doesn't like code without </Name> brackets and with spaces between words in tags like <User Name>. Has anyone come across trying to parse this type into C# Object or know what language generated it? I am reading a very large config file (1000 lines) so cannot be hardcoded.

Example of config file:

<Profile>
    <Name>Default Profile
    <User Name>User1
    <User Settings>
      <Setting1>Yellow
      <Setting2>Admin
      <Setting3>Full Screen
    </User Settings>
</Profile>

CodePudding user response:

That could almost be SGML, the predecessor to both HTML and XML:

  • SGML allows end-tags to be omitted.
  • SGML allows certain attributes to be minimized to just the attribute value. (Although your sample markup appears to leverage this property syntactically, the values used do not actually make much sense as minimized attribute values.)

The end-tag, </User Settings> is just not right, however.

Therefore, it's likely some non-standard markup format for which you're unlikely to find much/any support. See the How to parse invalid (bad / not well-formed) XML? for ways in which you might recover usable XML from this.

  • Related