View previous topic :: View next topic
|
Author |
Message |
princegaurav
New User
Joined: 08 Dec 2005 Posts: 9
|
|
|
|
Hi ,
I have huge XML string of 2GB . I want to parse it using PLISAXC . The input is provided as pointer to
DCL 1 Input based (inpptr),
2 Data(64) char (32767);
I call the PLISAXC with the addr(Data(1)) and length(Data1). The 1st element is parsed however when I assign the address and length of next element in END_OF_INPUT event to addr_xml and length_xml .
The parser returns subsequent blank string . I checked using Debugger, if the xmltoken in the parser is assigned the new address. To my surprise it had the old value .
Can any one help me as how the memory address is passed in PLISAXC for huge data .
Thanks in advance. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Maybe you show the relevant code/declarations. |
|
Back to top |
|
|
princegaurav
New User
Joined: 08 Dec 2005 Posts: 9
|
|
|
|
This is the sample code that i was testing before handling the 2GB XML.
Here I took and array of character length(100) .
I get the parsed value for xmlarray(1) properly however for rest of the element are blank .... not sure if the length is proper .
test: proc (inpxml,outxml) options(reentrant,fetchable) reorder;
dcl xmlarray(04) char(100) init(' ');
xmlarray(1) =
'<?xml version="1.0" standalone="yes"?>'
!! '<!--This document is just an example-->'
!! '<sandwich>';
xmlarray(2) = trim(
'<bread type= "baker s best"/>'
!! '<?spread please use'
!! 'real mayonnaise ?>');
xmlarray(3) = trim(
'<meat>Ham & turkey</meat>'
!! '<filling>Cheese, lettuce, tomato, etc </filling>' );
xmlarray(4) = trim(
'<![CDATA[We should add a <relish> element in future!]]>'
!! '</sandwich>'
!! ' ');
p = addr(xmlarray);
call plisaxc (eventHandler,
addr(token),
addr(xmlarray(i)),
length(xmlarray(i)));
end test ;
dcl ptr1 pointer init(null);
dcl chars(04) char(100) based (ptr1);
dcl i fixed bin(31) init(1);
start_of_document: proc(userToken)
returns( byvalue fixed bin(31) )
options( byvalue linkage(optlink) );
return(0);
end;
.......
/* I have only modified end_of_input */
end_of_input: proc( userToken, addr_xml, length_xml )
returns( byvalue fixed bin(31) )
options( byvalue linkage(optlink) );
dcl userToken pointer;
dcl addr_xml byaddr pointer;
dcl length_xml byaddr fixed bin(31);
i += 1;
if (i<=4) then do ;
addr_xml = addr(Chars(i)) ;
length_xml = length(chars(i));
return(0);
end;
end;
/****** output *****/
start_of_documentLength = 0.00000E+00
1.0........yes0...........This document is just an example0...........sandwich..
1.0
version_information <1.0>
standalone_declaration <yes>
comment <This document is just an example>
start_tag_of_element <sandwich>
tag_content_characters < >
!!flags = 11000000
Chars(2)
tag_content_characters <>
!!flags = 01000000
start_tag_of_element <read.>
attribute_name <yonn>
attribute_characters < >
end_tag_of_element < >
processing_instruction <......>
tag_content_characters <..................................>
!!flags = 11000000
Chars(3)
tag_content_characters <>
!!flags = 01000000
start_of_cdata
tag_content_characters <...........................................>
end_of_cdata
end_tag_of_element <........>
end_of_document |
|
Back to top |
|
|
princegaurav
New User
Joined: 08 Dec 2005 Posts: 9
|
|
|
|
If I get some clue how to use multiple buffers in PLISAXC will also be useful . |
|
Back to top |
|
|
|