 horus
Member
|
Since there is no search function in this new version of forum, sorry that I have to ask this question:
Is there a function (or addon) to reformat xml strings? For example, I have an xml element like this:
aaaabbbb
I would like a function to reformat it nicely and output something like:
aaaa
bbbb
|
 horus
Member
|
My example was badly formatted…. so let’s me write the xml again using [ and ]
[a]aaaa[b]bbbb[/b][c attrib="cccc" /][/a]
[a]
aaaa
[b]
bbbb
[/b]
[c attrib="cccc" /]
[/a]
|
 aland
Member
|
Not sure if it’s a great solution, but I would just use find replace allowing backslash expressions, eg:
first find: ] replace: ]\n, second find: [ replace: \n[
then use find: ^\n replace: (nothing) to remove any blank lines.
There’s a magnifying glass in top right for search, but it seems broken. Just use google http://www.google.com/search?q=site:pnotepad.org/forums to search
|
 horus
Member
|
As a matter of fact, I’m already using the method you mentioned as a temporary incomplete workaround.
The problem with this method is that there is no indentation and you can’t easily see the level. (In my second post, I had put in some spaces but WordPress removed them all!)
|
 simon
Key Master
|
I normally use HTML Tidy to do this job for me. See the docs site for configuration:
http://pnotepad.org/docs/tools/xml_formatting
|
 horus
Member
|
Thanks.
OK, if my guess is correct, I have to search “HTML Tidy” in Google and download the “tidy.exe” from their website.
Could you make the words “HTML tidy” into a hyperlink to point to http://tidy.sourceforge.net/ please?
However, I’m unable to reformat xml string as suggested by that webpage of yours. I got these errors:
HTML Tidy: unknown option: w
HTML Tidy: unknown option: l
Error: Can’t open “CRLF”
Error: Can’t open “–tab-size”
Error: Can’t open “4″
I listed out tidy.exe options and it seems that “-newline” and “–tab-size” are not options. Something has changed?
Moreover, it took me some time to figure out what I was supposed to do! Maybe a little bit more explanation in that page is preferable.
|