04-29-2005 8:02 AM
Hi all,
I have problem with XML file.
I create XML file on the application server use XML Library.
TYPES: begin of xml_line,
data(512) type X,
end of xml_line.
DATA: xml_table type table of xml_line.
document = g_ixml->create_document( ).
document->set_version( version = '1.0' ).
encoding = g_ixml->create_encoding( character_set = 'UTF-8' byte_order = 0 ).
document->set_encoding( encoding = encoding ).
.......
.......
.......
*-- create the stream factory
pStreamFactory = g_ixml->create_stream_factory( ).
*-- create an output stream for the table
pOStream = pStreamFactory->create_ostream_itable( table = xml_table ).
call method Document->render( ostream = pOStream ).
totalSize = pOStream->get_num_written_raw( ).
OPEN DATASET filename FOR OUTPUT IN BINARY MODE.
LOOP AT xml_table INTO wa_xml_table.
TRANSFER wa_xml_table-data TO filename.
ENDLOOP.
CLOSE DATASET filename.
I have the problems:
1) I created the xml file. At the end of this file are garbage, i.e. after final tag are garbage "</povidomlen> ADR_OBL_P /CEEIB/UAF_BP 000002000000".
2) In this file are symbols "¶" after a every 512 symbols.
Thanks a lot,
Igor
05-20-2005 4:33 PM
05-21-2005 6:52 AM
1. You have missed the length control, and your loop should be as follows:
DATA:
line_len TYPE i.
line_len = 512.
<b>LOOP</b> <b>AT</b> xml_table <b>INTO</b> wa_xml_table.
<b>IF</b> line_len > totalSize.
line_len = totalSize.
totalSize = 0.
<b>ELSE</b>.
<b>SUBTRACT</b> line_len <b>FROM</b> totalSize.
<b>ENDIF</b>.
<b>TRANSFER</b> wa_xml_table-data <b>TO</b> filename
<b>LENGTH</b> line_len.
<b>ENDLOOP</b>.
2. Unfortunately do not know where symbol "¶" appears from.
Message was edited by: Sergei Korolev