@@ -932,10 +932,6 @@ std::string getModelFilePath(const std::string &_modelDirPath)
932
932
bool readXml (tinyxml2::XMLElement *_xml, ElementPtr _sdf,
933
933
const ParserConfig &_config, const std::string &_source, Errors &_errors)
934
934
{
935
- std::string sourcePath = _source;
936
- if (_source == kSdfStringSource || _source == kUrdfStringSource )
937
- sourcePath = " <" + _source + " >" ;
938
-
939
935
// Check if the element pointer is deprecated.
940
936
if (_sdf->GetRequired () == " -1" )
941
937
{
@@ -954,7 +950,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
954
950
_errors.push_back ({
955
951
ErrorCode::ELEMENT_MISSING,
956
952
" SDF Element<" + _sdf->GetName () + " > is missing" ,
957
- sourcePath });
953
+ _source });
958
954
return false ;
959
955
}
960
956
else
@@ -1028,7 +1024,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1028
1024
" '" + std::string (attribute->Value ()) +
1029
1025
" ' is reserved; it cannot be used as a value of "
1030
1026
" attribute [" + p->GetKey () + " ]" ,
1031
- sourcePath ,
1027
+ _source ,
1032
1028
attribute->GetLineNum ()});
1033
1029
}
1034
1030
}
@@ -1038,7 +1034,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1038
1034
_errors.push_back ({
1039
1035
ErrorCode::ATTRIBUTE_INVALID,
1040
1036
" Unable to read attribute[" + p->GetKey () + " ]" ,
1041
- sourcePath ,
1037
+ _source ,
1042
1038
attribute->GetLineNum ()});
1043
1039
return false ;
1044
1040
}
@@ -1057,7 +1053,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1057
1053
Error (
1058
1054
ErrorCode::ATTRIBUTE_INCORRECT_TYPE,
1059
1055
ss.str (),
1060
- sourcePath ,
1056
+ _source ,
1061
1057
_xml->GetLineNum ()),
1062
1058
_errors);
1063
1059
}
@@ -1075,7 +1071,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1075
1071
ErrorCode::ATTRIBUTE_MISSING,
1076
1072
" Required attribute[" + p->GetKey () + " ] in element[" + _xml->Value ()
1077
1073
+ " ] is not specified in SDF." ,
1078
- sourcePath ,
1074
+ _source ,
1079
1075
_xml->GetLineNum ()});
1080
1076
return false ;
1081
1077
}
@@ -1111,7 +1107,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1111
1107
_errors.push_back ({
1112
1108
ErrorCode::URI_LOOKUP,
1113
1109
" Unable to find uri[" + uri + " ]" ,
1114
- sourcePath ,
1110
+ _source ,
1115
1111
uriElement->GetLineNum ()});
1116
1112
continue ;
1117
1113
}
@@ -1129,7 +1125,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1129
1125
" Unable to resolve uri[" + uri + " ] to model path [" +
1130
1126
modelPath + " ] since it does not contain a model.config " +
1131
1127
" file." ,
1132
- sourcePath ,
1128
+ _source ,
1133
1129
uriElement->GetLineNum ()});
1134
1130
continue ;
1135
1131
}
@@ -1148,7 +1144,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1148
1144
_errors.push_back ({
1149
1145
ErrorCode::ATTRIBUTE_MISSING,
1150
1146
" <include> element missing 'uri' attribute" ,
1151
- sourcePath ,
1147
+ _source ,
1152
1148
elemXml->GetLineNum ()});
1153
1149
continue ;
1154
1150
}
@@ -1177,7 +1173,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1177
1173
_errors.push_back ({
1178
1174
ErrorCode::FILE_READ,
1179
1175
" Unable to read file[" + filename + " ]" ,
1180
- sourcePath ,
1176
+ _source ,
1181
1177
uriElement->GetLineNum ()});
1182
1178
return false ;
1183
1179
}
@@ -1219,7 +1215,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1219
1215
ErrorCode::ELEMENT_MISSING,
1220
1216
" Failed to find top level <model> / <actor> / <light> for "
1221
1217
" <include>\n " ,
1222
- sourcePath ,
1218
+ _source ,
1223
1219
uriElement->GetLineNum ()});
1224
1220
continue ;
1225
1221
}
@@ -1294,7 +1290,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1294
1290
ErrorCode::MODEL_PLACEMENT_FRAME_INVALID,
1295
1291
" <pose> is required when specifying the placement_frame "
1296
1292
" element" ,
1297
- sourcePath ,
1293
+ _source ,
1298
1294
elemXml->GetLineNum ()});
1299
1295
return false ;
1300
1296
}
@@ -1308,7 +1304,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1308
1304
" '" + placementFrameVal +
1309
1305
" ' is reserved; it cannot be used as a value of "
1310
1306
" element [placement_frame]" ,
1311
- sourcePath ,
1307
+ _source ,
1312
1308
placementFrameElem->GetLineNum ()});
1313
1309
}
1314
1310
topLevelElem->GetAttribute (" placement_frame" )
@@ -1327,12 +1323,12 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1327
1323
pluginElem = topLevelElem->AddElement (" plugin" );
1328
1324
1329
1325
if (!readXml (
1330
- childElemXml, pluginElem, _config, sourcePath , _errors))
1326
+ childElemXml, pluginElem, _config, _source , _errors))
1331
1327
{
1332
1328
_errors.push_back ({
1333
1329
ErrorCode::ELEMENT_INVALID,
1334
1330
" Error reading plugin element" ,
1335
- sourcePath ,
1331
+ _source ,
1336
1332
childElemXml->GetLineNum ()});
1337
1333
return false ;
1338
1334
}
@@ -1367,7 +1363,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1367
1363
{
1368
1364
ElementPtr element = elemDesc->Clone ();
1369
1365
element->SetParent (_sdf);
1370
- if (readXml (elemXml, element, _config, sourcePath , _errors))
1366
+ if (readXml (elemXml, element, _config, _source , _errors))
1371
1367
{
1372
1368
_sdf->InsertElement (element);
1373
1369
}
@@ -1377,7 +1373,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1377
1373
ErrorCode::ELEMENT_INVALID,
1378
1374
std::string (" Error reading element <" ) +
1379
1375
elemXml->Value () + " >" ,
1380
- sourcePath ,
1376
+ _source ,
1381
1377
elemXml->GetLineNum ()});
1382
1378
return false ;
1383
1379
}
@@ -1399,7 +1395,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1399
1395
Error (
1400
1396
ErrorCode::ELEMENT_INCORRECT_TYPE,
1401
1397
ss.str (),
1402
- sourcePath ,
1398
+ _source ,
1403
1399
elemXml->GetLineNum ()),
1404
1400
_errors);
1405
1401
@@ -1427,7 +1423,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
1427
1423
ErrorCode::ELEMENT_MISSING,
1428
1424
" XML Missing required element[" + elemDesc->GetName () +
1429
1425
" ], child of element[" + _sdf->GetName () + " ]" ,
1430
- sourcePath ,
1426
+ _source ,
1431
1427
elemXml->GetLineNum ()});
1432
1428
return false ;
1433
1429
}
0 commit comments