MLib Simple XML Subset Parser

MLib Simple XML Subset Parser — Parses a subset of XML

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <mlib.h>

struct              MParser;
#define             MPARSERINIT
#define             MParser_new                         (name)
struct              MMarkupParserData;
#define             MMARKUPPARSERDATAINIT
#define             MMarkupParserData_new               (name)
void                m_inizialize_parser                 (MParser *parser);
mpointer            m_parsing_from_xml                  (MMarkupParserData *m_markup_parser_data);

Description

The "GMarkup" parser is intended to parse a simple markup format that's a subset of XML. This is a small, efficient, easy-to-use parser.

Details

struct MParser

struct MParser {
		/*< user >*/
		mpointer		 data;

		/*< m_inizialize_parser() >*/
		mchars			 last_tag;
		muint			 n_elements;
};

Contiene le informazioni lette attraverso la funzione m_parsing_from_xml() .

mpointer data;

indirizzo ad una struttura indefinita che conterra' i dati letti attraverso il parsing

mchars last_tag;

ultimo tag letto nel parsing

muint n_elements;

quantita' elementi letti

MPARSERINIT

#define MPARSERINIT				{ NULL, NULL, 0 }


MParser_new()

    #define MParser_new(name)		MParser name = MPARSERINIT

Declare and define a new MParser structure.

name :

name of a new MParser structure

struct MMarkupParserData

struct MMarkupParserData {
	MFileString*			  string_file_xml;


	void (*start_element)  	( GMarkupParseContext* context,
							  mconstchars			element_name,
							  mconstchars*			attribute_names,
							  mconstchars*			attribute_values,
							  mpointer				user_data,
							  MError**				error );

	void (*end_element)    	( GMarkupParseContext* context,
							  mconstchars			element_name,
							  mpointer				user_data,
							  MError**				error );

	void (*text)           	( GMarkupParseContext* context,
							  mconstchars			text,
							  msize					text_len,
							  mpointer				user_data,
							  MError**				error );

	void (*passthrough)    	( GMarkupParseContext* context,
							  mconstchars			passthrough_text,
							  msize					text_len,
							  mpointer				user_data,
							  MError**				error );

	void (*error)          	( GMarkupParseContext* context,
							  MError*				error,
							  mpointer				user_data );


	void (*m_destroy_notify)( mpointer				data );

	void (*m_inizialize_data)(MParser*				parser );
};

Contiene le informazioni da passare alla funzione m_parsing_from_xml()

MFileString *string_file_xml;

struttura contenente un testo letto da file

start_element ()

Callback to invoke when the opening tag of an element is seen.

end_element ()

Callback to invoke when the closing tag of an element is seen.

text ()

Callback to invoke when some text is seen ( text is always inside an element ) .

passthrough ()

Callback to invoke for comments, processing instructions and doctype declarations.

error ()

Callback to invoke when an error occurs.

m_destroy_notify ()

Specifies the type of function which is called when a data element is destroyed.

m_inizialize_data ()

inizializza una struttura MParser

MMARKUPPARSERDATAINIT

#define MMARKUPPARSERDATAINIT		{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }


MMarkupParserData_new()

#define             MMarkupParserData_new(name)

Declare and define a new MMarkupParserData structure.

name :

name of a new MMarkupParserData structure

m_inizialize_parser ()

void                m_inizialize_parser                 (MParser *parser);

Inizializza una struttura MParser

parser :

dati da inizializzare

Since 0.0.1


m_parsing_from_xml ()

mpointer            m_parsing_from_xml                  (MMarkupParserData *m_markup_parser_data);

Effettua il parsing da un file.xml

m_markup_parser_data :

contiene le informazioni necessarie al parsing

Returns :

l'indirizzo a una struttura indefinita contenente i dati letti nel parsing.

Since 0.0.1

See Also

GLib Simple XML Subset Parser