|
|
Go to the documentation of this file.
9 else if (entity ==
"amp")
11 else if (entity ==
"lt")
13 else if (entity ==
"gt")
19 #ifdef SIMPLE_SAX_PARSER_DEBUG
20 static char *debug_states[] = {
"IN_DOCUMENT",
24 "IN_ELEMENT_WHITESPACE",
29 "IN_BEGIN_ATTRIBUTE_VALUE",
31 "IN_END_ATTRIBUTE_VALUE",
35 std::cerr << debug_states[state] << std::endl;
49 char stringDelims[] =
"\"&";
109 attributeValue.clear();
110 stringDelims[0] =
'\"';
113 attributeValue.clear();
114 stringDelims[0] =
'\'';
120 attributeValue +=
getToken(stringDelims);
124 Attribute attr(attributeName, attributeValue);
127 throw ParserError(
"Attribute " +
i->key +
" defined more than once");
130 }
else if (
skipChar(stringDelims[1]))
133 throw ParserError(
"Unexpected end of input at " + attributeValue);
151 throw ParserError(
"Non-matching closing element " +
tmp +
" for " + attributeValue);
228 if (*firstChar == EOF || (
int)separators[0] == *firstChar || strchr(separators + 1, *firstChar)) {
232 (*
buffer)[0] = (char)*firstChar;
252 if (separators[0] ==
c || strchr(separators + 1,
c)) {
258 (*buffer)[
i++] = (char)
c;
std::string getToken(const char *delim)
virtual void startElement(const std::string &, Attributes &)
virtual void data(const std::string &)
virtual void endElement(const std::string &)
std::vector< std::string > m_elementTags
std::string parseEntity(const std::string &entity)
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
void debug_state_machine(enum SimpleSAXParser::PARSER_STATES state)
virtual ~SimpleSAXParser()
bool fgettoken(std::istream &in, char **buffer, size_t *maxSize, const char *separators, int *firstChar)