Skip to content

XML Needs Fixing 1: Poorly designed schema #2

@dantswain

Description

@dantswain

When i designed the XML settings storage, I didn't understand XML that well. There are a number of problems with the way it is right now. It fails if any of the variable names in an MT_DataGroup have certain kinds of characters that aren't allowed in XML tags. It automatically replaces spaces with underscores and vice/versa, but quotes, parentheses, brackets, etc cause problems.

It should be redesigned to better conform to usual XML standards using attributes and tags, etc.

An example of the way a data group is stored now:

<Data_Group_Blob_Tracking_Parameters>
        <H_min>82</H_min>
        ..... other variables....
</Data_Group_Blob_Tracking_Parameters>

This is an MT_DataGroup called "Blob Tracking Parameters" with a variable named "H_min" whose value is 82. It should probably be more like

<MT_DataGroup>
    <name>Blob Tracking Parameters</name>
    <variables>
      <variable>
         <name>H min</name>
         <type>integer</type>
         <value>82</value>
       </variable>
       .... other variables ....
   </variables>
</MT_DataGroup>

I'm not an expert on XML design, so this may not be optimal, but it's much better than the first approach. Using attributes might work well, too... something like <variable name="H min" type="integer">82</variable>

Of course, this will introduce some versioning problems to keep track of. The XML needs to have the schema version embedded into it, and we can assume it's version "0" if we can't find it. The old code will have to remain available to parse old XML files, then replace them with the new version when saving.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions