@@ -1082,6 +1082,8 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
1082
1082
TIXML_STRING endTag (" </" );
1083
1083
endTag += value;
1084
1084
1085
+ static const bool skip_errors = pSettings->line_exist (" features" , " skip_shoc_xml_errors" ) && pSettings->r_bool (" features" , " skip_shoc_xml_errors" );
1086
+
1085
1087
// Check for and read attributes. Also look for an empty
1086
1088
// tag or an end tag.
1087
1089
while ( p && *p )
@@ -1112,21 +1114,28 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
1112
1114
++p;
1113
1115
p = ReadValue ( p, data, encoding ); // Note this is an Element method, and will set the error if one happens.
1114
1116
if (!p || !*p) {
1115
- if (document) document->SetError (TIXML_ERROR_READING_END_TAG, p, data, encoding);
1117
+ if (!skip_errors && document)
1118
+ document->SetError (TIXML_ERROR_READING_END_TAG, p, data, encoding);
1116
1119
return 0 ;
1117
1120
}
1118
1121
1119
1122
// We should find the end tag now
1120
1123
if ( StringEqual ( p, endTag.c_str (), false , encoding ) )
1121
1124
{
1122
1125
p += endTag.length ();
1126
+ const char * old_p = p;
1123
1127
p = SkipWhiteSpace ( p, encoding );
1124
1128
if ( p && *p && *p == ' >' ) {
1125
1129
++p;
1126
1130
return p;
1127
1131
}
1128
- if ( document ) document->SetError ( TIXML_ERROR_READING_END_TAG, p, data, encoding );
1129
- return 0 ;
1132
+
1133
+ if (!skip_errors && document) {
1134
+ document->SetError (TIXML_ERROR_READING_END_TAG, p, data, encoding);
1135
+ return 0 ;
1136
+ }
1137
+ else
1138
+ return old_p;
1130
1139
}
1131
1140
else
1132
1141
{
@@ -1163,7 +1172,10 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
1163
1172
#endif
1164
1173
if ( node )
1165
1174
{
1166
- if ( document ) document->SetError ( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
1175
+ if (!skip_errors && document)
1176
+ document->SetError ( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
1177
+ else
1178
+ node->SetValue (attrib->Value ());
1167
1179
xr_delete (attrib);
1168
1180
return 0 ;
1169
1181
}
0 commit comments