playlist/asx: add State::TAG
This commit is contained in:
parent
c71242d743
commit
33694642bd
|
@ -42,6 +42,7 @@ struct AsxParser {
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
ROOT, ENTRY,
|
ROOT, ENTRY,
|
||||||
|
TAG,
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +83,6 @@ asx_start_element(void *user_data, const XML_Char *element_name,
|
||||||
if (StringEqualsCaseASCII(element_name, "entry")) {
|
if (StringEqualsCaseASCII(element_name, "entry")) {
|
||||||
parser->state = AsxParser::ENTRY;
|
parser->state = AsxParser::ENTRY;
|
||||||
parser->location.clear();
|
parser->location.clear();
|
||||||
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -93,11 +93,17 @@ asx_start_element(void *user_data, const XML_Char *element_name,
|
||||||
ExpatParser::GetAttributeCase(atts, "href");
|
ExpatParser::GetAttributeCase(atts, "href");
|
||||||
if (href != nullptr)
|
if (href != nullptr)
|
||||||
parser->location = href;
|
parser->location = href;
|
||||||
} else
|
} else {
|
||||||
parser->tag_type = tag_table_lookup_i(asx_tag_elements,
|
parser->tag_type = tag_table_lookup_i(asx_tag_elements,
|
||||||
element_name);
|
element_name);
|
||||||
|
if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
|
||||||
|
parser->state = AsxParser::TAG;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AsxParser::TAG:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,10 +123,13 @@ asx_end_element(void *user_data, const XML_Char *element_name)
|
||||||
parser->tag_builder.Commit());
|
parser->tag_builder.Commit());
|
||||||
|
|
||||||
parser->state = AsxParser::ROOT;
|
parser->state = AsxParser::ROOT;
|
||||||
} else
|
}
|
||||||
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AsxParser::TAG:
|
||||||
|
parser->state = AsxParser::ENTRY;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,13 +140,12 @@ asx_char_data(void *user_data, const XML_Char *s, int len)
|
||||||
|
|
||||||
switch (parser->state) {
|
switch (parser->state) {
|
||||||
case AsxParser::ROOT:
|
case AsxParser::ROOT:
|
||||||
|
case AsxParser::ENTRY:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AsxParser::ENTRY:
|
case AsxParser::TAG:
|
||||||
if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
|
parser->tag_builder.AddItem(parser->tag_type,
|
||||||
parser->tag_builder.AddItem(parser->tag_type,
|
StringView(s, len));
|
||||||
StringView(s, len));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue