示例#1
0
int gamelist_load(void)
{
	XML_Parser parser = XML_ParserCreate(NULL);
	FILE *f;
	int depth = 0, done;
	static char buf[BUFSIZ];

	curgame = -1;
	numgames = 0;
	games = (M1GameT *)NULL;	// realloc() will become malloc() if ptr is NULL, which is handy

	f = fopen("m1.xml", "r");
	if (!f)
	{
		return 0;
	}

	XML_SetUserData(parser, &depth);
	XML_SetElementHandler(parser, startElement, endElement);
	XML_SetCharacterDataHandler(parser, charData);
	XML_SetUnknownEncodingHandler(parser, unkEncodingHandler, NULL);

	xml_state = XML_INVALID;
		
	do 
	{
		unsigned int len = fread(buf, 1, sizeof(buf), f);

		done = (len < sizeof(buf));

		if (!XML_Parse(parser, buf, len, done))
		{
			printf("XML parse error %s at line %d (m1.xml)\n",
				XML_ErrorString(XML_GetErrorCode(parser)),
				XML_GetCurrentLineNumber(parser));

			// clean up
			XML_ParserFree(parser);
			if (games)
			{
				free(games);
				games = (M1GameT *)NULL;
			}
			return 0;
		}

	} while (!done);

	XML_ParserFree(parser);

	fclose(f);

//	printf("Finished loading, %d games\n", numgames);
	return numgames;
}
示例#2
0
PRIVATE void HTXML_setHandlers (XML_Parser me)
{
    XML_SetElementHandler(me, XML_startElement, XML_endElement);
    XML_SetCharacterDataHandler(me, XML_characterData);
    XML_SetProcessingInstructionHandler(me, XML_processingInstruction);
    XML_SetDefaultHandler(me, XML_default);
    XML_SetUnparsedEntityDeclHandler(me, XML_unparsedEntityDecl);
    XML_SetNotationDeclHandler(me, XML_notationDecl);
    XML_SetExternalEntityRefHandler(me, XML_externalEntityRef);
    XML_SetUnknownEncodingHandler(me, XML_unknownEncoding, NULL);
}
示例#3
0
void opml_process(gchar *path, OPMLProcessFunc function, gpointer data)
{
	OPMLProcessCtx *ctx = NULL;
	gchar *contents = NULL;
	GError *error = NULL;
	gint status, err;

	/* Initialize our context */
	ctx = malloc( sizeof(OPMLProcessCtx) );
	ctx->parser = XML_ParserCreate(NULL);
	ctx->depth = 0;
	ctx->str = NULL;
	ctx->user_function = function;
	ctx->body_reached = FALSE;
	ctx->user_data = data;

	/* Set expat parser handlers */
	XML_SetUserData(ctx->parser, (void *)ctx);
	XML_SetElementHandler(ctx->parser,
			_opml_parser_start,
			_opml_parser_end);
	XML_SetCharacterDataHandler(ctx->parser, libfeed_expat_chparse);
	XML_SetUnknownEncodingHandler(ctx->parser,
			feed_parser_unknown_encoding_handler, NULL);

	g_file_get_contents(path, &contents, NULL, &error);

	if( error || !contents )
		return;

/*
	lines = g_strsplit(contents, '\n', 0);

	while( lines[i] ) {
		status = XML_Parse(ctx->parser, lines[i], strlen(lines[i]), FALSE);
		if( status == XML_STATUS_ERROR ) {
			err = XML_GetErrorCode(ctx->parser);
			sprintf(stderr, "\nExpat: --- %s\n\n", XML_ErrorString(err));
		}
	}
*/

	status = XML_Parse(ctx->parser, contents, strlen(contents), FALSE);
	err = XML_GetErrorCode(ctx->parser);
	fprintf(stderr, "\nExpat: --- %s (%s)\n\n", XML_ErrorString(err),
			(status == XML_STATUS_OK ? "OK" : "NOT OK"));

	XML_Parse(ctx->parser, "", 0, TRUE);

	XML_ParserFree(ctx->parser);
	g_free(ctx);
}
示例#4
0
static void
nav_rd_init(const char *fname)
{
	fin = gbfopen(fname, "r", MYNAME);

	psr = XML_ParserCreate(NULL);
	if (!psr) {
		fatal(MYNAME ":Cannot create XML parser\n");
	}

	XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL);
	XML_SetElementHandler(psr, nav_start, nav_end);
}
示例#5
0
void ParserEngine::init()
{
	if (_parser)
		XML_ParserFree(_parser);

	if (!_pBuffer)
		_pBuffer  = new char[PARSE_BUFFER_SIZE];

	if (dynamic_cast<NoNamespacePrefixesStrategy*>(_pNamespaceStrategy))
	{
		_parser = XML_ParserCreateNS(_encodingSpecified ? _encoding.c_str() : 0, '\t');
		if (_parser)
		{
			XML_SetNamespaceDeclHandler(_parser, handleStartNamespaceDecl, handleEndNamespaceDecl);
		}
	}
	else if (dynamic_cast<NamespacePrefixesStrategy*>(_pNamespaceStrategy))
	{
		_parser = XML_ParserCreateNS(_encodingSpecified ? _encoding.c_str() : 0, '\t');
		if (_parser)
		{
			XML_SetReturnNSTriplet(_parser, 1);
			XML_SetNamespaceDeclHandler(_parser, handleStartNamespaceDecl, handleEndNamespaceDecl);
		}
	}
	else
	{
		_parser = XML_ParserCreate(_encodingSpecified ? _encoding.c_str() : 0);
	}

	if (!_parser) throw XMLException("Cannot create Expat parser");

	XML_SetUserData(_parser, this);
	XML_SetElementHandler(_parser, handleStartElement, handleEndElement);
	XML_SetCharacterDataHandler(_parser, handleCharacterData);
	XML_SetProcessingInstructionHandler(_parser, handleProcessingInstruction);
	if (_expandInternalEntities)
		XML_SetDefaultHandlerExpand(_parser, handleDefault);
	else
		XML_SetDefaultHandler(_parser, handleDefault);
	XML_SetUnparsedEntityDeclHandler(_parser, handleUnparsedEntityDecl);
	XML_SetNotationDeclHandler(_parser, handleNotationDecl);
	XML_SetExternalEntityRefHandler(_parser, handleExternalEntityRef);
	XML_SetCommentHandler(_parser, handleComment);
	XML_SetCdataSectionHandler(_parser, handleStartCdataSection, handleEndCdataSection);
	XML_SetDoctypeDeclHandler(_parser, handleStartDoctypeDecl, handleEndDoctypeDecl);
	XML_SetEntityDeclHandler(_parser, handleEntityDecl);
	XML_SetSkippedEntityHandler(_parser, handleSkippedEntity);
	XML_SetParamEntityParsing(_parser, _externalParameterEntities ? XML_PARAM_ENTITY_PARSING_ALWAYS : XML_PARAM_ENTITY_PARSING_NEVER);
	XML_SetUnknownEncodingHandler(_parser, handleUnknownEncoding, this);
}
示例#6
0
XML_Parser OGRCreateExpatXMLParser()
{
    XML_Memory_Handling_Suite memsuite;
    memsuite.malloc_fcn = OGRExpatMalloc;
    memsuite.realloc_fcn = OGRExpatRealloc;
    memsuite.free_fcn = free;
    XML_Parser hParser = XML_ParserCreate_MM(NULL, &memsuite, NULL);

    XML_SetUnknownEncodingHandler(hParser,
                                  OGRExpatUnknownEncodingHandler,
                                  NULL);

    return hParser;
}
示例#7
0
// Does parsing; indicates whether the parsing was successful or not
bool XML_Configure::DoParse()
{
	// Sanity check
	if (!CurrentElement) return false;

	// Create the parser
	Parser = XML_ParserCreate("iso-8859-1");
        XML_SetUnknownEncodingHandler(Parser, XML_JapaneseEncodingHandler, NULL);

	// Set up the callbacks
	XML_SetUserData(Parser, this);
	XML_SetElementHandler(Parser, StaticStartElement, StaticEndElement);
	XML_SetCharacterDataHandler(Parser, StaticCharacterData);
	
	NumInterpretErrors = 0;
	LastOne = true;
	do
	{
		if (!GetData())
		{
			// Report a read error
			ReportReadError();
			XML_ParserFree(Parser);
			return false;
		}

		// Expat should really be using size_t for BufLen
		if (!XML_Parse(Parser, Buffer, (int)BufLen, LastOne))
		{
			// Report a parse error
			ReportParseError(
				XML_ErrorString(XML_GetErrorCode(Parser)),
					XML_GetCurrentLineNumber(Parser));

			XML_ParserFree(Parser);
			return false;
		}
		if (RequestAbort())
		{
			XML_ParserFree(Parser);
			return false;
		}
	}
	while (!LastOne);

	XML_ParserFree(Parser);
	return (NumInterpretErrors == 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);
}
示例#9
0
/************************************************************************
* 函数名: my_xml_parse
* 作  者: sx
* 描  述: 1.封装了expat的解析函数,供xml2struct内部调用
*         2.内部函数
* 输入参数: PARSER_FUN_PARAM *pf,数据集合
*           char *xml_string,顾名思义
* 输出参数: 无
* 返回值: 0表示成功,>0表示错误编号
************************************************************************/
int my_xml_parse(PARSER_FUN_PARAM *pf, char *xml_string, int xml_len)
{
    XML_Parser p;

    p = XML_ParserCreate( NULL );
    if (!p)
    {
        logger(TLOG_ERROR,  "XML_ParserCreate failed!\n" );
        return -1;
    }

//	logger(TLOG_NOTICE,  "XML_ParserCreate success!\n" );

    /* 向句柄上设定准备开始和结束签条 */
    XML_SetElementHandler( p, start_xml, end_xml );

    /* 设置元素内文本的处理函数 */
    XML_SetCharacterDataHandler( p, chardatahandle );

    /* 一次性解析完 */
    //xml_len = strlen( xml_string );

    /* 设置一个共享的数据结构给各各处理函数使用 */
    XML_SetUserData( p, pf );

    /* 把GBK,GB2312等不识别的编码,过滤掉,因为目前仅认为传过来的是英文 */
    XML_SetUnknownEncodingHandler( p, XMLEncodingHandle, 0 );
    if (XML_Parse( p, xml_string, xml_len, 1 ) == XML_STATUS_ERROR)
    {
#if 1
        logger(TLOG_ERROR, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n",
            XML_GetCurrentLineNumber( p ),
            XML_ErrorString(XML_GetErrorCode( p ) ) );
        /* 释放被解析器使用的内存。*/
#endif
        XML_ParserFree( p );
		logger(TLOG_ERROR,  "XML_Parse failed!\n" );
        return -1;
    }
    /* 释放被解析器使用的内存。*/
    XML_ParserFree( p );
    return pf->ret_err;
}
示例#10
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);
}
示例#11
0
文件: xml.cpp 项目: 252525fb/rpcs3
bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding, int flags)
{
#if wxUSE_UNICODE
    (void)encoding;
#else
    m_encoding = encoding;
#endif

    const size_t BUFSIZE = 1024;
    char buf[BUFSIZE];
    wxXmlParsingContext ctx;
    bool done;
    XML_Parser parser = XML_ParserCreate(NULL);

    ctx.root = ctx.node = NULL;
    ctx.encoding = wxT("UTF-8"); // default in absence of encoding=""
    ctx.conv = NULL;
#if !wxUSE_UNICODE
    if ( encoding.CmpNoCase(wxT("UTF-8")) != 0 )
        ctx.conv = new wxCSConv(encoding);
#endif
    ctx.removeWhiteOnlyNodes = (flags & wxXMLDOC_KEEP_WHITESPACE_NODES) == 0;

    XML_SetUserData(parser, (void*)&ctx);
    XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
    XML_SetCharacterDataHandler(parser, TextHnd);
    XML_SetStartCdataSectionHandler(parser, StartCdataHnd);
    XML_SetCommentHandler(parser, CommentHnd);
    XML_SetDefaultHandler(parser, DefaultHnd);
    XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);

    bool ok = true;
    do
    {
        size_t len = stream.Read(buf, BUFSIZE).LastRead();
        done = (len < BUFSIZE);
        if (!XML_Parse(parser, buf, len, done))
        {
            wxString error(XML_ErrorString(XML_GetErrorCode(parser)),
                           *wxConvCurrent);
            wxLogError(_("XML parsing error: '%s' at line %d"),
                       error.c_str(),
                       XML_GetCurrentLineNumber(parser));
            ok = false;
            break;
        }
    } while (!done);

    if (ok)
    {
        if (!ctx.version.empty())
            SetVersion(ctx.version);
        if (!ctx.encoding.empty())
            SetFileEncoding(ctx.encoding);
        SetRoot(ctx.root);
    }
    else
    {
        delete ctx.root;
    }

    XML_ParserFree(parser);
