GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
xml_parser.c File Reference
#include <gpac/xml.h>
#include <gpac/utf.h>
#include <zlib.h>
#include <gpac/bitstream.h>
#include <gpac/base_coding.h>
+ Include dependency graph for xml_parser.c:

Data Structures

struct  GF_XMLSaxAttribute
 
struct  GF_SAXParser
 
struct  XML_Entity
 
struct  _peek_type
 
struct  GF_DOMParser
 

Macros

#define XML_INPUT_SIZE   4096
 
#define CPYCAT_ALLOC(__str, __is_copy)
 
#define SET_STRING(v)
 
#define XML_SCAN_INT(_fmt, _value)
 

Enumerations

enum  {
  SAX_STATE_ATT_NAME, SAX_STATE_ATT_VALUE, SAX_STATE_ELEMENT, SAX_STATE_COMMENT,
  SAX_STATE_TEXT_CONTENT, SAX_STATE_ENTITY, SAX_STATE_SKIP_DOCTYPE, SAX_STATE_CDATA,
  SAX_STATE_DONE, SAX_STATE_XML_PROC, SAX_STATE_SYNTAX_ERROR
}
 

Functions

static GF_Err gf_xml_sax_parse_intern (GF_SAXParser *parser, char *current)
 
static char * xml_translate_xml_string (char *str)
 
static GF_XMLSaxAttributexml_get_sax_attribute (GF_SAXParser *parser)
 
static void xml_sax_swap (GF_SAXParser *parser)
 
static void format_sax_error (GF_SAXParser *parser, u32 linepos, const char *fmt,...)
 
static void xml_sax_node_end (GF_SAXParser *parser, Bool had_children)
 
static void xml_sax_node_start (GF_SAXParser *parser)
 
static Bool xml_sax_parse_attribute (GF_SAXParser *parser)
 
static void xml_sax_flush_text (GF_SAXParser *parser)
 
static void xml_sax_store_text (GF_SAXParser *parser, u32 txt_len)
 
static char * xml_get_current_text (GF_SAXParser *parser)
 
static void xml_sax_skip_doctype (GF_SAXParser *parser)
 
static void xml_sax_skip_xml_proc (GF_SAXParser *parser)
 
static void xml_sax_parse_entity (GF_SAXParser *parser)
 
static void xml_sax_cdata (GF_SAXParser *parser)
 
static Bool xml_sax_parse_comments (GF_SAXParser *parser)
 
static GF_Err xml_sax_parse (GF_SAXParser *parser, Bool force_parse)
 
static GF_Err xml_sax_append_string (GF_SAXParser *parser, char *string)
 
static XML_Entitygf_xml_locate_entity (GF_SAXParser *parser, char *ent_start, Bool *needs_text)
 
GF_Err gf_xml_sax_parse (GF_SAXParser *parser, const void *string)
 
GF_Err gf_xml_sax_init (GF_SAXParser *parser, unsigned char *BOM)
 
static void xml_sax_reset (GF_SAXParser *parser)
 
static GF_Err xml_sax_read_file (GF_SAXParser *parser)
 
GF_Err gf_xml_sax_parse_file (GF_SAXParser *parser, const char *fileName, gf_xml_sax_progress OnProgress)
 
Bool gf_xml_sax_binary_file (GF_SAXParser *parser)
 
GF_SAXParser * gf_xml_sax_new (gf_xml_sax_node_start on_node_start, gf_xml_sax_node_end on_node_end, gf_xml_sax_text_content on_text_content, void *cbck)
 
void gf_xml_sax_del (GF_SAXParser *parser)
 
GF_Err gf_xml_sax_suspend (GF_SAXParser *parser, Bool do_suspend)
 
u32 gf_xml_sax_get_line (GF_SAXParser *parser)
 
u32 gf_xml_sax_get_file_size (GF_SAXParser *parser)
 
u32 gf_xml_sax_get_file_pos (GF_SAXParser *parser)
 
char * gf_xml_sax_peek_node (GF_SAXParser *parser, char *att_name, char *att_value, char *substitute, char *get_attr, char *end_pattern, Bool *is_substitute)
 
const char * gf_xml_sax_get_error (GF_SAXParser *parser)
 
static void on_peek_node_start (void *cbk, const char *name, const char *ns, const GF_XMLAttribute *attributes, u32 nb_attributes)
 
char * gf_xml_get_root_type (const char *file, GF_Err *ret)
 
u32 gf_xml_sax_get_node_start_pos (GF_SAXParser *parser)
 
u32 gf_xml_sax_get_node_end_pos (GF_SAXParser *parser)
 
void gf_xml_dom_node_del (GF_XMLNode *node)
 
static void on_dom_node_start (void *cbk, const char *name, const char *ns, const GF_XMLAttribute *attributes, u32 nb_attributes)
 
static void on_dom_node_end (void *cbk, const char *name, const char *ns)
 
static void on_dom_text_content (void *cbk, const char *content, Bool is_cdata)
 
GF_DOMParser * gf_xml_dom_new ()
 
static void gf_xml_dom_reset (GF_DOMParser *dom, Bool full_reset)
 
void gf_xml_dom_del (GF_DOMParser *parser)
 
GF_XMLNodegf_xml_dom_detach_root (GF_DOMParser *parser)
 
static void dom_on_progress (void *cbck, u64 done, u64 tot)
 
GF_Err gf_xml_dom_parse (GF_DOMParser *dom, const char *file, gf_xml_sax_progress OnProgress, void *cbk)
 
GF_Err gf_xml_dom_parse_string (GF_DOMParser *dom, char *string)
 
GF_XMLNodegf_xml_dom_create_root (GF_DOMParser *parser, const char *name)
 
GF_XMLNodegf_xml_dom_get_root (GF_DOMParser *parser)
 
const char * gf_xml_dom_get_error (GF_DOMParser *parser)
 
u32 gf_xml_dom_get_line (GF_DOMParser *parser)
 
static void gf_xml_dom_node_serialize (GF_XMLNode *node, Bool content_only, char **str, u32 *alloc_size, u32 *size)
 
char * gf_xml_dom_serialize (GF_XMLNode *node, Bool content_only)
 
GF_XMLAttributegf_xml_dom_set_attribute (GF_XMLNode *node, const char *name, const char *value)
 
GF_XMLAttributegf_xml_dom_get_attribute (GF_XMLNode *node, const char *name)
 
GF_Err gf_xml_dom_append_child (GF_XMLNode *node, GF_XMLNode *child)
 
GF_XMLNodegf_xml_dom_node_new (const char *ns, const char *name)
 
GF_Err gf_xml_parse_bit_sequence (GF_XMLNode *bsroot, char **specInfo, u32 *specInfoSize)
 

Data Structure Documentation

struct GF_XMLSaxAttribute
+ Collaboration diagram for GF_XMLSaxAttribute:
Data Fields
u32 name_start
u32 name_end
u32 val_start
u32 val_end
Bool has_entities
struct _tag_sax_parser
+ Collaboration diagram for GF_SAXParser:
Data Fields
s32 unicode_type
char * buffer
u32 alloc_size
u32 line_size
u32 current_pos
u32 node_depth
gzFile gz_in
u32 line
u32 file_size
u32 file_pos
gf_xml_sax_node_start sax_node_start
gf_xml_sax_node_end sax_node_end
gf_xml_sax_text_content sax_text_content
void * sax_cbck
gf_xml_sax_progress on_progress
u32 sax_state
u32 init_state
GF_List * entities
char att_sep
Bool in_entity
Bool suspended
u32 in_quote
u32 elt_start_pos
u32 elt_end_pos
char err_msg[1000]
u32 att_name_start
u32 elt_name_start
u32 elt_name_end
u32 text_start
u32 text_end
GF_XMLAttribute * attrs
GF_XMLSaxAttribute * sax_attrs
u32 nb_attrs
u32 nb_alloc_attrs
struct XML_Entity
+ Collaboration diagram for XML_Entity:
Data Fields
char * name
char * value
u32 namelen
u8 sep
struct _peek_type
+ Collaboration diagram for _peek_type:
Data Fields
GF_SAXParser * parser
char * res

Macro Definition Documentation

