Пример #1
0
// restore parser handlers from previous one in stack
void XSD_RestoreStack(xml_parser_stack_t *stack)
{
    XML_SetStartElementHandler(stack->parser, stack->oldStartHandler);
    XML_SetEndElementHandler(stack->parser, stack->oldEndHandler);
    XML_SetCharacterDataHandler(stack->parser, stack->oldCharacterDataHandler);
    XML_SetUserData(stack->parser, stack->oldUserData);
}
Пример #2
0
void QTVList_Process_Full_List(vfsfile_t *f, sb_qtvlist_parse_state_t *sb_qtvparse)
{
	XML_Parser parser = NULL;
	int len;
	enum XML_Status status;
	char buf[4096];
	vfserrno_t err;

    // initialize XML parser
    parser = XML_ParserCreate(NULL);
	if (parser == NULL) {
		Com_Printf("Couldn't initialize XML parser\n");
        return;
	}
    XML_SetStartElementHandler(parser, QTVList_Parse_StartElement);
	XML_SetCharacterDataHandler(parser, QTVList_Parse_CharacterData);
	XML_SetEndElementHandler(parser, QTVList_Parse_EndElement);
    XML_SetUserData(parser, (void *) sb_qtvparse);

    while ((len = VFS_READ(f, buf, 4096, &err)) > 0)
    {
		if ((status = XML_Parse(parser, buf, len, 0)) != XML_STATUS_OK) {
			enum XML_Error err = XML_GetErrorCode(parser);
			Com_Printf("XML parser error.\n%s\n", status, XML_ErrorString(err));
			break;
		}
    }
}
Пример #3
0
static int initializeExpat() 
{
    doc = XML_ParserCreate(NULL);
    XML_SetStartElementHandler(doc,&starttag);
    XML_SetEndElementHandler(doc,&endtag);
    XML_SetCharacterDataHandler(doc,&texttag);
    return 0;
}
Пример #4
0
XmlParser::XmlParser(XmlContentHandler& handler)
    : handler_(handler)
{
    parser_ = XML_ParserCreateNS(0, '\t');
    XML_SetUserData(parser_, static_cast<void*>(this));
    XML_SetStartElementHandler(parser_, StartElementHandler);
    XML_SetEndElementHandler(parser_, EndElementHandler);
    XML_SetCharacterDataHandler(parser_, CharacterDataHandler);
    error_msg_ = "Failed to parse XML.";
}
Пример #5
0
void CeIdObject::GetParams(std::string strToParse)
{
	XML_Parser parser = XML_ParserCreate(NULL);
	XML_SetUserData(parser, (void *) this);
	XML_SetStartElementHandler(parser, StartElementHandler);
	XML_SetEndElementHandler(parser, EndElementHandler);
	XML_SetCharacterDataHandler(parser, CharacterDataHandler);
	XML_Parse(parser, strToParse.c_str(), strToParse.length(), true);
	XML_ParserFree(parser);
}
Пример #6
0
xml_t * XSD_Variable_LoadFromHandle(FILE *f, int filelen) {
#else
xml_t * XSD_Variable_LoadFromHandle(vfsfile_t *v, int filelen) {
	vfserrno_t err;
#endif
    xml_variable_t *document;
    XML_Parser parser = NULL;
    int len;
	int pos = 0;
    char buf[XML_READ_BUFSIZE];
    xml_parser_stack_t parser_stack;

    // create blank document
    document = (xml_variable_t *) Q_malloc(sizeof(xml_variable_t));
    XSD_Variable_Init(document);

    // initialize XML parser
    parser = XML_ParserCreate(NULL);
    if (parser == NULL)
        goto error;
    XML_SetStartElementHandler(parser, OnStartElement);
    XML_SetEndElementHandler(parser, OnEndElement);
    XML_SetCharacterDataHandler(parser, OnCharacterData);

    // prepare user data
    XSD_InitStack(&parser_stack);
    parser_stack.document = (xml_t *) document;
    XML_SetUserData(parser, &parser_stack);

#ifndef WITH_FTE_VFS
    while ((len = fread(buf, 1, min(XML_READ_BUFSIZE, filelen-pos), f)) > 0)
#else
    while ((len = VFS_READ(v, buf, min(XML_READ_BUFSIZE, filelen-pos), &err)) > 0)
#endif
    {
        if (XML_Parse(parser, buf, len, 0) != XML_STATUS_OK)
            goto error;

		pos += len;
    }
    if (XML_Parse(parser, NULL, 0, 1) != XML_STATUS_OK)
        goto error;

    XML_ParserFree(parser);

    return (xml_t *) document;

error:

    if (parser)
        XML_ParserFree(parser);
    XSD_Variable_Free((xml_t *)document);

    return NULL;
}
Пример #7
0
int
main(int argc, char **argv)
{
    XML_Parser parser;

    size_t i;
    size_t j;

    nst_cfg_allocator = nst_mem_stat_register("NST CFG");

    parser = XML_ParserCreate(NULL);
    expat_stack_top->parser = parser;

    if(!parser) {
        assert(0 && "Cannot allocate memory during XML_ParserCreate\n");
        return -1;
    }

    for(i = 0;
            i < sizeof(xml_test_strings) / sizeof(const char *);
            i++) {
        const char *xml_test_string = xml_test_strings[i];
        enum XML_Status xml_status;

        XML_SetStartElementHandler(parser, root_start_handler);
        XML_SetEndElementHandler(parser, root_end_handler);
        XML_SetCharacterDataHandler(parser, root_char_handler);
        XML_SetUserData(parser, (void*)&expat_stack_top);

        for(j = 0; xml_test_string[j]; j++) {
            xml_status = XML_Parse(parser, xml_test_string+j, 1, 0);
            if(xml_status != XML_STATUS_OK) {
                fprintf(stderr, "Parse error at line %lu: %s\n",
                        XML_GetCurrentLineNumber(parser),
                        XML_ErrorString(XML_GetErrorCode(parser)));
                return -1;
            }
        }

        xml_status = XML_Parse(parser, NULL, 0, 1);
        if(xml_status != XML_STATUS_OK) {
            fprintf(stderr, "Parse error at line %lu: %s\n",
                    XML_GetCurrentLineNumber(parser),
                    XML_ErrorString(XML_GetErrorCode(parser)));
            return -1;
        }

        XML_ParserReset(parser, NULL);
    };

    XML_ParserFree(parser);

    assert(nst_mem_stat_get_allocated_nbytes(nst_cfg_allocator.data) == 0);
    return 0;
}
Пример #8
0
static void init_parser(XML_Parser parser, expat_parser *parser_data)
{
    XML_SetUserData(parser, parser_data);

    XML_SetStartElementHandler(parser, (XML_StartElementHandler)start_element_handler);
    XML_SetEndElementHandler(parser, (XML_EndElementHandler)end_element_handler);
    XML_SetCharacterDataHandler(parser, (XML_CharacterDataHandler)character_data_handler);
    XML_SetStartNamespaceDeclHandler(parser, (XML_StartNamespaceDeclHandler)namespace_decl_handler);

    XML_SetReturnNSTriplet(parser, 1);
    XML_SetDefaultHandler(parser, NULL);
};
Пример #9
0
XML_Parser::XML_Parser()
{
    _rep = new XML_Parser_Rep;
    _rep->self = this;
    _rep->error = false;
    _rep->parser = XML_ParserCreate("UTF-8");

    XML_SetUserData(_rep->parser, _rep);

    XML_SetStartElementHandler(_rep->parser, _start_element_handler);
    XML_SetEndElementHandler(_rep->parser, _end_element_handler);
    XML_SetCharacterDataHandler(_rep->parser, _character_data_handler);
}
Пример #10
0
void
OMXMLReaderExpat::reset()
{
    TRACE("OMXMLReaderExpat::reset");
    
    XML_ParserFree(_parser);
    
    if (_workBuffer != 0)
    {
        delete [] _workBuffer;
    }
    
    OMListIterator<OMXMLAttribute*> iter(_attributes, OMBefore);
    while (++iter)
    {
        delete iter.value();
    }
    _attributes.clear();
    
    OMUInt32 elementCount = _startNmspaceDecls.count();
    for (OMUInt32 i = 0; i < elementCount; i++)
    {
        delete _startNmspaceDecls.getAt(i);
    }
    _startNmspaceDecls.clear();
    _endNmspaceDecls.clear();
    
    
    clearEvents();

    _parser = XML_ParserCreateNS(0, NAMESPACE_SEPARATOR);
    XML_SetNotationDeclHandler(_parser, ::expat_NotationDeclHandler);
    XML_SetEntityDeclHandler(_parser, ::expat_EntityDeclHandler);
    XML_SetStartNamespaceDeclHandler(_parser, ::expat_StartNamespaceDeclHandler);
    XML_SetEndNamespaceDeclHandler(_parser, ::expat_EndNamespaceDeclHandler);
    XML_SetStartElementHandler(_parser, ::expat_StartElementHandler);
    XML_SetEndElementHandler(_parser, ::expat_EndElementHandler);
    XML_SetCharacterDataHandler(_parser, ::expat_CharacterDataHandler);
    XML_SetUserData(_parser, this);

    _workBuffer = new wchar_t[WORK_BUFFER_MIN_SIZE];
    _workBufferSize = WORK_BUFFER_MIN_SIZE;
    
    _readNextChunk = true;
    _status = true;
    _numInBuffer = 0;
    
    _xmlStream->setPosition(0);
}
Пример #11
0
//=============================================================================
bool CPdpManager::LoadFromXml(const string& fromFile )
{
	//read the file into a buffer
	ifstream fProj(fromFile.c_str());
	if (!fProj.is_open())
		return false;

	fProj.seekg( 0, ios_base::end );
	std::streamoff fileSize = fProj.tellg();
	if (fileSize <= 0)
		return false;
	
	fProj.seekg( 0, ios_base::beg);
	vector<char> fileBuff;
	fileBuff.resize(fileSize);
	fProj.read(&(fileBuff[0]), fileSize);
	fProj.close();
	
	//parse the file's xml
	XML_Parser m_parser;
	m_parser = XML_ParserCreate(0);
	XML_SetUserData(m_parser, this);
	XML_SetStartElementHandler(m_parser, StartElement);
	XML_SetEndElementHandler(m_parser, EndElement);
//	XML_SetCharacterDataHandler(m_parser, CharacterDataHandler);
//	XML_SetCommentHandler(m_parser, CommentHandler);


	int rtn = XML_Parse(m_parser, &(fileBuff[0]), fileBuff.size(), true);

	if (!rtn)
	{
		dprintf("Error parsing:\n");
		dprintf(XML_ErrorString(XML_GetErrorCode(m_parser)));
		dprintf(" (line: %d, col: %d)\n", XML_GetCurrentLineNumber(m_parser), XML_GetCurrentColumnNumber(m_parser));
	}


//	XML_SetCommentHandler(m_parser, 0);
//	XML_SetCharacterDataHandler(m_parser, 0);
//	XML_SetEndElementHandler(m_parser, 0);
	XML_SetStartElementHandler(m_parser, 0);
	XML_SetUserData(m_parser, 0);
	XML_ParserFree(m_parser);


	return (rtn == 0);
}
Пример #12
0
bool_t reset_handlers_parser(parser_t *parser) {
  if( parser ) {
    XML_SetStartElementHandler(parser->p, parser->callbacks.start_tag ?
			       xml_startelementhandler : NULL);
    XML_SetEndElementHandler(parser->p, parser->callbacks.end_tag ?
			     xml_endelementhandler : NULL);
    XML_SetCommentHandler(parser->p, parser->callbacks.comment ?
			  xml_commenthandler : NULL);
    XML_SetCharacterDataHandler(parser->p, parser->callbacks.chardata ?
				xml_characterdatahandler : NULL);
    XML_SetProcessingInstructionHandler(parser->p, parser->callbacks.pidata ?
					xml_processinginstructionhandler : NULL);
    XML_SetStartCdataSectionHandler(parser->p, parser->callbacks.start_cdata ?
				    xml_startcdatahandler : NULL);
    /* if start_cdata, always set endcdatahandler */
    XML_SetEndCdataSectionHandler(parser->p, parser->callbacks.start_cdata ?
				  xml_endcdatahandler : NULL);
    XML_SetDefaultHandler(parser->p, parser->callbacks.dfault ?
    			  xml_defaulthandler : NULL);


    XML_SetStartDoctypeDeclHandler(parser->p, parser->callbacks.start_doctypedecl ?
				   xml_startdoctypedeclhandler : NULL);
    /* if start_doctypedecl, always set enddoctypedeclhandler */
    XML_SetEndDoctypeDeclHandler(parser->p, parser->callbacks.start_doctypedecl ?
				 xml_enddoctypedeclhandler : NULL);
    XML_SetEntityDeclHandler(parser->p, parser->callbacks.entitydecl ?
			     xml_entitydeclhandler : NULL);

    /* what to do about entities: there can be internal and external
     * entities, which expat treats differently. We want all our
     * entities to stay unprocessed, otherwise we'll get well formedness
     * errors. When a handler is called, the raw string is passed to
     * the default handler (provided it exists). */
    XML_UseForeignDTD(parser->p, XML_TRUE);
    XML_SetParamEntityParsing(parser->p, XML_PARAM_ENTITY_PARSING_NEVER);
    XML_SetExternalEntityRefHandler(parser->p,
				    xml_externalentityrefhandler);
    XML_SetExternalEntityRefHandlerArg(parser->p, parser);
    XML_SetSkippedEntityHandler(parser->p, xml_skippedentityhandler);


    return TRUE;
  }
  return FALSE;
}
Пример #13
0
static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff)
{
   expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data));
   d->port = port;
   d->parser = XML_ParserCreate("UTF-8");
   XML_SetUserData(d->parser, d);

   set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);

   XML_SetStartElementHandler(
      d->parser, (XML_StartElementHandler)erlXML_StartElementHandler);
   XML_SetEndElementHandler(
      d->parser, (XML_EndElementHandler)erlXML_EndElementHandler);
   XML_SetCharacterDataHandler(
      d->parser, (XML_CharacterDataHandler)erlXML_CharacterDataHandler);


   return (ErlDrvData)d;
}
Пример #14
0
xps_item_t *
xps_parse_xml(xps_context_t *ctx, byte *buf, int len)
{
    xps_parser_t parser;
    XML_Parser xp;
    int code;

    parser.ctx = ctx;
    parser.root = NULL;
    parser.head = NULL;
    parser.error = NULL;
    parser.compat = 0;

    xp = XML_ParserCreateNS(NULL, ' ');
    if (!xp)
    {
        gs_throw(-1, "xml error: could not create expat parser");
        return NULL;
    }

    XML_SetUserData(xp, &parser);
    XML_SetParamEntityParsing(xp, XML_PARAM_ENTITY_PARSING_NEVER);
    XML_SetStartElementHandler(xp, (XML_StartElementHandler)on_open_tag);
    XML_SetEndElementHandler(xp, (XML_EndElementHandler)on_close_tag);
    XML_SetCharacterDataHandler(xp, (XML_CharacterDataHandler)on_text);

    code = XML_Parse(xp, (char*)buf, len, 1);
    if (code == 0)
    {
        if (parser.root)
            xps_free_item(ctx, parser.root);
        XML_ParserFree(xp);
        gs_throw1(-1, "xml error: %s", XML_ErrorString(XML_GetErrorCode(xp)));
        return NULL;
    }

    XML_ParserFree(xp);

    if (parser.compat)
        xps_process_compatibility(ctx, parser.root);

    return parser.root;
}
Пример #15
0
void ZLXMLReaderInternal::init(const char *encoding) {
	if (myInitialized) {
		XML_ParserReset(myParser, encoding);
	}

	myInitialized = true;
	XML_UseForeignDTD(myParser, XML_TRUE);

	setupEntities();

	XML_SetUserData(myParser, &myReader);
	if (encoding != 0) {
		XML_SetEncoding(myParser, encoding);
	}
	XML_SetStartElementHandler(myParser, fStartElementHandler);
	XML_SetEndElementHandler(myParser, fEndElementHandler);
	XML_SetCharacterDataHandler(myParser, fCharacterDataHandler);
	XML_SetUnknownEncodingHandler(myParser, fUnknownEncodingHandler, 0);
}
svg_status_t
_svg_parser_begin (svg_parser_t *parser)
{
    /* Innocent until proven guilty */
    parser->status = SVG_STATUS_SUCCESS;

    if (parser->ctxt)
	parser->status = SVG_STATUS_INVALID_CALL;

    parser->ctxt = XML_ParserCreate (NULL);
    XML_SetUserData (parser->ctxt, parser);

    XML_SetStartElementHandler (parser->ctxt, _svg_parser_sax_start_element);
    XML_SetEndElementHandler (parser->ctxt, _svg_parser_sax_end_element);
    XML_SetCharacterDataHandler (parser->ctxt, _svg_parser_sax_characters);

    if (parser->ctxt == NULL)
	parser->status = SVG_STATUS_NO_MEMORY;

    return parser->status;
}
Пример #17
0
void ZLXMLReaderInternal::init(const char *encoding) {
	if (myInitialized) {
		XML_ParserReset(myParser, encoding);
	}

	myInitialized = true;
	XML_UseForeignDTD(myParser, XML_TRUE);

	const std::vector<std::string> &dtds = myReader.externalDTDs();
	for (std::vector<std::string>::const_iterator it = dtds.begin(); it != dtds.end(); ++it) {
		myDTDStreamLocks.insert(ZLFile(*it).inputStream());
		parseDTD(myParser, *it);
	}

	XML_SetUserData(myParser, &myReader);
	if (encoding != 0) {
		XML_SetEncoding(myParser, encoding);
	}
	XML_SetStartElementHandler(myParser, fStartElementHandler);
	XML_SetEndElementHandler(myParser, fEndElementHandler);
	XML_SetCharacterDataHandler(myParser, fCharacterDataHandler);
	XML_SetUnknownEncodingHandler(myParser, fUnknownEncodingHandler, 0);
}
Пример #18
0
OMXMLReaderExpat::OMXMLReaderExpat(OMRawStorage* xmlStream)
: _appendData(false), _xmlStream(xmlStream), _parser(0)
{
    TRACE("OMXMLReaderExpat::OMXMLReaderExpat");

    clearEvents();

    _parser = XML_ParserCreateNS(0, NAMESPACE_SEPARATOR);
    XML_SetNotationDeclHandler(_parser, ::expat_NotationDeclHandler);
    XML_SetEntityDeclHandler(_parser, ::expat_EntityDeclHandler);
    XML_SetStartNamespaceDeclHandler(_parser, ::expat_StartNamespaceDeclHandler);
    XML_SetEndNamespaceDeclHandler(_parser, ::expat_EndNamespaceDeclHandler);
    XML_SetStartElementHandler(_parser, ::expat_StartElementHandler);
    XML_SetEndElementHandler(_parser, ::expat_EndElementHandler);
    XML_SetCharacterDataHandler(_parser, ::expat_CharacterDataHandler);
    XML_SetUserData(_parser, this);

    _workBuffer = new wchar_t[WORK_BUFFER_MIN_SIZE];
    _workBufferSize = WORK_BUFFER_MIN_SIZE;

    _readNextChunk = true;
    _status = true;
    _numInBuffer = 0;
}
Пример #19
0
static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff)
{
   expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data));
   d->port = port;
   d->parser = XML_ParserCreate_MM("UTF-8", &ms, "\n");
   XML_SetUserData(d->parser, d);

   set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);

   XML_SetStartElementHandler(
      d->parser, (XML_StartElementHandler)erlXML_StartElementHandler);
   XML_SetEndElementHandler(
      d->parser, (XML_EndElementHandler)erlXML_EndElementHandler);
   XML_SetCharacterDataHandler(
      d->parser, (XML_CharacterDataHandler)erlXML_CharacterDataHandler);

   XML_SetStartNamespaceDeclHandler(
      d->parser, (XML_StartNamespaceDeclHandler) erlXML_StartNamespaceDeclHandler);
   XML_SetReturnNSTriplet(d->parser, 1);

   XML_SetDefaultHandler(d->parser, NULL);

   return (ErlDrvData)d;
}
Пример #20
0
END_TEST

