Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

mlview-parsing-utils.c File Reference

#include <string.h>
#include <libxml/parser.h>
#include <libxml/catalog.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlmemory.h>
#include <libxml/SAX.h>
#include <libxml/xmlerror.h>
#include <libxml/uri.h>
#include <libxml/hash.h>
#include "utils.h"
#include "mlview-parsing-utils.h"
#include "mlview-global-settings.h"
#include "mlview-file-descriptor.h"

Go to the source code of this file.

Data Structures

struct  _MlViewCustomParserContext
 A custom xmlParserContext where we can store the mlview app context also. More...


Typedefs

typedef _MlViewCustomParserContext MlViewCustomParserContext

Functions

MlViewExternalSubsetDefinitionmlview_external_subset_definition_new (const gchar *a_root_element_name, const gchar *a_external_id, const gchar *a_system_id)
 creates a new MlViewExternalSubsetDefinition.

void mlview_external_subset_definition_destroy (MlViewExternalSubsetDefinition *a_def)
 destroys the MlViewExternalSubsetDefinition given in argument.

xmlDoc * mlview_parsing_utils_load_xml_file (gchar *a_file_name, MlViewAppContext *a_app_context)
gint mlview_parsing_utils_save_xml_doc (xmlDoc *a_xml_doc, gchar *a_file_path, MlViewAppContext *a_app_context)
 Saves an xml file using the application wide settings.

xmlDtd * mlview_parsing_utils_load_a_dtd (MlViewExternalSubsetDefinition *a_subset_def, MlViewAppContext *a_app_context)
gint mlview_parsing_utils_validate_dtd (xmlDoc *a_doc, xmlDtd *a_dtd, MlViewAppContext *a_app_context)
MlViewExternalSubsetDefinitionmlview_utils_get_a_copy_of_last_external_subset_def (void)
 found during the parsing of the last xml document if and only if the parsing has been triggered by calling the function mlview_parsing_utils_load_xml_file(gchar * a_file_name).

MlViewExternalSubsetDefinitionmlview_parsing_utils_let_user_choose_a_dtd (MlViewAppContext *a_app_context, gchar *a_title)
gint mlview_parsing_utils_build_element_name_completion_list (MlViewAppContext *a_app_context, enum NODE_INSERTION_SCHEME a_insertion_scheme, xmlNode *a_current_xml_node, GList **a_feasible_names_ptr)
 Builds the list of the feasible element name that can be inserted before/after/beneath/ the current node.

gint mlview_parsing_utils_build_attribute_name_completion_list (MlViewAppContext *a_app_context, xmlNode *a_current_xml_node, GList **a_attr_names_compl_list, gboolean a_required_attributes_only)
enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_get_element_content_table (MlViewAppContext *a_app_context, xmlElementContent *a_element_content, GHashTable **a_element_content_table)
enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_build_required_attributes_list (MlViewAppContext *a_app_context, xmlNode *a_node)
 Given an xml node (a_node), builds the required attributes list of that node.

enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_build_required_children_tree (MlViewAppContext *a_app_context, xmlNode **a_node)
 Given an xml node, this method builds the subtree of this node that is required by the schema (or by the DTD) Return.

GList * mlview_parsing_utils_build_attribute_value_set (MlViewAppContext *a_app_context, xmlAttribute *a_attribute_desc, gint *a_last_id)
GList * mlview_parsing_utils_build_graphical_attribute_value_set (MlViewAppContext *a_app_context, xmlAttribute *a_attribute_desc, gint *a_last_id)

Variables

int xmlDoValidityCheckingDefaultValue


Typedef Documentation

typedef struct _MlViewCustomParserContext MlViewCustomParserContext
 

Definition at line 58 of file mlview-parsing-utils.c.


Function Documentation

void mlview_external_subset_definition_destroy MlViewExternalSubsetDefinition   a_def
 

destroys the MlViewExternalSubsetDefinition given in argument.

Definition at line 184 of file mlview-parsing-utils.c.

References _MlViewExternalSubsetDefinition::external_id, _MlViewExternalSubsetDefinition::root_element_name, and _MlViewExternalSubsetDefinition::system_id.

Referenced by mlview_utils_get_a_copy_of_last_external_subset_def().

MlViewExternalSubsetDefinition* mlview_external_subset_definition_new const gchar *    a_root_element_name,
const gchar *    a_external_id,
const gchar *    a_system_id
 

creates a new MlViewExternalSubsetDefinition.

Definition at line 144 of file mlview-parsing-utils.c.

References _MlViewExternalSubsetDefinition::external_id, _MlViewExternalSubsetDefinition::root_element_name, and _MlViewExternalSubsetDefinition::system_id.

Referenced by mlview_parsing_utils_let_user_choose_a_dtd().

gint mlview_parsing_utils_build_attribute_name_completion_list MlViewAppContext   a_app_context,
xmlNode *    a_current_xml_node,
GList **    a_attr_names_compl_list,
gboolean    a_required_attributes_only
 

Parameters:
a_current_xml_node  the current xml node
a_attr_names_compl_list  out parameter. The attribute names completion list.
a_app_context  the current context of the mlview application.

Definition at line 1365 of file mlview-parsing-utils.c.

References mlview_app_context_get_settings_value(), mlview_app_context_settings_exist(), and MLVIEW_IS_APP_CONTEXT.

Referenced by mlview_attribute_picker_build_attribute_name_choice_list(), and mlview_parsing_utils_build_required_attributes_list().

GList* mlview_parsing_utils_build_attribute_value_set MlViewAppContext   a_app_context,
xmlAttribute *    a_attribute_desc,
gint *    a_last_id
 

Parameters:
a_last_id  a pointer to the number part of the last id generated. This is used only if thecurrent attribute is an id or an idref. The function then updates the pointed integer to the new last id value generated.
a_attribute_desc  the attribute description.
a_app_context  the application context.
Returns:
a list of GtkListItem to be put into the GtkList widget.

Definition at line 1703 of file mlview-parsing-utils.c.

References MLVIEW_IS_APP_CONTEXT.

Referenced by mlview_parsing_utils_build_graphical_attribute_value_set(), and mlview_parsing_utils_build_required_attributes_list().

gint mlview_parsing_utils_build_element_name_completion_list MlViewAppContext   a_app_context,
enum NODE_INSERTION_SCHEME    a_insertion_scheme,
xmlNode *    a_current_xml_node,
GList **    a_feasible_names_ptr
 

Builds the list of the feasible element name that can be inserted before/after/beneath/ the current node.

and -2 if some bad parameter have been passed to this function.

Parameters:
a_current_xml_node  the reference node.
a_feasible_names  output parameter. A pointer to the output element completion name list.
a_insertion_scheme  how you want to insert a node relatively to the @a_current_xml_node.
a_app_context  the current mlview application context.

Definition at line 1242 of file mlview-parsing-utils.c.

References ADD_CHILD, INSERT_AFTER, INSERT_BEFORE, mlview_app_context_get_settings_value(), mlview_app_context_settings_exist(), NODE_INSERTION_SCHEME, and xmlValidGetValidElementsChildren().

Referenced by mvliew_node_type_picker_build_element_name_choice_list().

GList* mlview_parsing_utils_build_graphical_attribute_value_set MlViewAppContext   a_app_context,
xmlAttribute *    a_attribute_desc,
gint *    a_last_id
 

Parameters:
a_last_id  a pointer to the number part of the last id generated. This is used only if thecurrent attribute is an id or an idref. The function then updates the pointed integer to the new last id value generated.
a_attribute_desc  the attribute description.
a_app_context  the application context.
Returns:
a list of GtkListItem to be put into the GtkList widget.

Definition at line 1799 of file mlview-parsing-utils.c.

References MLVIEW_IS_APP_CONTEXT, and mlview_parsing_utils_build_attribute_value_set().

enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_build_required_attributes_list MlViewAppContext   a_app_context,
xmlNode *    a_node
 

Given an xml node (a_node), builds the required attributes list of that node.

Parameters:
a_node  the node to add the attributes to.
a_app_context  the current application context.

Definition at line 1512 of file mlview-parsing-utils.c.

References APP_SETTINGS_NOT_AVAILABLE, BAD_PARAMETER, mlview_app_context_get_last_id_ptr(), mlview_app_context_get_settings_value(), mlview_app_context_settings_exist(), MLVIEW_IS_APP_CONTEXT, mlview_parsing_utils_build_attribute_name_completion_list(), mlview_parsing_utils_build_attribute_value_set(), MLVIEW_PARSING_UTILS_STATUS, NOK, OK, and VALIDATION_IS_OFF.

Referenced by mlview_parsing_utils_build_required_children_tree(), mlview_xml_document_add_child_node(), mlview_xml_document_insert_next_sibling_node(), and mlview_xml_document_insert_prev_sibling_node().

enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_build_required_children_tree MlViewAppContext   a_app_context,
xmlNode **    a_node
 

Given an xml node, this method builds the subtree of this node that is required by the schema (or by the DTD) Return.

Parameters:
a_node  the node to consider.
a_app_context  the current instance of application context.

Definition at line 1622 of file mlview-parsing-utils.c.

