problem in parsing xml file using syexpat
| Tue, 2006-05-30 14:00 | |
|
hi,
i am reading a xml file from my application path and parsing it. I have 4 tags in it id,name1,name2,name3. Now I want to store name1,2 and 3 in an array. i make array like this name1 = new (ELeave) CDesCArrayFlat(7); According to syexpat , I set up the buffer with a default size of 128 bytes. the problem is that the string in name3 can be max about 256 characters. when i print the values of the array some of my strings are divided into two location of an array. for eg: first name will be in name[0] and name[1] second will be in name[2] third will be in name[3] fourth will be in name[4] and name[5] i am unable to understand the problem. i could just find out that it reads128 bytes and if partial tag is read then the tag is stored at one location of array and the rest at other location. thanks sunny |
|






Forum posts: 18
One solution can be u can increase the syexpat buffer size or else u can capture the tags separately.
I think it is line by line parsing bcoz once the 128 bits get filled, it flushes and reuse the same buffer. so u need to capture first 128bits and 2nd 128 bits....
Ur logic should differentiate the tags and store it accordingly. I have implemented xml parsing using expat. It depends on you how u control the parsing process..
Forum posts: 128
if i increase the size then also somewhere or the other i get an error.
can u tell me how u implemented it.
thanks
sunny
Forum posts: 18
There will be three functions
1.) starttag 2.) content b/w tags 3.) end tag.
ex: <start>hello<\start>
according to the program flow first it comes to the start tag function. inside the start tag fun i wrote a subroutine so that the starttag is stored in some buffer or an array.
u will get "hello" from second func there also u write a subroutine to store the values....
why subroutine is? bcoz ur temporirly stopping the parsing for storing the details.
unless untill it finishes the subroutin part it wont continue parsing.
May be this logic may not that good from ur point of u but i have done in this way.. code i cant give bcoz it is already licensed.