Community
    • Login

    Invalid structure of stylers.model.xml

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 4 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Zzy ZxZ
      Zzy Zx
      last edited by

      Running the configuration file stylers.model.xml through a XML validator we’ll get errors starting from this line (no. 965) as the “<” is an invalid name character:
      <WordsStyle name="TAG { <TITLE HEIGHT=100> }" styleID="14" fgColor="C00000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />

      Editing this file—or stylers.xml, respectively—with xml parsers isn’t possible any more.

      Workaround: Manually deleting the <LexerType name="rebol" desc="REBOL" ext=""> element prior to running the xml parser.

      1 Reply Last reply Reply Quote 1
      • Zzy ZxZ
        Zzy Zx
        last edited by Zzy Zx

        To illustrate my use case, this is what I’d like to achieve.
        First off, a xml draft:

        <?xml version="1.0" encoding="Windows-1252"?>
        <NotepadPlus>
        	...
        	<GlobalStyles>
        		<WidgetStyle name="Global override" styleID="0" fgColor="FFFF80" bgColor="FF8000" fontName="Courier New" fontStyle="0" fontSize="10"/>
        	...
        	</GlobalStyles>
        </NotepadPlus>
        

        I execute this XMLStarlet command line:
        xml ed -L -P -u "/NotepadPlus/GlobalStyles/WidgetStyle[@name='Global override']/@fontName" -v Consolas stylers.xml

        It’s supposed to change the WidgetStyle node’s property “fontName” to “Consolas” and did so before the xml became invalid.
        This is just one change I automatise using a script.

        1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones
          last edited by

          I’m not an XML expert, but that does look like invalid XML. It’s a bummer that the tool you are trying to use doesn’t follow the philosophy of “be conservative in what you do, be liberal in what you accept from others”.

          But yes, the NPP config files should be valid XML. You might want to search for and/or report a bug. This FAQ explains where to make bug reports and feature requests. Always make sure you search the existing issues to avoid duplicating the request.

          1 Reply Last reply Reply Quote 0
          • Zzy ZxZ
            Zzy Zx
            last edited by

            The file draft was cut down for the sake of clarity, the ... being just placeholders. The file stylers.model.xml counts 1371 lines, originally.

            I don’t see what’s wrong with the programme, but you may use any xml parser, I’m just more used to the syntax of XMLStarlet and successfully did a lot of deployment with it in the past.

            Thanks for pointing me to the bug report FAQ, I’ll have a look.

            1 Reply Last reply Reply Quote 0
            • Zzy ZxZ
              Zzy Zx
              last edited by

              There indeed exists an issue#4572 for this, it was erroneously closed by ClaudiaFrank, although the bug still remains.

              Scott SumnerS 1 Reply Last reply Reply Quote 1
              • Scott SumnerS
                Scott Sumner @Zzy Zx
                last edited by

                @Zzy-Zx

                Why don’t you add that to the github issue, with a request that it be looked at again?

                1 Reply Last reply Reply Quote 1
                • Zzy ZxZ
                  Zzy Zx
                  last edited by

                  You’re right, Scott, I did so now.

                  1 Reply Last reply Reply Quote 1
                  • guy038G
                    guy038
                    last edited by

                    Hello, @zzy-zx, @peterjones and All,

                    Ah yes, in the rebol node, the TAG item does not be valid !

                    <WordsStyle name="TAG { <TITLE HEIGHT=100> }" styleID="14" fgColor="C00000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
                    

                    However , note that, when you starts N++, for the first time, the stylers.xml configuration files is created, from stylers.model.xml, and, this time, everything is rewritten, in the expected way ;-=))

                    <WordsStyle name="TAG { &lt;TITLE HEIGHT=100&gt; }" styleID="14" fgColor="C00000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
                    

                    Best Regards,

                    guy038

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors