Community
    • Login

    How to prevent auto syntax highlighting for files with xml tag in first line?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 947 Views 1 Watching
    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.
    • pintassilgoP Offline
      pintassilgo
      last edited by

      I often need to edit a file that has 20,000 tags. Notepad++ hangs for 10 seconds on opening that file because it reads from the first line:

      <?xml version="1.0" encoding="UTF-8"?>

      then automatically applies XML syntax highlighting, and this process is super heavy and slow for that file.
      I need to empasize: Notepad++ is detecting XML because of the first line. It’s not due to file extension. File extension is XSPF and this doesn’t matter. I can rename it to .js and Notepadd++ still applies XML syntax. In the same way, if I keep .xspf and just remove the first line, then Notepad++ opens the file without any formatting (and all slowness goes away!).

      So my question is how to prevent this. I need to open this file as “Normal text”, without any formatting.

      This is not caused by XML Tools, this happens even without any plugin.

      Also I don’t know why Notepad++ is so inefficient with XML files. SciTE opens the same file instantly, with syntax highlighting and fold marks.

      pintassilgoP 1 Reply Last reply Reply Quote 0
      • pintassilgoP Offline
        pintassilgo @pintassilgo
        last edited by

        I just realized that the first line

        <?xml version="1.0" encoding="UTF-8"?>

        is what’s causing the bug.

        If I remove that line, but rename the file to .xml so that Notepad++ will sill open it with XML syntax highlight, the file opens instantly.

        So it’s not that Notepad++ is unable to properly handle XML files. It’s just that the first line is triggering some strange bug.

        Should I report this?

        Lycan ThropeL 1 Reply Last reply Reply Quote 1
        • Lycan ThropeL Offline
          Lycan Thrope @pintassilgo
          last edited by Lycan Thrope

          @pintassilgo ,

          Maybe you should. I never saw that behavior when I was trying to read just text, but then again, I didn’t rename the ext .xml. :)

          1 Reply Last reply Reply Quote 0
          • rdipardoR Offline
            rdipardo
            last edited by

            Answered on GitHub.

            1 Reply Last reply Reply Quote 3

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors