XQuery UDL

  • Hello,

    I am desperately looking for an UDL for XQuery working with NPP 7.6

    All I have found either fail to import or are useless (highlighting nothing)


  • @Robert-Kirkpatrick, welcome to the Notepad++ Community.

    You mentioned:

    NPP 7.6

    If you’re really on the initial v7.6, and not a minor version like v7.6.4, I would highly recommend upgrading to v7.6.6. (v7.6 - v7.6.2 had major bugs). (If you are unsure, go to the ? menu, and look at Debug Info; if you need help interpreting, click copy debug info into clipboard and paste in your reply.)

    If you could supply us with a small XQuery file (no proprietary data) that doesn’t get highlighted, plus paste in the UDL config file that you’re using (and where you put that file),

    I don’t have any XQuery files (don’t even know what they are), but from the Notepad++ end of things, from a cursory glance, the UDL described at https://github.com/robwhitby/NotepadPlusPlus-XQuery should work. With v7.6.6, instead of copying their UserDefineLang.xml into %AppData%\Notepad++, it can now go as XQuery.xml in the %AppData%\Notepad++\userDefineLangs\ folder (ie, save the downloaded UserDefineLang.xml as %AppData%\Notepad++\userDefineLangs\XQuery.xml – which will avoid overwriting the default UserDefineLang.xml that comes with Notepad++ v7.6.6).

    If it doesn’t work, a screenshot of the lack of syntax highlighting would be nice. (It would also be good to confirm that the Languages > XQeury UDL has been selected.)

  • Thank you Peter,

    I’m using NPP 7.6.6

    I repeated the operations like you explained (using the github UDL), without sucess. No Languages > XQuery appears. No highlight of this file:

    module namespace page = ‘http://basex.org/examples/web-page’;
    (: %rest:form-param(“amount”, “{$message}”, “(no data)”) :)
    %rest:header-param(“User-Agent”, “{$agent}”)
    function page:hello-postman(
    $message as xs:string,
    $agent as xs:string*
    ) as xs:string { $message };
    (: as element(response) { <response type=‘form’>
    <message>{ $message }</message>
    <user-agent>{ $agent }</user-agent>
    </response> }; :)

  • @Robert-Kirkpatrick

    if you have followed @PeterJones 's guide correctly, your xquery example code should look as seen at this screenshot:
    (if not, there are several possibilities, and things you can do, listed below.)


    possibilities, if xquery still does not show up:

    1) it might be a chance, that your windows explorer is set to hide extensions for known file types.
    this would mean, if you download https://github.com/robwhitby/NotepadPlusPlus-XQuery/raw/master/userDefineLang.xml , the filename would look like userDefineLang.xml to you, but in reality it will be saved as userDefineLang.xml.txt which will not be recognised by notepad++ as a valid udl.xml file.
    if this is the case, please set windows explorer to show all known extensions.
    note: the procedure, for enabling extensions for known file types, depends on your windows version which we currently don’t know.

    2) there might be a chance, that your notepad++ is not located at the expected place.
    for that we would need you to paste your notepad++ debug information from the menu ? > debug info... > copy debug info into clipboard here, to be able to tell you currently expected udl locations.

    best regards

  • Thank you MC,

    This proves that the UDL works fine - but still not for me !
    File extension hiding is turned off.
    Here is the debug info:
    Notepad++ v7.6.6 (64-bit)
    Build time : Apr 3 2019 - 23:52:32
    Path : C:\Program Files\Notepad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : OFF
    OS : Windows 10 (64-bit)
    Plugins : mimeTools.dll NppConverter.dll

    May be should local conf mode be ON ?

  • @Robert-Kirkpatrick

    thank you for your detailed debug information.

    May be should local conf mode be ON ?

    no, local conf mode is just for the portable versions of notepad++.
    it just serves to confine all configuration files to the notepad++ folder, instead of %AppData% for every specific user.
    this mode is not possible, if notepad++ is installed in C:\Program Files\Notepad++.
    your installation looks good to me as it is.

    please try the following:

    • right click and save https://github.com/robwhitby/NotepadPlusPlus-XQuery/raw/master/userDefineLang.xml
    • make sure the saved file is called userDefineLang.xml, if it is called userDefineLang.xml.txt or anything else, rename it to userDefineLang.xml.
    • open up notepad++.
      go to language > define your language > import, select the userDefineLang.xml you have just downloaded and press open, as seen at the screenshot below:


    • it should now say import successful.
    • close notepad++ and reopen it, for the changes to take effect.
    • open up an .xqy file or paste your example into a new tab.
    • go to the language menu and select XQuery, as seen at the next screenshot:
    • your xquery code should now be highlighted.

    hope this helps.

    note: the other file at https://github.com/robwhitby/NotepadPlusPlus-XQuery , called XQuery.xml is just for the autocompletion and not needed for the highlighting. we can deal with that later.

  • I tried it many times, but I always get Fail to import

  • @Robert-Kirkpatrick

    very intriguing indeed.

    please test the following, to verify, if a clean, portable notepad++ would work on your system.

    • download the notepad++ 7.6.6. 64 bit portable version from >>> here <<<.
      (the portable version does not require any installation and runs completely independent and isolated from your installed version. all custom settings, as well as any stuff you might want to try at the portable version, will not modify your installed version)

    • extract npp.7.6.6.bin.x64.zip to a folder, which is automatically called npp.7.6.6.bin.x64 and copy this folder to your desktop.

    • important note: make sure to close all instances of notepad++ that might be running, before starting the portable version at the next steps, to be sure you are using the portable version for this test.

    • open the userDefineLangs folder within the extracted npp.7.6.6.bin.x64 folder on your desktop.
      (the path %HomePath%\Desktop\npp.7.6.6.bin.x64\userDefineLangs will lead you there)

    • copy userDefineLang.xml you have downloaded from >>> here <<< into userDefineLangs.

    • start this portable version by double-clicking on notepad++.exe inside the npp.7.6.6.bin.x64 folder.

    • go to the language menu and check if XQuery is present.

    let’s hope this works for you.
    if it does, we can search for the differences and eventually find the culprit on your system.

    best regards.

  • Makes no difference, no new language, fail to import again.

    Seem to get worse…:(

  • @Robert-Kirkpatrick

    this is very strange, as the portable, stand alone notepad++ version always works for such cases.

    last things you could try:

    • copy userDefineLang.xml you have downloaded, without renaming, into %AppData%\Notepad++ and start your installed notepad++.

    • check if perhaps your browser or any anti malware tool has altered the content of userDefineLang.xml while downloading.

    the contents of userDefineLang.xml should begin with:
    (due to allowed size limitations, i can’t post the whole file)

        <UserLang name="XQuery" ext="xqy">
                <Global caseIgnored="no" />
                <TreatAsSymbol comment="no" commentLine="no" />
                <Prefix words1="no" words2="yes" words3="no" words4="no" />
                <Keywords name="Delimiters">&apos;&lt;0&apos;&gt;0</Keywords>
                <Keywords name="Folder+">{</Keywords>
                <Keywords name="Folder-">}</Keywords>
                <Keywords name="Operators">&apos; ! &quot; ( ) * , . / ; @ [ ] &lt; = &gt;</Keywords>
                <Keywords name="Comment">1(: 2:) 0</Keywords>
                <Keywords name="Words1">after ancestor ancestor-or-self as ascending assert attribute before case cast child comment declare default descendant descendant-or-self descending element else every except following following-sibling follows for function if import in instance intersect item let module namespace node of only option parent precedes preceding preceding-sibling processing-instruction ref return returns satisfies schema self some sortby stable text then to treat typeswitch union variable version where xquery</Keywords>
                <Keywords name="Words2">$</Keywords>

    other than than, i’m sorry, i am out of ideas :(

    best regards.

  • @Robert-Kirkpatrick said:

    Makes no difference, no new language, fail to import again.

    Following @Meta-Chuh’s detailed instructions should work. You will need to give us more information if you want us to be able to help you.

    It would help if you would take screenshots along the way, post them to imgur, and then link them using the syntax ![](http://i.imgur.com/QTHZysa.png). Or, even better, use a utility like ScreenToGif to take a “video” (animated gif) of the whole process, upload to imgur, and embed the animated gif the same way (![](https://i.imgur.com/Q36FaoJ.gif) – make sure you use the .gif link, not the .gifv link) so we can see exactly what you’re doing

    For example, I followed the download/import/restart/apply instructions to your sample .xqy file, and it highlighted properly. I recorded my process:

  • I might suspect an interference with an older installation of npp, which coexists on another drive used by older Windows versions (though currently disabled).
    Is there some Registry setting that need cleanup?

  • @Robert-Kirkpatrick said:

    Is there some Registry setting that need cleanup?

    Only if you didn’t follow @Meta-Chuh’s instructions.

    He asked that you download the portable (zip or 7z) version of Notepad++, and extract that to your desktop. That portable copy doesn’t use any of the registry settings or the %AppData%\Notepad++ saved settings; it uses a completely clean edition. You’ll notice in my animation, the Debug Info shows Local Conf Mode: ON, because I was using a portable edition.

    To follow his instructions correctly, you should have run notepad++ from your portable download; looking at ? > Debug Info should show local configuration mode is on, and the notepad++.exe path should be relative to your desktop (or wherever you unzipped your portable). When you loaded your .xqy file, you should have used the File > Open menu of the portable Notepad++ rather than double-clicking or right-clicking on the .xqy in Explorer and running your installed version.

    (To clarify: under an installed condition, there may be a mixup in registry settings given your old-vs-new installations; but Meta asked you to do the portable/zip/7z version of Notepad++, so that registry settings and %AppData%\Notepad++ settings would not get in the way.)

    Until you start providing details, rather than giving one-to-two-sentence replies to our detailed posts, we won’t be able to help you any further, because we have run out of guesses as to what might be going wrong for you. If you follow these sequences we’ve described, it should work – we have shown in multiple ways that it does work. If it’s not working for you, you will have to do a better job of giving a step-by-step recounting of exactly what you did, with screenshots and/or animated gifs.

  • I did follow the instructions about the portable version strictly.
    I will continue the investigation myself.

Log in to reply