質問編集履歴

3

追記の、エラーチェックを全てのxmlファイルに対して行った旨の文章を追加しました。

2021/10/10 12:36

投稿

toyo_69
toyo_69

スコア20

test CHANGED
File without changes
test CHANGED
@@ -518,7 +518,7 @@
518
518
 
519
519
  (追記)
520
520
 
521
- [xmlファイルのエラーチェックができるサイト](https://www.xmlvalidation.com/)というものをご共有いただきましたので上で共有させて頂いたxmlファイルをエラーチェックしてみたところ、「No errors were found」と出力されたのでxmlファイル自体には問題なさそうです。
521
+ [xmlファイルのエラーチェックができるサイト](https://www.xmlvalidation.com/)というものをご共有いただきましたので上で共有させて頂いたxmlファイルを10個全てのエラーチェックしてみたところ、いずれも「No errors were found」と出力されたのでxmlファイル自体には問題なさそうです。
522
522
 
523
523
 
524
524
 

2

Spyderでget_data_from_XML.pyを実行させた時のエラー文を提示しました。

2021/10/10 12:36

投稿

toyo_69
toyo_69

スコア20

test CHANGED
File without changes
test CHANGED
@@ -522,6 +522,20 @@
522
522
 
523
523
 
524
524
 
525
+ また、AnacondaでPython3系での環境下のSpyderでもget_data_from_XML.pyを実行してみましたが、以下に示すように同じようなエラーが出てくるようです。
526
+
527
+
528
+
529
+ ```
530
+
531
+ File "<string>", line unknown
532
+
533
+ ParseError: not well-formed (invalid token): line 1, column 0
534
+
535
+ ```
536
+
537
+
538
+
525
539
  ###環境
526
540
 
527
541
  PC:MacOS BigSur11.6

1

問題となっているxmlファイルの内容を提示致しました。

2021/10/10 09:24

投稿

toyo_69
toyo_69

スコア20

test CHANGED
File without changes
test CHANGED
@@ -198,6 +198,304 @@
198
198
 
199
199
  ここで行き詰まってしまっているのでご教授をお願い致します。
200
200
 
201
+  
202
+
203
+
204
+
205
+ (追記)
206
+
207
+ 自作教師データのテストということで、少ないですが10個ほどの自作xmlファイルを作成しており、それらをpklファイルにまとめ、SSDに渡そうと考えております。その自作xmlファイルの内1つの内容を下記に共有いたします。
208
+
209
+
210
+
211
+ ```xml
212
+
213
+ <?xml version="1.0" encoding="UTF-8"?>
214
+
215
+ <annotation>
216
+
217
+ <folder>XXX</folder>
218
+
219
+ <filename>2021-09-08 15.13.29.jpg</filename>
220
+
221
+ <source>
222
+
223
+ <database>XXX</database>
224
+
225
+ <annotation>XXX</annotation>
226
+
227
+ <image>XXX</image>
228
+
229
+ <flickrid>XXX</flickrid>
230
+
231
+ </source>
232
+
233
+ <owner>
234
+
235
+ <flickrid>XXX</flickrid>
236
+
237
+ <name>?</name>
238
+
239
+ </owner>
240
+
241
+ <size>
242
+
243
+ <width>2880</width>
244
+
245
+ <height>1637</height>
246
+
247
+ <depth>3</depth>
248
+
249
+ </size>
250
+
251
+ <segmented>0</segmented>
252
+
253
+ <object>
254
+
255
+ <name>logo</name>
256
+
257
+ <pose>Unspecified</pose>
258
+
259
+ <truncated>0</truncated>
260
+
261
+ <difficult>1</difficult>
262
+
263
+ <bndbox>
264
+
265
+ <xmin>340</xmin>
266
+
267
+ <ymin>60</ymin>
268
+
269
+ <xmax>720</xmax>
270
+
271
+ <ymax>140</ymax>
272
+
273
+ </bndbox>
274
+
275
+ </object>
276
+
277
+ <object>
278
+
279
+ <name>header</name>
280
+
281
+ <pose>Unspecified</pose>
282
+
283
+ <truncated>0</truncated>
284
+
285
+ <difficult>1</difficult>
286
+
287
+ <bndbox>
288
+
289
+ <xmin>0</xmin>
290
+
291
+ <ymin>0</ymin>
292
+
293
+ <xmax>2880</xmax>
294
+
295
+ <ymax>180</ymax>
296
+
297
+ </bndbox>
298
+
299
+ </object>
300
+
301
+ <object>
302
+
303
+ <name>navi_botton1</name>
304
+
305
+ <pose>Unspecified</pose>
306
+
307
+ <truncated>0</truncated>
308
+
309
+ <difficult>1</difficult>
310
+
311
+ <bndbox>
312
+
313
+ <xmin>1340</xmin>
314
+
315
+ <ymin>60</ymin>
316
+
317
+ <xmax>1500</xmax>
318
+
319
+ <ymax>120</ymax>
320
+
321
+ </bndbox>
322
+
323
+ </object>
324
+
325
+ <object>
326
+
327
+ <name>navi_botton1</name>
328
+
329
+ <pose>Unspecified</pose>
330
+
331
+ <truncated>0</truncated>
332
+
333
+ <difficult>1</difficult>
334
+
335
+ <bndbox>
336
+
337
+ <xmin>1560</xmin>
338
+
339
+ <ymin>60</ymin>
340
+
341
+ <xmax>1700</xmax>
342
+
343
+ <ymax>120</ymax>
344
+
345
+ </bndbox>
346
+
347
+ </object>
348
+
349
+ <object>
350
+
351
+ <name>navi_botton1</name>
352
+
353
+ <pose>Unspecified</pose>
354
+
355
+ <truncated>0</truncated>
356
+
357
+ <difficult>1</difficult>
358
+
359
+ <bndbox>
360
+
361
+ <xmin>1740</xmin>
362
+
363
+ <ymin>60</ymin>
364
+
365
+ <xmax>1880</xmax>
366
+
367
+ <ymax>120</ymax>
368
+
369
+ </bndbox>
370
+
371
+ </object>
372
+
373
+ <object>
374
+
375
+ <name>navi_botton1</name>
376
+
377
+ <pose>Unspecified</pose>
378
+
379
+ <truncated>0</truncated>
380
+
381
+ <difficult>1</difficult>
382
+
383
+ <bndbox>
384
+
385
+ <xmin>1940</xmin>
386
+
387
+ <ymin>60</ymin>
388
+
389
+ <xmax>2140</xmax>
390
+
391
+ <ymax>120</ymax>
392
+
393
+ </bndbox>
394
+
395
+ </object>
396
+
397
+ <object>
398
+
399
+ <name>navi_botton1</name>
400
+
401
+ <pose>Unspecified</pose>
402
+
403
+ <truncated>0</truncated>
404
+
405
+ <difficult>1</difficult>
406
+
407
+ <bndbox>
408
+
409
+ <xmin>2180</xmin>
410
+
411
+ <ymin>60</ymin>
412
+
413
+ <xmax>2280</xmax>
414
+
415
+ <ymax>120</ymax>
416
+
417
+ </bndbox>
418
+
419
+ </object>
420
+
421
+ <object>
422
+
423
+ <name>navi_botton1</name>
424
+
425
+ <pose>Unspecified</pose>
426
+
427
+ <truncated>0</truncated>
428
+
429
+ <difficult>1</difficult>
430
+
431
+ <bndbox>
432
+
433
+ <xmin>2340</xmin>
434
+
435
+ <ymin>60</ymin>
436
+
437
+ <xmax>2480</xmax>
438
+
439
+ <ymax>120</ymax>
440
+
441
+ </bndbox>
442
+
443
+ </object>
444
+
445
+ <object>
446
+
447
+ <name>navi_botton2</name>
448
+
449
+ <pose>Unspecified</pose>
450
+
451
+ <truncated>0</truncated>
452
+
453
+ <difficult>1</difficult>
454
+
455
+ <bndbox>
456
+
457
+ <xmin>2660</xmin>
458
+
459
+ <ymin>0</ymin>
460
+
461
+ <xmax>2860</xmax>
462
+
463
+ <ymax>180</ymax>
464
+
465
+ </bndbox>
466
+
467
+ </object>
468
+
469
+ <object>
470
+
471
+ <name>eyecatch</name>
472
+
473
+ <pose>Unspecified</pose>
474
+
475
+ <truncated>0</truncated>
476
+
477
+ <difficult>1</difficult>
478
+
479
+ <bndbox>
480
+
481
+ <xmin>0</xmin>
482
+
483
+ <ymin>180</ymin>
484
+
485
+ <xmax>2880</xmax>
486
+
487
+ <ymax>740</ymax>
488
+
489
+ </bndbox>
490
+
491
+ </object>
492
+
493
+ </annotation>
494
+
495
+
496
+
497
+ ```
498
+
201
499
 
202
500
 
203
501
  ###やったこと
@@ -214,6 +512,14 @@
214
512
 
215
513
  他にも、[XML中に実体参照していない & がある場合、ElementTree.parse で失敗するが、文字列置換で強引に修復](https://qiita.com/ytyng/items/e8ca55028bb4e30df797)のような記事も目を通しましたが正直よく分かりませんでした。
216
514
 
515
+  
516
+
517
+
518
+
519
+ (追記)
520
+
521
+ [xmlファイルのエラーチェックができるサイト](https://www.xmlvalidation.com/)というものをご共有いただきましたので上で共有させて頂いたxmlファイルをエラーチェックしてみたところ、「No errors were found」と出力されたのでxmlファイル自体には問題なさそうです。
522
+
217
523
 
218
524
 
219
525
  ###環境