Thanks Dan.


From: dkimmel@xxxxxxxxxxxxxxx
To: midrange-l@xxxxxxxxxxxx
Date: Thu, 12 Jan 2012 15:17:50 -0600
Subject: RE: expat XML parsing problem,CPF9897: Parse error at line 1: unknown encoding

CCSID for ISO-8859-9 is 820. You aren't consistent. You have CCSID of the file as 819, you told the parser 8859-1 and the encoding in the xml header is 8859-9.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of cevdet macit
Sent: Thursday, January 12, 2012 12:11 PM
To: midrange-l
Subject: RE: expat XML parsing problem,CPF9897: Parse error at line 1: unknown encoding


Hi Kimmel,
Yes, I wrote '/tmp/tcmb_kur.xml' file to ifs with ccsid=819 option.
And during debug i can see clearly first 1024 characters of xml text in BUFF field(not whole xml code).Totel xml code is almost 8K.
With iseries navigator program I copy-pasted xml file to desktop and made 'text file compare' to file in the url.The result was 'identical'.
p = XML_ParserCreate(XML_ENC_ISO8859_1); : program source has this line.
Thank you


From: dkimmel@xxxxxxxxxxxxxxx
To: midrange-l@xxxxxxxxxxxx
Date: Thu, 12 Jan 2012 09:49:52 -0600
Subject: RE: expat XML parsing problem,CPF9897: Parse error at line 1: unknown encoding

Make sure the coded character set id of the file expat is reading matches the ISO-8859-9 encoding. The parser should be using the encoding, but IBMi is translating (or not) based on the CCSID value in the file descriptor. I'm not familiar with 8859-9. For 8859-1, character set 819 works. To see CCSID, use WRKLNK option 8.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of cevdet macit
Sent: Thursday, January 12, 2012 8:55 AM
To: midrange-l
Subject: expat XML parsing problem,CPF9897: Parse error at line 1:
unknown encoding


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
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.