xmlを整理するために利用できるライブラリ/ツールは何ですか?
強く推奨されるHtmlTidyを見つけましたが、残念ながら、入力 xml ファイルを正しく処理しません。バグ レポートを送信するつもりですが、当面は xml で動作する xml tidying ツールが必要です。
誰でも代替案を提案できますか?
更新:「Tidy」とは、xml を整形することを意味するので、(たとえば):
<xml><testing attribute="somevalue"><etc /></testing></xml>
なる
<xml>
<testing attribute="somevalue">
<etc />
</testing>
</xml>
HtmlTidy で発生しているバグ
バグレポートで送信できるいくつかのxmlで再現する機会があれば、それを行うつもりですが、興味がある場合は、次のようなエラーが表示されます。
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: plain text isn't allowed in <head> elements
line 1 column 1 - Info: <head> previously mentioned
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 6558 - Error: <myelement> is not recognized!
line 1 column 6558 - Warning: discarding unexpected <myelement>
** snip - around 15 similar errors / warnings **
48 warnings, 22 errors were found! Not all warnings/errors were shown.
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.
私のxmlはかなり大きく(〜18k)、すべて1行でフォーマットされていますが、完全に有効なxmlです。Visual Studio でファイルを開き、VS にある "prettifier" を使用すると、HtmlTidy は結果の xml を正しく解析できます。