それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

xml のシンタックスチェックをコマンドから行う。

xml を送っても謎の挙動が起きる。

xml を送信しても謎の挙動が起きるので、頭を抱えてた。 そこで xml のチェックをすることにした。

takuya@Desktop$ cat out.xml  |  xmllint  -
-:1: parser error : XML declaration allowed only at the start of the document
<?xml><entry xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/eleme
     ^
-:1: parser error : ParsePI: PI xml space expected
<?xml><entry xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/eleme
     ^
-:2: parser error : ParsePI: PI xml never end ...
-:2: parser error : Start tag expected, '<' not found

いろいろ指摘してくれる

タイポも見つけてくれる

takuya@Desktop$ cat out.xml  |  xmllint  -
-:3: parser error : Opening and ending tag mismatch: subject line 3 and subjetct
/purl.org/dc/elements/1.1/" ><title>out</title><dc:subject>twitter</dc:subjetct>
                                                                               ^
-:3: parser error : AttValue: " or ' expected
lements/1.1/" ><title>out</title><dc:subject>twitter</dc:subjetct><content mode=
                                                                               ^
-:3: parser error : attributes construct error
lements/1.1/" ><title>out</title><dc:subject>twitter</dc:subjetct><content mode=
                                                                               ^

便利!