References APP_SETTINGS_NOT_AVAILABLE, BAD_PARAMETER, ELEMENT_DESC_NOT_FOUND, mlview_app_context_get_settings_value(), mlview_app_context_settings_exist(), MLVIEW_IS_APP_CONTEXT, mlview_parsing_utils_build_required_attributes_list(), MLVIEW_PARSING_UTILS_STATUS, NOK, OK, and VALIDATION_IS_OFF.

Referenced by mlview_xml_document_add_child_node(), mlview_xml_document_insert_next_sibling_node(), and mlview_xml_document_insert_prev_sibling_node().

enum MLVIEW_PARSING_UTILS_STATUS mlview_parsing_utils_get_element_content_table MlViewAppContext   a_app_context,
xmlElementContent *    a_element_content,
GHashTable **    a_element_content_table
 

Parameters:
a_element_content  the element declaration content from the dtd.
a_children_table  out parameter. The children table. This parameter is valid if and only
a_app_context  the current application context.
Returns:
OK if everthing went well, the error code if not.

Definition at line 1440 of file mlview-parsing-utils.c.

References BAD_PARAMETER, GENERIC_ASSERTION_ERROR, mlview_app_context_get_settings_value(), MLVIEW_IS_APP_CONTEXT, MLVIEW_PARSING_UTILS_STATUS, NOK, and OK.

MlViewExternalSubsetDefinition* mlview_parsing_utils_let_user_choose_a_dtd MlViewAppContext   a_app_context,
gchar *    a_title
 

Definition at line 1196 of file mlview-parsing-utils.c.

References CANCEL_BUTTON, mlview_app_context_get_file_selector(), mlview_app_context_set_window_icon(), mlview_external_subset_definition_new(), mlview_file_selection_run(), MLVIEW_SELECTED_BUTTON, OK_BUTTON, and WINDOW_CLOSED.

Referenced by mlview_xml_document_associate_dtd_interactive().

xmlDtd* mlview_parsing_utils_load_a_dtd MlViewExternalSubsetDefinition   a_subset_def,
MlViewAppContext   a_app_context
 

Parameters:
a_susbset_def 
_a_app_context 

Definition at line 1077 of file mlview-parsing-utils.c.

References _MlViewExternalSubsetDefinition::external_id, mlview_app_context_display_buffered_error(), mlview_app_context_error_buffer_is_empty(), mlview_app_context_set_error_dialog_title(), and _MlViewExternalSubsetDefinition::system_id.

Referenced by mlview_xml_document_associate_dtd().

xmlDoc* mlview_parsing_utils_load_xml_file gchar *    a_file_name,
MlViewAppContext   a_app_context
 

Parameters:
a_file_name  the name of the file to open and parse.
a_app_context  the application context to use. If set to NULL, it is not taken in account.
Returns:
the xmlDoc resulting from the parsing or NULL if the parsing failed.

Definition at line 1016 of file mlview-parsing-utils.c.

References mlview_app_context_error().

Referenced by mlview_xml_document_open().

gint mlview_parsing_utils_save_xml_doc xmlDoc *    a_xml_doc,
gchar *    a_file_path,
MlViewAppContext   a_app_context
 

Saves an xml file using the application wide settings.

Parameters:
a_xml_doc  the xml document to save.
a_app_context  the current xml app context.
Returns:
the number of bytes written or -1 in case of an error.

Definition at line 1057 of file mlview-parsing-utils.c.

Referenced by mlview_settings_manager_save_settings_to_disk(), and mlview_xml_document_save().

gint mlview_parsing_utils_validate_dtd xmlDoc *    a_doc,
xmlDtd *    a_dtd,
MlViewAppContext   a_app_context
 

Parameters:
a_doc 
Returns:
0 if document is valid, 1 if not, 2 if no DTD was given in parameter, and -1 if one of the parameters are bad.

Definition at line 1131 of file mlview-parsing-utils.c.

References mlview_app_context_display_buffered_error(), mlview_app_context_error_buffer_is_empty(), and mlview_app_context_set_error_dialog_title().

Referenced by mlview_xml_document_validate().

MlViewExternalSubsetDefinition* mlview_utils_get_a_copy_of_last_external_subset_def void   
 

found during the parsing of the last xml document if and only if the parsing has been triggered by calling the function mlview_parsing_utils_load_xml_file(gchar * a_file_name).

Note that after a given xml document parsing, this function can only be

Returns:
NULL. This function can also return NULL if no external subset has been declared in the

Definition at line 1176 of file mlview-parsing-utils.c.

References mlview_external_subset_definition_destroy().


Variable Documentation

int xmlDoValidityCheckingDefaultValue
 

Definition at line 44 of file mlview-parsing-utils.c.


Generated on Sat Jul 6 09:57:40 2002 for Gnome-MlView by doxygen1.2.16