Problem with Code Folding and XML (fixed)

Problem with Code Folding and XML (fixed)

5
NewbieNewbie
5

    May 25, 2011#1

    I'm evaluating UEStudio v11.00 but seems there is a problem with code folding and my XML files. I'm developing MSBuild files that are actually XML files, but code folding is doing very strange things. It misses some tags - so I cannot collapse them - or it detects tags that haven't content.

    Am I doing anything wrong? Can you help me ?
    Regards.

    6,686585
    Grand MasterGrand Master
    6,686585

      May 25, 2011#2

      I can't see why code folding fails on the blocks as shown in your screen shots (removed already). But often the content mistake causing strange code folding is not where it results in wrong code folding symbols. So without entire file I'm not really able to analyze if the problem is caused by file content of the XML file or by code folding engine of UEStudio.

        May 25, 2011#3

        Thanks for the file (deleted already). I looked into it and I think, I know now what causes the UEStudio code folding engine for XML to fail.

        First, I think a block like

        <AdditionalProperties>
           Configuration=$(Configuration)
        </AdditionalProperties>

        is not valid for an XML file. But I'm not an XML expert. Well, that block is not the problem.

        The cause of the code folding problem are the string values defined with single quotes instead of double quotes to be able to use double quotes inside the string value without the need to use the entity " like in

        <Exec Command='"$(InnoSetupCompilerPath)" $(QtSupportFolder)\install\files\exor\install.iss /fJMSuite_nightly_$(nightlybuildDate)'
           Condition="'$(Delivering)' == 'true' And '$(Nightly)' == 'true'" />

        I think that is valid according to XML specification, but UEStudio has definitely a problem with string values defined by single quotes containing inside double quote characters. I will report this issue to IDM support by email.

        For myself it would be interesting how the XML parser of Microsoft interprets that file. Does the parser really look for first double OR single quote character after a value[whitespaces]=[whitespaces] to determine type of string value definition or is it hard coded in the parser that attribute Command of element Exec has a string value with single quote character as delimiter character.

        I used the following macro to replace every double quote character inside a single quoted command string by " and after saving the file with a new name code folding was perfect as far as I could see.

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        UltraEditReOn
        Top
        Loop 0
        Find RegExp "Command='*'"
        IfNotFound
        ExitLoop
        EndIf
        Find SelectText """
        Replace All """
        EndLoop

          May 26, 2011#4

          It turns out that the double quotes inside the single quoted strings of the Command attributes of tag Exec is not the only problem here. All the empty elements spanning over multiple lines are additionally a problem for code folding of UEStudio v11.00 and UE v17.00. A workaround for this additional problem is to use following macro with property Continue if search string not found enabled.

          InsertMode
          ColumnModeOff
          HexOff
          UltraEditReOn
          Top
          TrimTrailingSpaces
          Loop 0
          Find RegExp "^([~>^p]^)^p[ ^t]+^(*>^)$"
          Replace All "^1 ^2"
          IfNotFound
          ExitLoop
          EndIf
          EndLoop

          After additionally inserting a line break at line 27 with Configuration=$(Configuration) and saving the file, the code folding is finally correct.

          I received from IDM support that you were also in contact with IDM support and that both problems are entered now in the issues database.

          5
          NewbieNewbie
          5

            May 27, 2011#5

            Thanks Mofi.
            I tried your script and Yes now code folding is working in the right way... the problem is that now code is not readable.
            I send a request to tech support, too. I hope they'll fix this issue asap, so I can continue evaluation of UEStudio.

            6,686585
            Grand MasterGrand Master
            6,686585

              Dec 18, 2013#6

              I just want to add that all the problems discussed here with code folding not working right for XML files containing double quotes in single quoted strings and empty elements spanning over multiple lines are fixed in UE v19.10.0.1012 and UES v13.10.0.1004 as can be proved.
              Best regards from an UC/UE/UES for Windows user from Austria