remove depth of nested block
This commit is contained in:
parent
4bc8562cd0
commit
afd3599a9c
@ -93,11 +93,15 @@ bool XMLParser::Parse()
|
||||
|
||||
InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
{
|
||||
InputRestrictionContainer restriction;
|
||||
std::string except_tag_string;
|
||||
|
||||
if (xmlTextReaderIsEmptyElement(inputReader) != 1)
|
||||
InputRestrictionContainer restriction;
|
||||
|
||||
if (xmlTextReaderIsEmptyElement(inputReader) == 1)
|
||||
{
|
||||
return restriction;
|
||||
}
|
||||
|
||||
std::string except_tag_string;
|
||||
const int depth = xmlTextReaderDepth(inputReader);
|
||||
while (xmlTextReaderRead(inputReader) == 1)
|
||||
{
|
||||
@ -106,25 +110,25 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const int childDepth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *childName = xmlTextReaderName(inputReader);
|
||||
if (childName == NULL)
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (depth == childDepth && child_type == 15 &&
|
||||
xmlStrEqual(childName, (const xmlChar *)"relation") == 1)
|
||||
if (depth == child_depth && child_type == 15 &&
|
||||
xmlStrEqual(child_name, (const xmlChar *)"relation") == 1)
|
||||
{
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
break;
|
||||
}
|
||||
if (child_type != 1)
|
||||
{
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (xmlStrEqual(childName, (const xmlChar *)"tag") == 1)
|
||||
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
|
||||
{
|
||||
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
@ -150,7 +154,7 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
xmlFree(value);
|
||||
}
|
||||
}
|
||||
else if (xmlStrEqual(childName, (const xmlChar *)"member") == 1)
|
||||
else if (xmlStrEqual(child_name, (const xmlChar *)"member") == 1)
|
||||
{
|
||||
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
|
||||
if (ref != NULL)
|
||||
@ -188,10 +192,10 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlFree(childName);
|
||||
}
|
||||
xmlFree(child_name);
|
||||
}
|
||||
|
||||
|
||||
if (ShouldIgnoreRestriction(except_tag_string))
|
||||
{
|
||||
restriction.fromWay = UINT_MAX; // workaround to ignore the restriction
|
||||
@ -214,29 +218,29 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const int childDepth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *childName = xmlTextReaderName(inputReader);
|
||||
if (childName == NULL)
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (depth == childDepth && child_type == 15 &&
|
||||
xmlStrEqual(childName, (const xmlChar *)"way") == 1)
|
||||
if (depth == child_depth && child_type == 15 &&
|
||||
xmlStrEqual(child_name, (const xmlChar *)"way") == 1)
|
||||
{
|
||||
xmlChar *id = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
|
||||
way.id = stringToUint((char *)id);
|
||||
xmlFree(id);
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
break;
|
||||
}
|
||||
if (child_type != 1)
|
||||
{
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (xmlStrEqual(childName, (const xmlChar *)"tag") == 1)
|
||||
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
|
||||
{
|
||||
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
@ -254,7 +258,7 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
xmlFree(value);
|
||||
}
|
||||
}
|
||||
else if (xmlStrEqual(childName, (const xmlChar *)"nd") == 1)
|
||||
else if (xmlStrEqual(child_name, (const xmlChar *)"nd") == 1)
|
||||
{
|
||||
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
|
||||
if (ref != NULL)
|
||||
@ -263,7 +267,7 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
xmlFree(ref);
|
||||
}
|
||||
}
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
}
|
||||
return way;
|
||||
}
|
||||
@ -304,26 +308,26 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const int childDepth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *childName = xmlTextReaderName(inputReader);
|
||||
if (childName == NULL)
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (depth == childDepth && child_type == 15 &&
|
||||
xmlStrEqual(childName, (const xmlChar *)"node") == 1)
|
||||
if (depth == child_depth && child_type == 15 &&
|
||||
xmlStrEqual(child_name, (const xmlChar *)"node") == 1)
|
||||
{
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
break;
|
||||
}
|
||||
if (child_type != 1)
|
||||
{
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (xmlStrEqual(childName, (const xmlChar *)"tag") == 1)
|
||||
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
|
||||
{
|
||||
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
@ -341,7 +345,7 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
}
|
||||
}
|
||||
|
||||
xmlFree(childName);
|
||||
xmlFree(child_name);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user