1 #include "FictionBook_chunks.h"
2
parse_fb2_function_book(APP * app,xmlNode * parent_node,GtkTextIter * text_buff_end)3 int parse_fb2_function_book(APP* app, xmlNode* parent_node, GtkTextIter* text_buff_end)
4 {
5 g_return_val_if_fail(parent_node != NULL, EXIT_FAILURE);
6 g_return_val_if_fail(text_buff_end != NULL, EXIT_FAILURE);
7
8 GtkTextBuffer* text_buff = app->text_buff;
9
10 xmlNode* node = parent_node->children;
11
12 //**************************************************************************
13
14 while(node != NULL)
15 {
16 if(node->type == XML_ELEMENT_NODE)
17 {
18 if(strcmp((char*)node->name, "binary") == 0)
19 parse_fb2_book_binary(app, node);
20 }
21
22 node = node->next;
23 }
24
25 //**************************************************************************
26
27 node = parent_node->children;
28
29 while(node != NULL)
30 {
31 if((node->type == XML_ELEMENT_NODE) && (strcmp((char*)node->name, "description") == 0))
32 {
33 parse_fb2_book_description(app, node, text_buff_end);
34 }
35
36 node = node->next;
37 }
38
39 //**************************************************************************
40
41 node = parent_node->children;
42
43 while(node != NULL)
44 {
45 if((node->type == XML_ELEMENT_NODE) && (strcmp((char*)node->name, "body") == 0))
46 {
47 parse_fb2_body(app, node, text_buff_end);
48
49 GtkTextIter text_buff_start;
50 gtk_text_buffer_get_start_iter(text_buff, &text_buff_start);
51 gtk_text_buffer_apply_tag_by_name(text_buff, "default_tag", &text_buff_start, text_buff_end);
52
53 }
54
55 node = node->next;
56 }
57
58 //**************************************************************************
59
60 printf(_C("End read book\n"));
61
62
63
64 return EXIT_SUCCESS;
65
66 }
67