XML Tools Pretty Print fails to indent close tag
-
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?
-
@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.
-
@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.
-
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>
(containingt
) 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.
-
@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>
-
@theshoeshiner did you guys compare the options for XML Tools?
There’s quite a number of settings there that would affect the result.