×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi all,
My program reads an .xml file from ifs and parses it . I am using Scott Klement's expat tool.(And thanks to him very much).
The program opens and reads the file but can not parse it. I get CPF9897: Parse error at line 1: unknown encoding message whenever i run the program.
this is the line error occurs: if (XML_Parse(p: Buff: len: done) = XML_STATUS_ERROR);
I think my .xml file does not have a syntax problem.Because I've validated the it by
http://www.w3schools.com/xml/xml_validator.asp.
.Xml file header: <?xml version="1.0" encoding="ISO-8859-9"?> .
The xml file can be accessed at
http://www.tcmb.gov.tr/kurlar/today.xml.
I think i am doing a very basic mistake.I could not find out what i've been doing wrong,any help is appreciated.
Thanks in advance
Cevdet
Main part of my rpg code:
/free
fd = open('/tmp/tcmb_kur.xml': O_RDONLY+O_TEXTDATA);
if (fd < 0);
EscErrno(errno);
endif;
p = XML_ParserCreate(XML_ENC_ISO8859_1);
if (p = *NULL);
callp close(fd);
die('Couldn''t allocate memory for parser');
endif;
XML_SetStartElementHandler(p: %paddr(start));
XML_SetEndElementHandler(p: %paddr(end));
XML_SetCharacterDataHandler(p: %paddr(chardata));
dou (done = 1);
len = read(fd: %addr(Buff): %size(Buff));
if (len < 1);
done = 1;
endif;
if (XML_Parse(p: Buff: len: done) = XML_STATUS_ERROR);
callp close(fd);
die('Parse error at line '
+ %char(XML_GetCurrentLineNumber(p)) + ': '
+ %str(XML_ErrorString(XML_GetErrorCode(p))));
endif;
enddo;
XML_ParserFree(p);
callp close(fd);
*inlr = *on;
/end-free
As an Amazon Associate we earn from qualifying purchases.