+++ /dev/null
-/*\r
- * GPAC - Multimedia Framework C SDK\r
- *\r
- * Copyright (c) Jean Le Feuvre 2000-2005 \r
- * All rights reserved\r
- *\r
- * This file is part of GPAC / common tools sub-project\r
- *\r
- * GPAC is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published by\r
- * the Free Software Foundation; either version 2, or (at your option)\r
- * any later version.\r
- * \r
- * GPAC is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; see the file COPYING. If not, write to\r
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
- *\r
- */\r
-\r
-#ifndef _XML_PARSER_H_\r
-#define _XML_PARSER_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include <gpac/tools.h>\r
-#include <gpac/list.h>\r
-\r
-/*!\r
- * \file <gpac/xml.h>\r
- * \brief XML functions.\r
- */\r
-\r
-/*!\r
- * \addtogroup xml_grp XML\r
- * \ingroup utils_grp\r
- * \brief XML Parsing functions\r
- *\r
- *This section documents the XML functions of the GPAC framework.\n\r
- * @{\r
- */\r
-\r
-\r
-\r
-typedef struct\r
-{\r
- /*name or namespace:name*/\r
- char *name;\r
- /*value*/\r
- char *value;\r
-} GF_XMLAttribute;\r
-\r
-/*XML node types*/\r
-enum\r
-{\r
- GF_XML_NODE_TYPE = 0,\r
- GF_XML_TEXT_TYPE,\r
- GF_XML_CDATA_TYPE,\r
-};\r
-\r
-typedef struct _xml_node\r
-{\r
- u32 type;\r
- /*\r
- For DOM nodes: name\r
- For other (text, css, cdata), element content\r
- */\r
- char *name;\r
-\r
- /*for DOM nodes only*/\r
- char *ns; /*namespace*/\r
- GF_List *attributes;\r
- GF_List *content;\r
-} GF_XMLNode;\r
-\r
-\r
-\r
-/*\r
- SAX XML Parser\r
-*/\r
-\r
-typedef struct _tag_sax_parser GF_SAXParser;\r
-typedef void (*gf_xml_sax_node_start)(void *sax_cbck, const char *node_name, const char *name_space, const GF_XMLAttribute *attributes, u32 nb_attributes);\r
-typedef void (*gf_xml_sax_node_end)(void *sax_cbck, const char *node_name, const char *name_space);\r
-typedef void (*gf_xml_sax_text_content)(void *sax_cbck, const char *content, Bool is_cdata);\r
-\r
-typedef void (*gf_xml_sax_progress)(void *cbck, u32 done, u32 tot);\r
-\r
-/*creates new sax parser - all callbacks are optionals*/\r
-GF_SAXParser *gf_xml_sax_new(gf_xml_sax_node_start on_node_start, \r
- gf_xml_sax_node_end on_node_end,\r
- gf_xml_sax_text_content on_text_content,\r
- void *cbck);\r
-\r
-/*destroys sax parser */\r
-void gf_xml_sax_del(GF_SAXParser *parser);\r
-/*inits parser with BOM. BOM must be 4 char string with 0 terminaison. If BOM is NULL, parsing will\r
-assume UTF-8 compatible coding*/\r
-GF_Err gf_xml_sax_init(GF_SAXParser *parser, unsigned char *BOM);\r
-/*parses input string data. string data MUST be terminated by the 0 character (eg 2 0s for UTF-16)*/\r
-GF_Err gf_xml_sax_parse(GF_SAXParser *parser, void *string_bytes);\r
-/*suspends/resume sax parsing. \r
- When resuming on file, the function will run until suspended/end of file/error\r
- When resuming on steram, the function will simply return\r
-*/\r
-GF_Err gf_xml_sax_suspend(GF_SAXParser *parser, Bool do_suspend);\r
-/*parses file (potentially gzipped). OnProgress is optional, used to get progress callback*/\r
-GF_Err gf_xml_sax_parse_file(GF_SAXParser *parser, const char *fileName, gf_xml_sax_progress OnProgress);\r
-/*get current line number*/\r
-u32 gf_xml_sax_get_line(GF_SAXParser *parser);\r
-/*get file size - may be inaccurate if gzipped (only compressed file size is known)*/\r
-u32 gf_xml_sax_get_file_size(GF_SAXParser *parser);\r
-/*get current file position*/\r
-u32 gf_xml_sax_get_file_pos(GF_SAXParser *parser);\r
-\r
-/*peeks a node forward in the file. May be used to pick the attribute of the first node found matching a given (attributeName, attributeValue) couple*/\r
-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);\r
-\r
-/*file mode only, returns 1 if file is compressed, 0 otherwise*/\r
-Bool gf_xml_sax_binary_file(GF_SAXParser *parser);\r
-\r
-const char *gf_xml_sax_get_error(GF_SAXParser *parser);\r
-\r
-char *gf_xml_get_root_type(const char *file, GF_Err *ret_code);\r
-\r
-u32 gf_xml_sax_get_node_start_pos(GF_SAXParser *parser);\r
-u32 gf_xml_sax_get_node_end_pos(GF_SAXParser *parser);\r
-\r
-\r
-typedef struct _tag_dom_parser GF_DOMParser;\r
-GF_DOMParser *gf_xml_dom_new();\r
-void gf_xml_dom_del(GF_DOMParser *parser);\r
-GF_Err gf_xml_dom_parse(GF_DOMParser *parser, const char *file, gf_xml_sax_progress OnProgress, void *cbk);\r
-GF_XMLNode *gf_xml_dom_get_root(GF_DOMParser *parser);\r
-const char *gf_xml_dom_get_error(GF_DOMParser *parser);\r
-u32 gf_xml_dom_get_line(GF_DOMParser *parser);\r
-\r
-char *gf_xml_dom_serialize(GF_XMLNode *node, Bool content_only);\r
-\r
-\r
-GF_XMLNode *gf_xml_dom_detach_root(GF_DOMParser *parser);\r
-void gf_xml_dom_node_del(GF_XMLNode *node);\r
-\r
-/*! @} */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-\r
-#endif /*_XML_PARSER_H_*/\r
-\r