/* Regression test #4 for SF bug #673791. */
START_TEST(test_ns_prefix_with_empty_uri_4)
{
    char *text =
        "<!DOCTYPE doc [\n"
        "  <!ELEMENT prefix:doc EMPTY>\n"
        "  <!ATTLIST prefix:doc\n"
        "    xmlns:prefix CDATA 'http://xml.libexpat.org/'>\n"
        "]>\n"
        "<prefix:doc/>";
    /* Packaged info expected by the end element handler;
       the weird structuring lets us re-use the triplet_end_checker()
       function also used for another test. */
    char *elemstr[] = {
        "http://xml.libexpat.org/ doc prefix"
    };
    XML_SetReturnNSTriplet(parser, XML_TRUE);
    XML_SetUserData(parser, elemstr);
    XML_SetEndElementHandler(parser, triplet_end_checker);
    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
        xml_failure(parser);
}
Пример #21
0
static void parseString(const char* xml, void* userData, bool addFakeRoot = false)
{
	XML_Parser parser = XML_ParserCreate(NULL);
	XML_SetUserData(parser, userData);
	
	try {
	
		int parsed = 1;
	
		if (addFakeRoot)
		{
			XML_SetStartElementHandler(parser, NULL);
			XML_SetEndElementHandler(parser, NULL);
			XML_SetCharacterDataHandler(parser, NULL);
			parsed = XML_Parse(parser, "<root>", 6, 0);
			
			if (!parsed)
				throw Exception();
		}
	
		XML_SetStartElementHandler(parser, startElement);
		XML_SetEndElementHandler(parser, endElement);
		XML_SetCharacterDataHandler(parser, characterData);
		parsed = XML_Parse(parser, xml, strlen(xml), !addFakeRoot);
		
		if (!parsed)
			throw Exception();
	
		if (addFakeRoot)
		{
			XML_SetStartElementHandler(parser, NULL);
			XML_SetEndElementHandler(parser, NULL);
			XML_SetCharacterDataHandler(parser, NULL);
			parsed = XML_Parse(parser, "</root>", 7, 1);
			
			if (!parsed)
				throw Exception();
		}
	
	}
	catch (Exception& ex)
	{
		XML_ParserFree(parser);
		
		std::stringstream ss;
		if (ex.hasMessage())
		{
			ss << ex.getMessage();
		}
		else
		{
			ss << "Error while parsing XML: ";
			ss << XML_ErrorString(XML_GetErrorCode(parser));
		}
		ss << " at line ";
		ss << XML_GetCurrentLineNumber(parser);
		throw Exception(ss.str());
	}
	
	XML_ParserFree(parser);
}
Пример #22
0
static void parseFile(const char* fileName, void* userData, bool addFakeRoot = false)
{
	XML_Parser parser = XML_ParserCreate(NULL);
	XML_SetUserData(parser, userData);
	
	try {
	
		int parsed = 1;
	
		if (addFakeRoot)
		{
			XML_SetStartElementHandler(parser, NULL);
			XML_SetEndElementHandler(parser, NULL);
			XML_SetCharacterDataHandler(parser, NULL);
			parsed = XML_Parse(parser, "<root>", 6, 0);
			
			if (!parsed)
				throw Exception();
		}
	
		XML_SetStartElementHandler(parser, startElement);
		XML_SetEndElementHandler(parser, endElement);
		XML_SetCharacterDataHandler(parser, characterData);
		
		FILE* f = fopen(fileName, "r");
		if (f == NULL)
			throw Exception(std::string("Could not open XML file '") + fileName + "'");
		
		char line[1024];
		while (parsed && !feof(f))
		{
			fgets(line, sizeof(line), f);
			if (!feof(f))
			{
				parsed = XML_Parse(parser, line, strlen(line), 0);
				if (!parsed)
					throw Exception();
			}
		}
		
		if (!addFakeRoot)
			XML_Parse(parser, "", 0, 1);
		
		fclose(f);
	
		if (addFakeRoot)
		{
			XML_SetStartElementHandler(parser, NULL);
			XML_SetEndElementHandler(parser, NULL);
			XML_SetCharacterDataHandler(parser, NULL);
			parsed = XML_Parse(parser, "</root>", 7, 1);
			
			if (!parsed)
				throw Exception();
		}
	
	}
	catch (Exception& ex)
	{
		XML_ParserFree(parser);
		
		std::stringstream ss;
		if (ex.hasMessage())
		{
			ss << ex.getMessage();
		}
		else
		{
			ss << "Error while parsing XML: ";
			ss << XML_ErrorString(XML_GetErrorCode(parser));
		}
		ss << " at line ";
		ss << XML_GetCurrentLineNumber(parser);
		ss << " in file ";
		ss << fileName;
		throw Exception(ss.str());
	}
	
	XML_ParserFree(parser);
}
Пример #23
0
void bmx_expat_XML_SetEndElementHandler(XML_Parser parser) {
	XML_SetEndElementHandler(parser, bmx_expat_EndElementHandler);
}
Пример #24
0
void _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end)
{
	XML_SetEndElementHandler(parser, end);
}
Пример #25
0
void XMLParser::EnableEndElementHandler(bool enable)
{
	assert(m_parser != NULL);
	XML_SetEndElementHandler(m_parser, enable ? EndElementHandler : NULL);
}