teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

修正

2017/01/18 08:08

投稿

dlrowolleh
dlrowolleh

スコア120

title CHANGED
File without changes
body CHANGED
@@ -128,7 +128,7 @@
128
128
  hoge.html:4334: parser error : Premature end of data in tag head line 2
129
129
  hoge.html:4334: parser error : Premature end of data in tag html line 1
130
130
  ```
131
- エンコードは何を指定すれば良さそうですか?
131
+ エンコードは何を指定すれば良さそうですか?(解決?)
132
132
  エンコードとは関係なさそうなエラーも出てしまったようですが、どのように対処すれば良さそうでしょうか?
133
133
  ###追記
134
134
 

3

タグ追加

2017/01/18 08:08

投稿

dlrowolleh
dlrowolleh

スコア120

title CHANGED
@@ -1,1 +1,1 @@
1
- 文字コードのエラーについて
1
+ [HTMLタグ]xmllintでエラー
body CHANGED
@@ -158,5 +158,22 @@
158
158
  ```
159
159
  となりました。
160
160
  何が原因だと考えられるのでしょうか...。
161
+ ###追記
162
+
163
+ `hoge.html`(`xmllint`で解析しようとしているファイル)
164
+ はもともと、
165
+ サイトのHTMLで
166
+ frameタグのsrc属性で関連付けられて
167
+ 表示されていたものです。
168
+ また、閉じタグがないためエラーが出ているとのことですが、
169
+ [HTMLにて終了タグがいるたぐいらないタグ](http://vllv.us/Junk/htmlTag/)
170
+ によると、
171
+ linkタグにはそもそも閉じタグは無いということらしいです…。
172
+ 正しいファイルでも閉じタグが無いと
173
+ xmllintはエラーを吐き出すのなら、閉じタグをつければ良いと思うのですが、
174
+ どこにつけるべきでしょうか…?
175
+ タグは`</link>`で良いですか…?
176
+
177
+
161
178
  ###補足情報(言語/FW/ツール等のバージョンなど)
162
179
  より詳細な情報

2

追記

2017/01/18 08:06

投稿

dlrowolleh
dlrowolleh

スコア120

title CHANGED
File without changes
body CHANGED
@@ -55,6 +55,13 @@
55
55
  29 ▸-▸-▸-▸-<td width="20" bgcolor="#FFFFCC">17</td>
56
56
  30 ▸-▸-▸-▸-<td width="20" bgcolor="#FFFFCC">19</td>
57
57
  ~省略~
58
+ 4327 ▸-▸-▸-▸-▸-▸-▸-
59
+ 4328 ▸-</table>
60
+ 4329 ▸-</td>
61
+ 4330 </tr></table>
62
+ 4331 </form>
63
+ 4332 </body>
64
+ 4333 </html>
58
65
 
59
66
 
60
67
  ```
@@ -123,5 +130,33 @@
123
130
  ```
124
131
  エンコードは何を指定すれば良さそうですか?
125
132
  エンコードとは関係なさそうなエラーも出てしまったようですが、どのように対処すれば良さそうでしょうか?
133
+ ###追記
134
+
135
+ > $ xmllint --shell --encode utf-8 hoge.html
136
+
137
+ ↓から
138
+
139
+ > $ xmllint --shell --encode EUC-JP hoge.html
140
+
141
+ としてみましたが、エラーは変わりませんでした。
142
+ ```
143
+ hoge.html:17: parser error : Opening and ending tag mismatch: META line 5 and head
144
+ </head>
145
+ ^
146
+ hoge.html:4331: parser error : Opening and ending tag mismatch: input line 21 and form
147
+ </form>
148
+ ^
149
+ hoge.html:4332: parser error : Opening and ending tag mismatch: form line 20 and body
150
+ </body>
151
+ ^
152
+ hoge.html:4333: parser error : Opening and ending tag mismatch: body line 19 and html
153
+ </html>
154
+ ^
155
+ hoge.html:4334: parser error : Premature end of data in tag link line 4
156
+ hoge.html:4334: parser error : Premature end of data in tag head line 2
157
+ hoge.html:4334: parser error : Premature end of data in tag html line 1
158
+ ```
159
+ となりました。
160
+ 何が原因だと考えられるのでしょうか...。
126
161
  ###補足情報(言語/FW/ツール等のバージョンなど)
127
162
  より詳細な情報

1

追記

2017/01/18 03:23

投稿

dlrowolleh
dlrowolleh

スコア120

title CHANGED
File without changes
body CHANGED
@@ -74,6 +74,54 @@
74
74
  ```
75
75
  となっているところの`src=`の
76
76
  `Data.php?MstCode=0123456&Time=2017011724`というファイルです。
77
+
77
-
78
+ Xmllintに文字エンコードに関するオプション
79
+
80
+ `xmllint --encode`でできるようでした。
81
+ なので、
82
+ > xmllint --shell --encode utf-8 hoge.html
83
+
84
+ としてみたのですが、
85
+
86
+ ```
87
+ hoge.html:17: parser error : Opening and ending tag mismatch: META line 5 and head
88
+ </head>
89
+ ^
90
+ hoge.html:4331: parser error : Opening and ending tag mismatch: input line 21 and form
91
+ </form>
92
+ ^
93
+ hoge.html:4332: parser error : Opening and ending tag mismatch: form line 20 and body
94
+ </body>
95
+ ^
96
+ hoge.html:4333: parser error : Opening and ending tag mismatch: body line 19 and html
97
+ </html>
98
+ ^
99
+ hoge.html:4334: parser error : Premature end of data in tag link line 4
100
+ hoge.html:4334: parser error : Premature end of data in tag head line 2
101
+ hoge.html:4334: parser error : Premature end of data in tag html line 1
102
+ ```
103
+ と表示されました。
104
+ > $ xmllint --shell --encode CP932 hoge.html
105
+
106
+ また、としてみたところ、
107
+ ```
108
+ hoge.html:17: parser error : Opening and ending tag mismatch: META line 5 and head
109
+ </head>
110
+ ^
111
+ hoge.html:4331: parser error : Opening and ending tag mismatch: input line 21 and form
112
+ </form>
113
+ ^
114
+ hoge.html:4332: parser error : Opening and ending tag mismatch: form line 20 and body
115
+ </body>
116
+ ^
117
+ hoge.html:4333: parser error : Opening and ending tag mismatch: body line 19 and html
118
+ </html>
119
+ ^
120
+ hoge.html:4334: parser error : Premature end of data in tag link line 4
121
+ hoge.html:4334: parser error : Premature end of data in tag head line 2
122
+ hoge.html:4334: parser error : Premature end of data in tag html line 1
123
+ ```
124
+ エンコードは何を指定すれば良さそうですか?
125
+ エンコードとは関係なさそうなエラーも出てしまったようですが、どのように対処すれば良さそうでしょうか?
78
126
  ###補足情報(言語/FW/ツール等のバージョンなど)
79
127
  より詳細な情報