#if !wxUSE_UNICODE
    if ( ctx.conv )
        delete ctx.conv;
#endif

    return ok;

}
示例#12
0
文件: parser.c 项目: suborb/reelvdr
int cParser::DownloadAndParse(const char *url)
{
  CURL *curl_handle;

  // Clear Items list and initialize depth
  Items.Clear();
  depth = 0;
  if (data.memory)
     free(data.memory);
  data.memory = NULL;
  data.size = 0;

  // Init the curl session
  curl_global_init(CURL_GLOBAL_ALL);
  curl_handle = curl_easy_init();

  // Specify URL to get
  curl_easy_setopt(curl_handle, CURLOPT_URL, url);

  // Send all data to this function
  curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);

  // Set maximum file size to get (bytes)
  curl_easy_setopt(curl_handle, CURLOPT_MAXFILESIZE, 1048576);

  // No progress meter
  curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1);

  // No signaling
  curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);

  // Set timeout to 30 seconds
  curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 30);

  // Pass our 'data' struct to the callback function
  curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&data);

  // Some servers don't like requests that are made without a user-agent field
  curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, REELBLOG_USERAGENT);

  // Get it!
  if (curl_easy_perform(curl_handle) != 0) {
     // Cleanup curl stuff
     curl_easy_cleanup(curl_handle);
     // Free allocated memory
     if (data.memory) {
        free(data.memory);
        data.memory = NULL;
        data.size = 0;
        }
     error("cParser::DownloadAndParse(): couldn't download the stream");
     return (RSS_DOWNLOAD_ERROR);
     }

  if (data.size) {
#ifdef DEBUG
     // Only for debug dump
     FILE *fp = fopen("/tmp/reelblog.vdr", "w");
     if (fp) {
        fwrite(data.memory, 1, data.size, fp);
        fclose(fp);
        }
#endif
     // Setup expat
     XML_Parser p = XML_ParserCreate(NULL);
     if (!p) {
        // Cleanup curl stuff
        curl_easy_cleanup(curl_handle);
        // Free allocated memory
        if (data.memory) {
           free(data.memory);
           data.memory = NULL;
           data.size = 0;
           }
        error("cParser::DownloadAndParse(): couldn't allocate memory for parser");
        return (RSS_UNKNOWN_ERROR);
        }
     XML_SetElementHandler(p, StartHandler, EndHandler);
     XML_SetCharacterDataHandler(p, DataHandler);
     XML_SetUnknownEncodingHandler(p, UnknownEncodingHandler, NULL);

     if (XML_Parse(p, data.memory, data.size, 1) == XML_STATUS_ERROR) {
        // Cleanup curl stuff
        curl_easy_cleanup(curl_handle);
        // Free allocated memory
        if (data.memory) {
           free(data.memory);
           data.memory = NULL;
           data.size = 0;
           }
        error("cParser::DownloadAndParse(): Parse error at line %ld:\n%s\n", XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p)));
        return (RSS_PARSING_ERROR);
        }
     }

  // Cleanup curl stuff
  curl_easy_cleanup(curl_handle);
  // Free allocated memory
  if (data.memory) {
     free(data.memory);
     data.memory = NULL;
     data.size = 0;
     }

  return (RSS_PARSING_OK);
}
void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data)
{
	XML_SetUnknownEncodingHandler(parser, handler, data);
}
示例#14
0
void XMLParser::EnableUnknownEncodingHandler(bool enable)
{
	assert(m_parser != NULL);
	XML_SetUnknownEncodingHandler(m_parser, enable ? UnknownEncodingHandler : NULL, NULL);
}
示例#15
0
void xs_infoset_scan(xsMachine* the)
{
	int c = xsToInteger(xsArgc);
	Scanner scanner;
	Scanner* self;
	xsVars(COUNT);
	xsTry {
		self = &scanner;
		c_memset(self, 0, sizeof(Scanner));
		if (c < 1)
			xsSyntaxError("no buffer");
		
		self->expat = XML_ParserCreate(NULL);
		xsThrowIfNULL(self->expat);
		XML_SetUserData(self->expat, self);
		XML_SetElementHandler(self->expat, scanStartTag, scanStopTag);
		XML_SetCdataSectionHandler(self->expat, scanStartCdata, scanStopCdata);
		XML_SetCharacterDataHandler(self->expat, scanCharacter);
		XML_SetCommentHandler(self->expat, scanComment);
		XML_SetProcessingInstructionHandler(self->expat, scanProcessingInstruction);
		XML_SetUnknownEncodingHandler(self->expat, scanUnknownEncoding, NULL);
		XML_SetSkippedEntityHandler(self->expat, scanEntity);
		
		self->result = 1;
		self->textBuffer = c_malloc(8192);
		xsThrowIfNULL(self->textBuffer);
		self->textSize = 8192;
		
		self->the = the;
		xsVar(ATTRIBUTE_PROTOTYPE) = xsGet(xsThis, xsID_attribute);
		xsVar(CDATA_PROTOTYPE) = xsGet(xsThis, xsID_cdata);
		xsVar(COMMENT_PROTOTYPE) = xsGet(xsThis, xsID_comment);
		xsVar(DOCUMENT_PROTOTYPE) = xsGet(xsThis, xsID_document);
		xsVar(ELEMENT_PROTOTYPE) = xsGet(xsThis, xsID_element);
		xsVar(NO_NAMESPACE) = xsString("");
		xsVar(NO_PREFIX) = xsString("");
		xsVar(PATH) = (c > 1) ? xsArg(1) : xsUndefined;
		xsVar(PI_PROTOTYPE) = xsGet(xsThis, xsID_pi);
		xsVar(XML_NAMESPACE) = xsGet(xsThis, xsID_xmlnsNamespace);
		xsVar(XML_PREFIX) = xsGet(xsThis, xsID_xmlnsPrefix);
		
		xsResult = xsNewInstanceOf(xsVar(DOCUMENT_PROTOTYPE));
		xsSet(xsResult, xsID_encoding, xsString("UTF-8"));
		xsSet(xsResult, xsID_version, xsString("1.0"));
		xsVar(CHILDREN) = xsNewInstanceOf(xsArrayPrototype);
		xsArrayCacheBegin(xsVar(CHILDREN));
		xsSet(xsResult, xsID_children, xsVar(CHILDREN));
		xsSet(xsResult, xsID_parent, xsNull);
		xsSet(xsResult, xsID_xmlnsAttributes, xsNull);

		if (xsIsInstanceOf(xsArg(0), xsChunkPrototype)) {
			xsStringValue buffer = xsGetHostData(xsArg(0));
			xsIntegerValue size = xsToInteger(xsGet(xsArg(0), xsID_length));
			self->result = XML_Parse(self->expat, (const char *)buffer, size, 1);
		}
		else if (xsTypeOf(xsArg(0)) == xsStringType) {
			xsStringValue string = xsToString(xsArg(0));
			xsIntegerValue stringOffset = 0;
			xsIntegerValue stringSize = c_strlen(string);
			while (self->result && (stringOffset < stringSize)) {
				xsIntegerValue size = stringSize - stringOffset;
				xsStringValue buffer = (char *)XML_GetBuffer(self->expat, 1024);
				xsThrowIfNULL(buffer);
				if (size > 1024) 
					size = 1024;
				c_memcpy(buffer, string + stringOffset, size);
				self->result = XML_ParseBuffer(self->expat, size, (size < 1024) ? 1 : 0);
				stringOffset += size;
				string = xsToString(xsArg(0)); // @@ gc
			}
		}
		else {
			xsStreamGetter* streamGetter = xsGetHostData(xsArg(0));
			while (self->result) {
				xsIntegerValue i;
				xsStringValue p, buffer = (char *)XML_GetBuffer(self->expat, 1024);
				xsThrowIfNULL(buffer);
				for (i = 0, p = buffer; i < 1024; i++, p++) {
					int c = (*(streamGetter->getter))(streamGetter->stream);
					if (c == C_EOF)
						break;
					*p = (char)c;
				}
				self->result = XML_ParseBuffer(self->expat, i, (i < 1024) ? 1 : 0);
				if (i < 1024)
					break;
			}
		}
		
		xsDelete(xsResult, xsID_xmlnsAttributes);
		xsDelete(xsResult, xsID_parent);
		xsArrayCacheEnd(xsVar(CHILDREN));
		
		if (!self->result) {
			xsVar(LINE) = xsInteger(XML_GetCurrentLineNumber(self->expat));
			xsVar(VALUE) = xsString((char*)XML_ErrorString(XML_GetErrorCode(self->expat)));
			if (xsHas(xsThis, xsID_reportError))
				xsCall3_noResult(xsThis, xsID_reportError, xsVar(PATH), xsVar(LINE), xsVar(VALUE));
			xsThrow(xsNewInstanceOf(xsSyntaxErrorPrototype));
		}
		c_free(self->textBuffer);
		self->textBuffer = NULL;
		XML_ParserFree(self->expat);
		self->expat = NULL;
	}
	xsCatch {
		if (self->textBuffer)
			c_free(self->textBuffer);
		if (self->expat)
			XML_ParserFree(self->expat);
	}
}
示例#16
0
int cRssParser::DownloadAndParse(const char *urlP)
{
  CURL *curl_handle;

  // Clear items list and initialize depth
  itemsM.Clear();
  depthS = 0;
  ResetMemory();

  // Init the curl session
  curl_global_init(CURL_GLOBAL_ALL);
  curl_handle = curl_easy_init();

  // Specify URL to get
  curl_easy_setopt(curl_handle, CURLOPT_URL, urlP);

  // Specify HTTP proxy: my.proxy.com:80
  if (RssReaderConfig.IsUseProxy()) {
     curl_easy_setopt(curl_handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
     curl_easy_setopt(curl_handle, CURLOPT_PROXY, RssReaderConfig.GetHttpProxy());
     }

  // Send all data to this function
  curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);

  // Set maximum file size to get (bytes)
  curl_easy_setopt(curl_handle, CURLOPT_MAXFILESIZE, 1048576L);

  // No progress meter
  curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L);

  // No signaling
  curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1L);

  // Follow location
  curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);

  // Set timeout to 15 seconds
  curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 15L);

  // Pass our 'data' struct to the callback function
  curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&dataM);

  // Some servers don't like requests that are made without a user-agent field
  curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s", PLUGIN_NAME_I18N, VERSION));

  // Get it!
  if (curl_easy_perform(curl_handle) != 0) {
     // Cleanup curl stuff
     curl_easy_cleanup(curl_handle);
     ResetMemory();
     error("%s (%s) Couldn't download the stream", __PRETTY_FUNCTION__, urlP);
     return (RSS_DOWNLOAD_ERROR);
     }

  if (dataM.size) {
     // Only for debug dump
     if (RssReaderConfig.IsTraceMode(cRssReaderConfig::eTraceModeDebug15)) {
        int fd;
        char tmpname[NAME_MAX];
        strn0cpy(tmpname, TMPDIR "/vdr-" PLUGIN_NAME_I18N ".XXXXXX", sizeof(tmpname));
        fd = mkstemp(tmpname);
        if (fd >= 0) {
           if (write(fd, dataM.memory, dataM.size) != (ssize_t)dataM.size)
              error("%s (%s) Couldn't write debug dump correctly into '%s'", __PRETTY_FUNCTION__, urlP, tmpname);
           else
              debug15("%s (%s) Wrote debug dump into '%s'", __PRETTY_FUNCTION__, urlP, tmpname);
           close(fd);
           }
        else
           error("%s (%s) Couldn't open file '%s'", __PRETTY_FUNCTION__, urlP, tmpname);
        }

     // Setup expat
     XML_Parser p = XML_ParserCreate(NULL);
     if (!p) {
        // Cleanup curl stuff
        curl_easy_cleanup(curl_handle);
        ResetMemory();
        error("%s (%s) Couldn't allocate memory for parser", __PRETTY_FUNCTION__, urlP);
        return (RSS_UNKNOWN_ERROR);
        }
     XML_SetElementHandler(p, StartHandler, EndHandler);
     XML_SetCharacterDataHandler(p, DataHandler);
     XML_SetUnknownEncodingHandler(p, UnknownEncodingHandler, NULL);

     if (XML_Parse(p, dataM.memory, (int)dataM.size, XML_TRUE) == XML_STATUS_ERROR) {
        // Cleanup curl stuff
        curl_easy_cleanup(curl_handle);
        ResetMemory();
        error("%s (%s) Parse error at line %ld: %s", __PRETTY_FUNCTION__, urlP, XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p)));
        return (RSS_PARSING_ERROR);
        }
     }

  // Cleanup curl stuff
  curl_easy_cleanup(curl_handle);
  ResetMemory();

  return (RSS_PARSING_OK);
}