Community
    • Login

    XML Tools Pretty Print fails to indent close tag

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    6 Posts 5 Posters 1.5k Views 2 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.
    • theshoeshinerT Offline
      theshoeshiner
      last edited by theshoeshiner

      Following linearized xml fails to format via XML tools 3.1.1.13

      <table><tr><th><span><span>t</span></span></th></tr></table>
      

      It doesnt indent the close tag of the outer span. If I remove/change either of the spans to a div, it works, so seems like it might be related to both tags being the same type?

      Mark OlsonM 1 Reply Last reply Reply Quote 0
      • Mark OlsonM Offline
        Mark Olson @theshoeshiner
        last edited by

        @theshoeshiner
        Open issue in the repo if you haven’t already done so.

        Talking about issues in the community forum is not the most efficient way to get plugin issues fixed.

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA Offline
          Alan Kilborn @Mark Olson
          last edited by

          @Mark-Olson said in XML Tools Pretty Print fails to indent close tag:

          Talking about issues in the community forum is not the most efficient way to get plugin issues fixed.

          It might be good to talk about it here first if you have any doubt that it is a bug…you might just not know how something works.

          It’s fine to talk about these kinds of things here…just don’t have the expectation that for real problems doing so will get it fixed.

          rdipardoR 1 Reply Last reply Reply Quote 3
          • rdipardoR Offline
            rdipardo @Alan Kilborn
            last edited by

            It might be good to talk about it here first if you have any doubt that it is a bug…you might just not know how something works.

            Indeed, it’s fairly obvious the pretty-printing algorithm will not insert newlines within elements that contain text, as that’s a potentially destructive change to the content. XML tends to define a well-formed document much more strictly than, say, HTML, which is what the sample text actually is.

            The pretty-printed output currently looks like this:

            <table>
              <tr>
                <th>
                  <span>
                    <span>t</span>
                  </span>
                </th>
              </tr>
            </table>
            

            Note how the innermost <span> (containing t) is the only non-empty element. Remove the content and you get the perfectly symmetrical tab stops that @theshoeshiner was expecting:

            <table>
              <tr>
                <th>
                  <span>
                    <span/>
                  </span>
                </th>
              </tr>
            </table>
            

            Adding content to any element will likewise unbalance the “symmetry” as before, e.g. a table heading:

            <table>
              <tr>
                <th>Heading 1<span>
                    <span/>
                  </span>
                </th>
              </tr>
            </table>
            

            Bottom line, don’t expect XMLTools to make your HTML look perfect; use a plugin that ingrates HTML-Tidy instead.

            theshoeshinerT 1 Reply Last reply Reply Quote 5
            • theshoeshinerT Offline
              theshoeshiner @rdipardo
              last edited by theshoeshiner

              @rdipardo What you’re getting in PP is not what I’m getting. I should have put an example in the first post. Im not looking to PP the inner span. Only the outer span. I understand completely that adding characters to text content is undesirable.

              What I get when I PP the original content is:

              <table>
              	<tr>
              		<th>
              			<span>
              				<span>t</span>
              </span>
              		</th>
              	</tr>
              </table>
              
              Snabel42S 1 Reply Last reply Reply Quote 0
              • Snabel42S Offline
                Snabel42 @theshoeshiner
                last edited by

                @theshoeshiner did you guys compare the options for XML Tools?
                There’s quite a number of settings there that would affect the result.

                1 Reply Last reply Reply Quote 0

                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