‎2007 Feb 08 11:49 AM
Hello, is there an easy way to create an XML File with this schema?
<?xml version="1.0" encoding="utf-16"?>
<Persons>
<Identity Name="Charles" Name2="Mayer" Job="Development" />
<Identity Name="Max" Name2="Mayer" Job="Sales" />
</Persons>
‎2007 Feb 10 7:43 AM
check this sample code.
REPORT yxmlattribute.
TYPES: BEGIN OF p_type ,
identity(10),
END OF p_type .
DATA: l_xml TYPE REF TO cl_xml_document ,
if_xml TYPE REF TO if_ixml_document ,
node TYPE REF TO if_ixml_node .
data: wa_persons type p_type .
DATA: xml_out TYPE string .
CALL TRANSFORMATION id
SOURCE persons = wa_persons
RESULT XML xml_out.
CREATE OBJECT l_xml.
CALL METHOD l_xml->parse_string
EXPORTING
stream = xml_out.
node = l_xml->find_node(
name = 'IDENTITY'
* ROOT = ROOT
).
l_xml->set_attribute(
name = 'Name'
value = 'Charles'
node = node
).
l_xml->set_attribute(
name = 'Name2'
value = 'Mayer'
node = node
).
l_xml->set_attribute(
name = 'Job'
value = 'Development'
node = node
).
CALL METHOD l_xml->display.Regards
Raja
‎2007 Feb 10 7:43 AM
check this sample code.
REPORT yxmlattribute.
TYPES: BEGIN OF p_type ,
identity(10),
END OF p_type .
DATA: l_xml TYPE REF TO cl_xml_document ,
if_xml TYPE REF TO if_ixml_document ,
node TYPE REF TO if_ixml_node .
data: wa_persons type p_type .
DATA: xml_out TYPE string .
CALL TRANSFORMATION id
SOURCE persons = wa_persons
RESULT XML xml_out.
CREATE OBJECT l_xml.
CALL METHOD l_xml->parse_string
EXPORTING
stream = xml_out.
node = l_xml->find_node(
name = 'IDENTITY'
* ROOT = ROOT
).
l_xml->set_attribute(
name = 'Name'
value = 'Charles'
node = node
).
l_xml->set_attribute(
name = 'Name2'
value = 'Mayer'
node = node
).
l_xml->set_attribute(
name = 'Job'
value = 'Development'
node = node
).
CALL METHOD l_xml->display.Regards
Raja