• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Notepad++ to autoformat xml?

lozina

Lifer
IS there a way to get Notepad++ to autoformat xml ?

i.e. wrap it on each xml element and perform indenting ?

at least something so this chunk of xml data I'm looking at is more readabe
 
Maybe you can do a replace in MS Word for something along the lines of "^p</tag" to "</tag>". The ^p in MS Word is the paragraph character, and that can really help clean things up too. Also, if you were wondering, "^t" is the tab character. So you can do replacements for things like, "^p^p^t^t</tag>" to "</tag>".

And for what it's worth, I realize that my period is not inside the quotes, I didn't want to put it in there because I didn't want to confuse anyone who might get confused. Not necessarily the OP but anyone who reads it.
 
Could write a little parser to handle it. Searches for <something>, pushes it onto a stack. Indents whenever it sees a new <something>, when it sees </something> it reduces indentation by 1 and pops "something" off the stack. Also, insert newline when it seems <something> or </something>.

Probably a 10-line Perl script could do it neatly, unless there's some subtlety I'm missing. This of course assumes your data fields don't have XML-like data in them (though if it's escaped, then you'd just need to change your regex a little to handle it).
 
Back
Top