Exemplo n.º 1
0
void xml_stream_parser::parse()
{
    if (!mp_handler)
        return;

    sax_token_parser<xml_stream_handler, tokens> sax(m_content, m_size, m_tokens, m_ns_cxt, *mp_handler);
    sax.parse();
}
Exemplo n.º 2
0
Arquivo: Vpz.cpp Projeto: SJasson/vle
std::vector < value::Value* > Vpz::parseValues(const std::string& buffer)
{
    Vpz vpz;
    SaxParser sax(vpz);
    sax.parseMemory(buffer);

    if (not sax.isValue()) {
        throw utils::ArgError(fmt(_("The buffer [%1%] is not a value.")) %
                              buffer);
    }

    return sax.getValues();
}
Exemplo n.º 3
0
int main(int argc, char **argv) {

  SaxQuantizer::Sax sax(6, 1, 5);
  vector<double> input = { 1, 1, 1, 1, 2, 2, 10, 10, 100 };
  vector<int> output;
  sax.quantize(input, &output, false); // true for reduction

  std::string delim = "";
  std::cout << "input: ";
  for (auto x : input) {
    std::cout << delim << x;
    delim = ", ";
  }
  std::cout << std::endl;

  delim = "";
  std::cout << "output: ";
  for (auto x : output) {
    std::cout << delim << x;
    delim = ", ";
  }
  std::cout << std::endl;

}