2010 Jul 05 9:54 AM
hi ,
i create one spacific format xml using i xml but the format spacification i don't want this tag is '?xml version="1.0"?
my sample code is ::
<?xml version="1.0" ?> ) i want tot trmove )
- <ENVELOPE>
- <HEADER>
<TALLYREQUEST>Import data</TALLYREQUEST>
</HEADER>
- <BODY>
- <IMPORTDATA>
- <REQUESTDESC>
<REPORTNAME>Vouchers</REPORTNAME>
- <STATICVARIABLES>
regards
venkat
2010 Jul 05 1:35 PM
I know you can do it with the transformations, but I don't know with iXML.
So you could at least "transform" the xml stream that is output by iXML:
CALL TRANSFORMATION id
SOURCE XML l_string
RESULT XML l_string
OPTIONS xml_header = 'no'.
As it probably has a significant memory/performance cost, you may also use this simple replacement:
REPLACE REGEX '^<\?xml.*\?>' IN l_string WITH ``.
2012 May 15 6:52 AM
Hello Venkat,
How did you solve this issue? I am also generating XML file using ixml interface. and I want to remove the header part : <?xml version="1.0" >
Thanks and regards,
MadhuriS
2012 May 15 9:54 AM
Hi Sandra,
Thanks! your solution works.
I did through following way
call transformation id
source xml L_XML_TABLE
result XML L_STRING
options
xml_header = 'no'.
call transformation id
source xml L_STRING
result XML L_XML_TABLE.
And it works.
It saved my lot of time of doing it again using simple transformations.
Hope I could have assign full marks to your solution
Regards,
Madhuri
2024 Jan 26 8:22 PM
With IXML, you may use "document->set_declaration( abap_false )" to not render the XML header:
ixml = cl_ixml=>create( ).
document = ixml->create_document( ).
element = document->create_simple_element( name = 'ROOT'
parent = document ).
stream_factory = ixml->create_stream_factory( ).
ostream = stream_factory->create_ostream_xstring( xstring ).
renderer = ixml->create_renderer( ostream = ostream
document = document ).
document->set_declaration( abap_false ).
rc = renderer->render( ).
cl_abap_unit_assert=>assert_equals( act = cl_abap_codepage=>convert_from( xstring )
exp = '<ROOT/>' ).