2011 Sep 19 7:16 PM
Hi Experts,
I am develpoing a program to generate xml file as output. I am using the method CL_IXML and other interfaces to generate the xml data. Here I need to create a root element. I did search in SDN but I couldnot found anything to generate xml root element.
My output should be like this:
<?xml version="1.0" encoding="UTF-8"?>
<Request Version="11.1" IssuerID="1">
<CreatePurchaseRequest
RequestID="123456"
Commonname="test"
........
........
</CreatePurchaseRequest>
</Request>
Can anybody plz suggest how can I generate the root element Request here?
Regards,
Ranganadh.
2011 Sep 19 9:56 PM
Hi,
The first node created in the document, will be the root node (root element if you prefer).
If you want more information, please paste your code.
Sandra
Hi,
The first node created in the document, will be the root node (root element if you prefer).
If you want more information, please paste your code.
Sandra
2011 Sep 19 9:56 PM
Hi,
The first node created in the document, will be the root node (root element if you prefer).
If you want more information, please paste your code.
Sandra
2011 Sep 20 8:45 PM
Thanks Sandra,
My issue got resolved.
I just created the root element using the method create_sample_element and set the attributes using set_attributes method.
Thanks for your help.
w_ixml = cl_ixml=>create( ).
w_document = w_ixml->create_document( ).
w_root = w_ixml->create_document( ).
IF w_document IS INITIAL.
RAISE EXCEPTION TYPE cx_cmx_da_exception
EXPORTING
textid = cx_cmx_da_exception=>cx_cmx_da_error_internal.
ENDIF.
w_encoding = w_ixml->create_encoding(
character_set = 'utf-8'
byte_order = if_ixml_encoding=>co_none ).
w_document->set_encoding( w_encoding ).
w_element_inv1 = w_document->create_simple_element(
name = 'OrbiscomRequest'
parent = w_document ).
w_element_inv1->set_attribute( name = 'Version'
namespace = ''
value = '11.1' ).
w_element_inv1->set_attribute( name = 'IssuerID'
namespace = ''
value = '1' ).
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |