@@ -431,67 +431,72 @@ void VerifyXML(const std::string& xml_text,
431
431
432
432
if (name == " Decorator" )
433
433
{
434
- if (children_count != 1 )
435
- {
436
- ThrowError (line_number, " The tag <Decorator> must have exactly 1 "
437
- " child" );
438
- }
439
434
if (ID.empty ())
440
435
{
441
436
ThrowError (line_number, " The tag <Decorator> must have the "
442
437
" attribute [ID]" );
443
438
}
439
+ if (children_count != 1 )
440
+ {
441
+ ThrowError (line_number, " The tag <Decorator> with ID '" + ID +
442
+ " ' must have exactly 1 "
443
+ " child" );
444
+ }
444
445
}
445
446
else if (name == " Action" )
446
447
{
447
- if (children_count != 0 )
448
- {
449
- ThrowError (line_number, " The tag <Action> must not have any "
450
- " child" );
451
- }
452
448
if (ID.empty ())
453
449
{
454
450
ThrowError (line_number, " The tag <Action> must have the "
455
451
" attribute [ID]" );
456
452
}
457
- }
458
- else if (name == " Condition" )
459
- {
460
453
if (children_count != 0 )
461
454
{
462
- ThrowError (line_number, " The tag <Condition> must not have any "
463
- " child" );
455
+ ThrowError (line_number, " The tag <Action> with ID '" + ID +
456
+ " ' must not have any "
457
+ " child" );
464
458
}
459
+ }
460
+ else if (name == " Condition" )
461
+ {
465
462
if (ID.empty ())
466
463
{
467
464
ThrowError (line_number, " The tag <Condition> must have the "
468
465
" attribute [ID]" );
469
466
}
467
+ if (children_count != 0 )
468
+ {
469
+ ThrowError (line_number, " The tag <Condition> with ID '" + ID +
470
+ " ' must not have any "
471
+ " child" );
472
+ }
470
473
}
471
474
else if (name == " Control" )
472
475
{
473
- if (children_count == 0 )
474
- {
475
- ThrowError (line_number, " The tag <Control> must have at least 1 "
476
- " child" );
477
- }
478
476
if (ID.empty ())
479
477
{
480
478
ThrowError (line_number, " The tag <Control> must have the "
481
479
" attribute [ID]" );
482
480
}
481
+ if (children_count == 0 )
482
+ {
483
+ ThrowError (line_number, " The tag <Control> with ID '" + ID +
484
+ " ' must have at least 1 "
485
+ " child" );
486
+ }
483
487
}
484
488
else if (name == " SubTree" )
485
489
{
486
- if (children_count != 0 )
487
- {
488
- ThrowError (line_number, " <SubTree> should not have any child" );
489
- }
490
490
if (ID.empty ())
491
491
{
492
492
ThrowError (line_number, " The tag <SubTree> must have the "
493
493
" attribute [ID]" );
494
494
}
495
+ if (children_count != 0 )
496
+ {
497
+ ThrowError (line_number,
498
+ " <SubTree> with ID '" + ID + " ' should not have any child" );
499
+ }
495
500
if (registered_nodes.count (ID) != 0 )
496
501
{
497
502
ThrowError (line_number, " The attribute [ID] of tag <SubTree> must "
@@ -505,16 +510,17 @@ void VerifyXML(const std::string& xml_text,
505
510
ThrowError (line_number, " The tag <BehaviorTree> must have the "
506
511
" attribute [ID]" );
507
512
}
508
- if (children_count != 1 )
509
- {
510
- ThrowError (line_number, " The tag <BehaviorTree> must have exactly 1 "
511
- " child" );
512
- }
513
513
if (registered_nodes.count (ID) != 0 )
514
514
{
515
515
ThrowError (line_number, " The attribute [ID] of tag <BehaviorTree> "
516
516
" must not use the name of a registered Node" );
517
517
}
518
+ if (children_count != 1 )
519
+ {
520
+ ThrowError (line_number, " The tag <BehaviorTree> with ID '" + ID +
521
+ " ' must have exactly 1 "
522
+ " child" );
523
+ }
518
524
}
519
525
else
520
526
{
@@ -530,16 +536,16 @@ void VerifyXML(const std::string& xml_text,
530
536
{
531
537
if (children_count != 1 )
532
538
{
533
- ThrowError (line_number,
534
- std::string ( " The node < " ) + name + " > must have exactly 1 child" );
539
+ ThrowError (line_number, std::string ( " The node < " ) + name + " > with ID ' " + ID +
540
+ " ' must have exactly 1 child" );
535
541
}
536
542
}
537
543
else if (search->second == NodeType::CONTROL)
538
544
{
539
545
if (children_count == 0 )
540
546
{
541
- ThrowError (line_number,
542
- std::string ( " The node < " ) + name + " > must have 1 or more children" );
547
+ ThrowError (line_number, std::string ( " The node < " ) + name + " > with ID ' " + ID +
548
+ " ' must have 1 or more children" );
543
549
}
544
550
if (name == " ReactiveSequence" )
545
551
{
@@ -563,7 +569,8 @@ void VerifyXML(const std::string& xml_text,
563
569
++async_count;
564
570
if (async_count > 1 )
565
571
{
566
- ThrowError (line_number, std::string (" A ReactiveSequence cannot have more "
572
+ ThrowError (line_number, std::string (" A ReactiveSequence with ID '" + ID +
573
+ " ' cannot have more "
567
574
" than one async child." ));
568
575
}
569
576
}
0 commit comments