Page 1 of 1

Indentation

PostPosted: Thu Aug 29, 2013 1:08 pm
by wcreed51
Having worked for years in VBA the lack of indentation in XML seems odd to me.

Is there any reason not to write things like this?

Re: Indentation

PostPosted: Thu Aug 29, 2013 1:26 pm
by dcd111
As far as I can tell, you can use as many levels of indentation as you like, it doesn't affect anything. I use it in my rules, and as far as I can tell, so do most of Notion's own plugin rules.

I know different text readers will display indentation differently, though. With Notepad++ it works very well, but Notepad makes a mess of it.

Re: Indentation

PostPosted: Thu Aug 29, 2013 1:29 pm
by wcreed51
OK. I'm using Notepad2, but maybe I should try something different.

Re: Indentation

PostPosted: Thu Aug 29, 2013 7:27 pm
by pcartwright
I don't use indentation as much simply because there aren't else or else-if statements within the rules. Each rule is usually one if statement after another (as is your example), so it becomes a little redundant to indent IMHO, but I know this isn't really the norm.

Also, +1 to Notepad++

Re: Indentation

PostPosted: Thu Aug 29, 2013 8:05 pm
by dcd111
So far, I've found the best system for me is to indent <rule> and </rule> to the same level, then the <if /> statements to the next level, and then the modification statements to a third level, like this:

Code: Select all
      <rule name="implement straight mute, velo key">
         <if flag="stra" />
         <if not-flag="vfad" />
         <if not-flag="afad" />
            <channel-change channel="6" />
            <cc controller="21" value="6" type="note-on-prefix" />
      </rule>