Пример #1
0
object hydrator::read_object() {
    validate_current_element(dia_object);
    object object;

    object.type(read_xml_string_attribute(dia_type));
    object.version(read_xml_int_attribute(dia_version));
    object.id(read_xml_string_attribute(dia_id));
    BOOST_LOG_SEV(lg, debug) << "Reading object: '" << object.id()
                             << "' of type: " << object.type();

    if (!reader_.read()) {
        BOOST_LOG_SEV(lg, error) << unexpected_eod;
        BOOST_THROW_EXCEPTION(hydration_error(unexpected_eod));
    }

    std::vector<attribute> attributes;
    do {
        if (is_start_element(dia_attribute))
            attributes.push_back(read_attribute());
        else if (is_start_element(dia_child_node))
            object.child_node(read_child_node());
        else if (is_start_element(dia_connections)) {
            object.connections(read_connections());
        } else {
            BOOST_LOG_SEV(lg, warn) << "Skipping element: '" << reader_.name();
            reader_.skip();
        }
    } while (!is_end_element(dia_object));

    reader_.read();
    object.attributes(attributes);

    BOOST_LOG_SEV(lg, debug) << "Read object: " << object.id();
    return object;
}
Пример #2
0
static inline void
fill_info_from_node (GWeatherInfo *info,
		     xmlNodePtr    node)
{
    xmlNodePtr child;

    for (child = node->children; child != NULL; child = child->next) {
	if (child->type == XML_ELEMENT_NODE)
	    read_child_node (info, child);
    }
}