Invalid structure of stylers.model.xml

  • 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.

  • 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"?>
    		<WidgetStyle name="Global override" styleID="0" fgColor="FFFF80" bgColor="FF8000" fontName="Courier New" fontStyle="0" fontSize="10"/>

    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.

  • 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.

  • 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.

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

  • @Zzy-Zx

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

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

  • 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,


Log in to reply