#define XML_INPUT_SIZE   4096
#define CPYCAT_ALLOC (   __str,
  __is_copy 
)
Value:
if ( strlen(__str) + (__is_copy ? 0 : strlen(szLine))>=alloc_size) {\
alloc_size = 1 + (u32) strlen(__str); \
if (!__is_copy) alloc_size += (u32) strlen(szLine); \
szLine = gf_realloc(szLine, alloc_size); \
}\
if (__is_copy) strcpy(szLine, __str); \
else strcat(szLine, __str); \
void * gf_realloc(void *ptr, size_t size)
Definition: alloc.c:159
uint32_t u32
Definition: setup.h:246
#define SET_STRING (   v)
Value:
vlen = (u32) strlen(v); \
if (vlen+ (*size) >= (*alloc_size)) { \
(*alloc_size) += 1024; \
(*str) = gf_realloc((*str), (*alloc_size)); \
(*str)[(*size)] = 0; \
} \
strcat((*str), v); \
*size += vlen; \
void * gf_realloc(void *ptr, size_t size)
Definition: alloc.c:159
uint32_t u32
Definition: setup.h:246
#define XML_SCAN_INT (   _fmt,
  _value 
)
Value:
{\
if (strstr(att->value, "0x")) { u32 __i; sscanf(att->value+2, "%x", &__i); _value = __i; }\
else if (strstr(att->value, "0X")) { u32 __i; sscanf(att->value+2, "%X", &__i); _value = __i; }\
else sscanf(att->value, _fmt, &_value); \
}\
uint32_t u32
Definition: setup.h:246

Enumeration Type Documentation

anonymous enum
Enumerator
SAX_STATE_ATT_NAME 
SAX_STATE_ATT_VALUE 
SAX_STATE_ELEMENT 
SAX_STATE_COMMENT 
SAX_STATE_TEXT_CONTENT 
SAX_STATE_ENTITY 
SAX_STATE_SKIP_DOCTYPE 
SAX_STATE_CDATA 
SAX_STATE_DONE 
SAX_STATE_XML_PROC 
SAX_STATE_SYNTAX_ERROR 

Function Documentation

static GF_Err gf_xml_sax_parse_intern ( GF_SAXParser *  parser,
char *  current 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* xml_translate_xml_string ( char *  str)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_XMLSaxAttribute* xml_get_sax_attribute ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_swap ( GF_SAXParser *  parser)
static

+ Here is the caller graph for this function:

static void format_sax_error ( GF_SAXParser *  parser,
u32  linepos,
const char *  fmt,
  ... 
)
static

+ Here is the caller graph for this function:

static void xml_sax_node_end ( GF_SAXParser *  parser,
Bool  had_children 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_node_start ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Bool xml_sax_parse_attribute ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_flush_text ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_store_text ( GF_SAXParser *  parser,
u32  txt_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* xml_get_current_text ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_skip_doctype ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_skip_xml_proc ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_parse_entity ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_cdata ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Bool xml_sax_parse_comments ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err xml_sax_parse ( GF_SAXParser *  parser,
Bool  force_parse 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err xml_sax_append_string ( GF_SAXParser *  parser,
char *  string 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static XML_Entity* gf_xml_locate_entity ( GF_SAXParser *  parser,
char *  ent_start,
Bool needs_text 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xml_sax_reset ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err xml_sax_read_file ( GF_SAXParser *  parser)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void on_peek_node_start ( void *  cbk,
const char *  name,
const char *  ns,
const GF_XMLAttribute attributes,
u32  nb_attributes 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void on_dom_node_start ( void *  cbk,
const char *  name,
const char *  ns,
const GF_XMLAttribute attributes,
u32  nb_attributes 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void on_dom_node_end ( void *  cbk,
const char *  name,
const char *  ns 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void on_dom_text_content ( void *  cbk,
const char *  content,
Bool  is_cdata 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void gf_xml_dom_reset ( GF_DOMParser *  dom,
Bool  full_reset 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dom_on_progress ( void *  cbck,
u64  done,
u64  tot 
)
static

+ Here is the caller graph for this function:

static void gf_xml_dom_node_serialize ( GF_XMLNode node,
Bool  content_only,
char **  str,
u32 alloc_size,
u32 size 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function: