コード例 #1
0
ファイル: xml_map_sax_handler.cpp プロジェクト: jvsg/orcus
void read_map_file(orcus_xml& app, const char* filepath)
{
    string strm = load_file_content(filepath);
    if (strm.empty())
        return;

    xml_map_sax_handler handler(app);
    sax_parser<xml_map_sax_handler> parser(strm.c_str(), strm.size(), handler);
    parser.parse();
}
コード例 #2
0
int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path){
	int status = -1;
	char* provisioning=load_file_content(file_path);

	if (provisioning){
		linphone_remote_provisioning_apply(lc, provisioning);
		status = 0;
		ms_free(provisioning);
	}
	return status;
}
コード例 #3
0
ファイル: orcus_xls_xml.cpp プロジェクト: jvsg/orcus
void orcus_xls_xml::read_file(const string& filepath)
{
#if ORCUS_DEBUG_XLS_XML_FILTER
    cout << "reading " << filepath << endl;
#endif

    string strm = load_file_content(filepath.c_str());
    if (strm.empty())
        return;

    read_stream(&strm[0], strm.size());
}
コード例 #4
0
ファイル: orcus_xml.cpp プロジェクト: Distrotech/liborcus
void orcus_xml::read_file(const char* filepath)
{
#if ORCUS_DEBUG_XML
    cout << "reading file " << filepath << endl;
#endif
    string& strm = mp_impl->m_data_strm;
    load_file_content(filepath, strm);
    if (strm.empty())
        return;

    // Insert the range headers and reset the row size counters.
    xml_map_tree::range_ref_map_type& range_refs = mp_impl->m_map_tree.get_range_references();
    xml_map_tree::range_ref_map_type::iterator it_ref = range_refs.begin(), it_ref_end = range_refs.end();
    for (; it_ref != it_ref_end; ++it_ref)
    {
        const xml_map_tree::cell_position& ref = it_ref->first;
        xml_map_tree::range_reference& range_ref = *it_ref->second;
        range_ref.row_size = 0; // Reset the row offset.

        spreadsheet::iface::import_sheet* sheet =
            mp_impl->mp_import_factory->get_sheet(ref.sheet.get(), ref.sheet.size());

        if (!sheet)
            continue;

        xml_map_tree::const_linkable_list_type::const_iterator it = range_ref.field_nodes.begin(), it_end = range_ref.field_nodes.end();
        spreadsheet::row_t row = ref.row;
        spreadsheet::col_t col = ref.col;
        for (; it != it_end; ++it)
        {
            const xml_map_tree::linkable& e = **it;
            ostringstream os;
            if (e.ns)
                os << mp_impl->m_ns_repo.get_short_name(e.ns) << ':';
            os << e.name;
            string s = os.str();
            if (!s.empty())
                sheet->set_auto(row, col++, &s[0], s.size());
        }
    }

    // Parse the content xml.
    xmlns_context ns_cxt = mp_impl->m_ns_repo.create_context(); // new ns context for the content xml stream.
    xml_data_sax_handler handler(
       *mp_impl->mp_import_factory, mp_impl->m_link_positions, mp_impl->m_map_tree);

    sax_ns_parser<xml_data_sax_handler> parser(strm.c_str(), strm.size(), ns_cxt, handler);
    parser.parse();
}
コード例 #5
0
void orcus_xls_xml::read_file(const char* fpath)
{
#if ORCUS_DEBUG_XLS_XML_FILTER
    cout << "reading " << fpath << endl;
#endif

    string strm;
    load_file_content(fpath, strm);
    if (strm.empty())
        return;

    xml_stream_parser parser(mp_impl->m_ns_repo, xls_xml_tokens, &strm[0], strm.size(), "content");
    boost::scoped_ptr<xls_xml_handler> handler(
        new xls_xml_handler(mp_impl->m_cxt, xls_xml_tokens, mp_impl->mp_factory));
    parser.set_handler(handler.get());
    parser.parse();
}