Converting XML to string

I have an xml file titled config.xml that looks like this.
<textChanges>
     <change id = “22833” whatToAdd = “\n\n” whereToAdd = “Front”></change>
     <change id = “22843” whatToAdd = “\n” whereToAdd = “End”></change>
</textChanges>
I’m processing this code inorder to automatically add \n to the front or end of a line found in an xml file titled textXML.
Here is the processing code:
var textToInsert:String = textXML.text.(@id == i);
     var textAddition:String = config.textChanges.change.(@id == i).@whatToAdd;
     if (textAddition != “”)
         var textLoc:String = config.textChanges.change.(@id == i).@whereToAdd;
         if (textLoc == “Front”)
             textToInsert = textAddition + textToInsert;
         else if (textLoc == “End”)
             textToInsert = textToInsert + textAddition;
         trace(”“);
         trace(finalText;);
         trace(”“);
This traces the correct line of code from textXML, but the \n\n shows  up in the text and doesn’t add the carriage returns.  The crazy thing  is, it works if I replace textAddition with “\n\n”.  I figure this is  happening because of some weird formatting issue.  So I’ve tried many  ways of formatting the textAddition var to a string.  Each time has had  no effect.
Does anyone have any ideas?  Any help is really appreciated.

It is your second post where it feels like it is an overkill. Why not to use plain html in your xml for text formatting, line breaks, etc.?

Similar Messages

  • Converting XML to String in OSB

    Hi All,
    Is there any function (apart from fn-bea:serialize function) for converting XML payload to a String in OSB. Please let me know.
    Thanks,
    Bpeltechie

    That's how it's worded by W3C
    http://www.w3.org/TR/REC-xml/#syntax
    The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment,
    a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the
    strings " &amp; " and " & lt; " respectively. The right angle bracket (>) may be represented using the string " & gt; ", and must, for compatibility, be
    escaped using either " & gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end
    of a CDATA section.Note that it says left angle bracket must not appear in their literal form, but the right angle bracket may be represented using the string " &amp;gt; "
    Cheers,
    Vlad

  • Converting XML data string in to file object to parse

    Hi
    I have XML in the form of String .. i just want to convert this string in to a file to parse.. how can i do that ..<p>
    Here is my xml string<p>
    String str = "<?xml version="1.0"?>
    <!DOCTYPE some SYSTEM "some.dtd">
    <firsttag>
         <childtag>
              <name>some name</name>
              <age>age</age>
         </childtag>
    </firsttag>";<p>
    if u have code that would be great
    Thanks in advance

    Hi
    I have XML in the form of String .. i just want to
    convert this string in to a file to parse.. how can i
    do that ..<p>
    Why not to use RandomAccessFile to write string to file(you need to do this? is i'm right?)

  • Converting XML(as String) to XML(XMLObject) in WLI8.1

    Hi,
    I am new to WLI 8.1. In my business process I receive an XML from client as Java
    String. Now I want to convert it into com.bea.xml.XMLObject to perform XSL Transformation.
    How do I do it in WLI workshop.
    Is it possible in WLI8.1 to use XML in the form of Java String as Input/Output
    for XSL Transformation.
    Thanks in advance
    Ashish

    I can think of 2 options.
    a) Take the generated XMLObject for the XML as input to JPD - this is the default
    behaviour when you use WLW when you configure you client request control method
    to take the XSD as the input.
    b) If you to take java.lang.String as input to the JPD method then by default
    the transformation tool does NOT parse it as XML. You will have to write custome
    code (using xquery/xpath or supply an xslt) to parse the XML to build the XMLObject.
    The client would still send an XML request in both scenarios... and so both the
    above options would not impact clients.
    Hope this helps...
    Vishwa
    "Ashish Agrawal" <[email protected]> wrote:
    >
    Hi,
    I am new to WLI 8.1. In my business process I receive an XML from client
    as Java
    String. Now I want to convert it into com.bea.xml.XMLObject to perform
    XSL Transformation.
    How do I do it in WLI workshop.
    Is it possible in WLI8.1 to use XML in the form of Java String as Input/Output
    for XSL Transformation.
    Thanks in advance
    Ashish

  • How To Convert XML into String?

    Hi,
    I have a requirement in which I need to convert the data from XML file to string.
    E.g.
       <Drawing>
          <DrawingSpecification>
             <Header>
                <SoldTo>SDN</SoldTo>
                <SoldToName>SAP</SoldToName>
                <Date/>
                <Manager>CEO</Manager>
                < Plant>INDIA</Name>
                <Items>
                   <Item>
                       < MaterialNumber>MatNum12</ MaterialNumber>
                       <ProductNumber>ProName12</ ProductNumber>
                   </Item>
               </Items>
               < ClientId>ClientID123</ ClientId>
               <FileName>FileName123</FileName>
               <Type/>
               < TemplateName/>
          </DrawingSpecification>
          <Image contentType=""/>
       < /Drawing>
    Output should be like:
       < File>
          < Content> SDN SAP CEO INDIA MatNum12 ProName12 ClientID123 FileName123</Content>
       < /File>
    Please provide solution for the same.
    Thanks,
    Abhishek.

    what about something like this
    package test;
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class Test {
         public static void main(String args[]) throws Exception {
              DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
              DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
              Document doc = docBuilder.parse(new File("test.xml"));
              StringBuffer buffer = new StringBuffer();
              appendChildren(buffer, doc.getChildNodes());
              System.out.println(buffer.toString());
         private static void appendChildren(StringBuffer buffer, NodeList list) {
              for (int i = 0; i < list.getLength(); i++) {
                   Node node = list.item(i);
                   if (node.getNodeValue() != null) {
                        if (node.getNodeValue().trim().length() > 0) {
                             buffer.append(node.getNodeValue()).append("|");
                   appendChildren(buffer, node.getChildNodes());
    ...btw: IMHO the use of this forum is to get an answer to an particular question - not to ask for complete solutions - create the solution yourself an ask if you are stuck somewhere (with a bit of research (google) it is not hard to find a solution for your problem)
    regards franz
    ...close thread if question is answered

  • Error converting XML to String

    I'm trying to use getXMLString() to put my XML document in a String variable. I get the following when I try to output the String:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: This object has been closed. If the close() was implicit, and you would like the object not to be closed between calls, see the keepCursorAlive() method</ERROR>
    If I just output the XML doc without putting it into a String variable it works fine.
    System.out.println(q.getXMLString()); //OK
    // get the XML document in string format
    String xmlString = q.getXMLString(); //NOT OK
    System.out.println(xmlString);
    What am I doing wrong? Any help would be great!
    Thanks,
    Melani

    Hi,
    SMUM_XML_PARSE is a simplified, unreleased and undocumented version of the powerful, released and documented iXML
    If you look at the GET_ELEMENT subroutine in that function module, you'll see that the nodes of type CO_NODE_CDATA_SECTION are simply ignored.
    The simpliest thing for you, maybe, is to duplicate the code of SMUM_XML_PARSE (as it is rather easy to handle), and add a section to GET_ELEMENT. You'll have also to use IF_IXML_CDATA_SECTION interface and ixml_iid_cdata_section constant.
    Documentation is here: [SAP Library: Interface if_ixml_cdata_section|http://help.sap.com/saphelp_nw70/helpdata/en/bb/576658dca511d4990b00508b6b8b11/frameset.htm ]
    Best regards,
    Sandra

  • Error While converting xml to sap abap string.

    Hi Experts,
    As i am doing an cross Application from SAP to .Net and vice versa.I am receiving an xml from .Net and it should be converted to ABAP string Using the following function module   SMUM_XML_PARSE 
    And the following string i am receiving from .net
    <Root><qApprovalInfo><RequesterId>xxxx</RequesterId><RequesterName>xxx</RequesterName><ApproverId>xxxx</ApproverId><ApproverLevel>1</ApproverLevel><PendingApprovalId>0200169911</PendingApprovalId><CreatedDate>20/07/2011</CreatedDate><CreatedBy>xx</CreatedBy><ModifiedDate>2011-07-20 16:45</ModifiedDate><ModifiedBy>xxxx</ModifiedBy><ApplicationCode>EPAY</ApplicationCode><WorkFlowCode>EPX</WorkFlowCode><ApprovalStatus>APPROVED</ApprovalStatus><ActionComments><![CDATA[APPROVED(through  Desktop)]]></ActionComments><Mode>CREATE</Mode><ActionSource>DESKTOP</ActionSource></qApprovalInfo><qApprovalHidden><Approverl>40002664</Approver><EmployeeId>40016515</EmployeeId></qApprovalHidden></Root>
    In this xml i am getting all the values except the <ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments>
    is their any way to convert that CDATA value?..
    have anybody come across the following issue ?...
    can anybody provide the solution for this?.
    Edited by: basavaraj.p on Aug 29, 2011 10:54 AM

    Hi,
    SMUM_XML_PARSE is a simplified, unreleased and undocumented version of the powerful, released and documented iXML
    If you look at the GET_ELEMENT subroutine in that function module, you'll see that the nodes of type CO_NODE_CDATA_SECTION are simply ignored.
    The simpliest thing for you, maybe, is to duplicate the code of SMUM_XML_PARSE (as it is rather easy to handle), and add a section to GET_ELEMENT. You'll have also to use IF_IXML_CDATA_SECTION interface and ixml_iid_cdata_section constant.
    Documentation is here: [SAP Library: Interface if_ixml_cdata_section|http://help.sap.com/saphelp_nw70/helpdata/en/bb/576658dca511d4990b00508b6b8b11/frameset.htm ]
    Best regards,
    Sandra

  • Strange problem in converting between XML to string and vice versa

    i have an application that needs to send an XML document
    over the wire. For this reason, I need to convert the
    doc into a String at the sending side and back to Doc
    at the receiving side. This document is stored in a "CLOB"
    column in a table in the database. I use XDK to retrieve
    this entire row (including the CLOB - hence this is an XML
    document which has a column that itself is an xml document in
    string format - this is just the clob read in by XDK).
    Thus the row looks like
    <ROWSET>
    <ROW>
    <col1> A <col1>
    <CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
    </ROW>
    </ROWSET>
    When I convert this document into String and back, one of the "<"
    tags in the clob column document gets changed to "&lt;" and hence
    the parsing fails! I have used the latest label of the XDK build
    to get the latest parser jar but still i have the same problem.
    I am using the following routines for the conversion.
    /* for converting document to string */
    public static String convertToString(XMLDocument xml) throws
    IOException
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    xml.print(pw);
    String result = sw.toString();
    return result;
    /* for converting string to document */
    public static XMLDocument convertToXml(String xmlStr)
    throws
    IOException,SAXException
    ByteArrayInputStream inStream = new
    ByteArrayInputStream(xmlStr.getBytes());
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(false);
    parser.parse(inStream);
    return parser.getDocument();

    How do you get the XML document? Do you use XSU? You can use:
    String str = qry.getXMLString();
    to get the result XML document in String.
    XSU will escape all of the < and >. Or the the XML document in
    one of the column will make the result XML doc not well-formed.
    Not quite understand your problem. You can send me your test
    case.
    i have an application that needs to send an XML document
    over the wire. For this reason, I need to convert the
    doc into a String at the sending side and back to Doc
    at the receiving side. This document is stored in a "CLOB"
    column in a table in the database. I use XDK to retrieve
    this entire row (including the CLOB - hence this is an XML
    document which has a column that itself is an xml document in
    string format - this is just the clob read in by XDK).
    Thus the row looks like
    <ROWSET>
    <ROW>
    <col1> A <col1>
    <CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
    </ROW>
    </ROWSET>
    When I convert this document into String and back, one of the "<"
    tags in the clob column document gets changed to "<" and hence
    the parsing fails! I have used the latest label of the XDK build
    to get the latest parser jar but still i have the same problem.
    I am using the following routines for the conversion.
    /* for converting document to string */
    public static String convertToString(XMLDocument xml) throws
    IOException
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    xml.print(pw);
    String result = sw.toString();
    return result;
    /* for converting string to document */
    public static XMLDocument convertToXml(String xmlStr)
    throws
    IOException,SAXException
    ByteArrayInputStream inStream = new
    ByteArrayInputStream(xmlStr.getBytes());
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(false);
    parser.parse(inStream);
    return parser.getDocument();

  • Converting XML Document to String

    Dear All,
    I am quite new to Java Web Services. I have made a Java Class which calls all the web services . I am displaying the results on a Command prompt. Below is my sample code:
    import javax.xml.rpc.Service;
    import javax.xml.rpc.Stub;
    import horusWS.Horus_x0020_Web_x0020_Services_Impl;
    import horusWS.Horus_x0020_Web_x0020_ServicesSoap;
    public class JavaClient {
    public static void main(String[] args)
    Horus_x0020_Web_x0020_Services_Impl service = new Horus_x0020_Web_x0020_Services_Impl();
    Horus_x0020_Web_x0020_ServicesSoap port = service.getHorus_x0020_Web_x0020_ServicesSoap();
    String str;
    str = port.getTextFeedbackLearner(1,"P001",1);
    //where getTextFeedbackLearner is the my Web Service.
    System.out.println(str);
    System.out.println returns the web service in string format. Now I want to compare this string to my actual getTextFeedbackLearner.xml file. But I think I need to convert getTextFeedbackLearner.xml to string first. Please let me know
    how can I convert an XML Document to String.
    Thanking you in Anticipation.
    cheers,
    Sunil Sabir

    You can read the XML document as you read any other file.
    Read it into a String variable.
    Check java.io.FileReader, java.io.BufferReader, etc.

  • Special charecters handling while Converting XML string to DOM

    Hi,
    I am using the following approach for converting XML string to DOM, but due to Special characters like "&", I am getting Exceptions:
    String xmlString;
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new InputSource(new StringReader(xmlString)));
    Can anyone please help me out on how to handle the Special characters in the above code.

    If the XML doesn't parse, then the XML must be invalid. Show a sample of such a special character in the XML data. Please use \ tags to post the actual XML content and any other code.                                                                                                                                                                                                                                                                                                                                                                                           

  • Converting XML as table to XML as string

    All,
    I am successfully able to convert XML table from Internal Table. Now, I would like to convert this XML Table into XML string.
    Any help on this will be appreciated.
    Regards,
    Salil
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Dec 7, 2010 11:57 AM

    Howdy,
    CONCATENATE LINES OF lt_table into l_string SEPARATED BY cl_abap_char_utilities=>cr_lf.
    This will create a string of the lines of the internal table with a carriage return after each line.
    Cheers
    Alex

  • Convert XML string into XML

    Hi All,
    Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
    My XML string starts like this
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
       Thanks,
       Pavithra

    Thanks Praveen. It worked.
    However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
    <?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
    So there is an error in sxmb_moni. Is it possible to remove this.

  • Convert XML string into DOM

    Hi all,
    I have a question here regarding converting XML string into a DOM document.
    How can I do this in Java?
    The Document.Parse() methods do not have one that takes in String as its parameter.
    I'm not sure what is the best way to do this in Java.
    Any help is greatly appreciated.
    Thank you in advance.
    regards,
    Sean

    Convert XML String to Document with StringReader.
    String xmlString;
    DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
       Document         document = builder.parse(new InputSource(new StringReader(xmlString)));

  • Convert XML string into an abap format date and time

    Hi,
    Does anyone know of a method or a function module in ABAP which converts XML string into an abap format date and time.
    Here is a part of the xml that I want to convert.
    <ns2:EventDateTime>2009-07-02T10:13:45+10:00</ns2:EventDateTime>
    <ns2:EventMessageTransmissionDateTime>2009-07-02T10:13:45.987+10:00</ns2:EventMessageTransmissionDateTime>
    Currently EventDateTime and EventMessageTransmissionDateTime are type XSDDATETIME_Z and these are converted to proper dates and times. We will be changing these fields to a STRING instead of XSDDATETIME_Z. The reason for this is to make the field more versatile. The customer would be receiving dates with Zulu (2009-09-23T12:00:00Z), with offsets (2009-09-23T12:00:00+10:00/-10:00) and just local timestamp (2009-09-23T12:00:00). With this, we need to make the date fields as string
    to be able to accept the various date formats (esp. the local timestamp).
    I am looking for a standard function module or method that will convert the xml string to a proper date and time abap format.
    Would appreciate anyone's help!
    Thanks.
    Edited by: eunice ocson on Jul 13, 2009 1:49 AM
    Edited by: eunice ocson on Jul 13, 2009 1:50 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM

    Hi Eunice
    Use the FM 'SMUM_XML_PARSE'
    for more info
    [Convert XML string to ABAP|XML String to ABAP or GUI]
    hope it helps you.
    Thanks!!

  • How can I convert IF_IXML_DOCUMENT to STRING?

    Hi guys,
    is it possible to  convert an XML document (type IF_IXML_DOCUMENT ) to string.
    And how to do it?
    Thanks in advace!
    Regards,
    Liying

    Hi Wang,
    You can use these function modules
    TEXT_CONVERT_XML_TO_SAP or
    SDIXML_DOM_TO_XML Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
    or
    SMUM_XML_PARSE (Parse XML docment into a table structure)
    You can also refer to these:
    SMUM_XML_CREATE (Create XML document from internal table)
    SMUM_XML_CREATE_X (Create XSTRING xml doc)
    Check this code, it converts an XML data into a string internal table.
    REPORT Z_XML_TO_TABLE.
    TYPE-POOLS: ixml.
    TYPES: BEGIN OF t_xml_line,
    data(256) TYPE x,
    END OF t_xml_line.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory,
    l_parser TYPE REF TO if_ixml_parser,
    l_istream TYPE REF TO if_ixml_istream,
    l_document TYPE REF TO if_ixml_document,
    l_node TYPE REF TO if_ixml_node,
    l_xmldata TYPE string.
    DATA: l_elem TYPE REF TO if_ixml_element,
    l_root_node TYPE REF TO if_ixml_node,
    l_next_node TYPE REF TO if_ixml_node,
    l_name TYPE string,
    l_iterator TYPE REF TO if_ixml_node_iterator.
    DATA: l_xml_table TYPE TABLE OF t_xml_line,
    l_xml_line TYPE t_xml_line,
    l_xml_table_size TYPE i.
    DATA: l_filename TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    Validation of XML file: Only DTD included in xml document is supported
    PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
    START-OF-SELECTION.
    Creating the main iXML factory
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
    wrap the table containing the file into a stream
    l_istream = l_streamfactory->create_istream_itable( table =
    l_xml_table
    size =
    l_xml_table_size ).
    Creating a document
    l_document = l_ixml->create_document( ).
    Create a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
    istream = l_istream
    document = l_document ).
    Validate a document
    IF pa_val EQ 'X'.
    l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    ENDIF.
    Parse the stream
    IF l_parser->parse( ) NE 0.
    IF l_parser->num_errors( ) NE 0.
    DATA: parseerror TYPE REF TO if_ixml_parse_error,
    str TYPE string,
    i TYPE i,
    count TYPE i,
    index TYPE i.
    count = l_parser->num_errors( ).
    WRITE: count, ' parse errors have occured:'.
    index = 0.
    WHILE index < count.
    parseerror = l_parser->get_error( index = index ).
    i = parseerror->get_line( ).
    WRITE: 'line: ', i.
    i = parseerror->get_column( ).
    WRITE: 'column: ', i.
    str = parseerror->get_reason( ).
    WRITE: str.
    index = index + 1.
    ENDWHILE.
    ENDIF.
    ENDIF.
    Process the document
    IF l_parser->is_dom_generating( ) EQ 'X'.
    PERFORM process_dom USING l_document.
    ENDIF.
    *& Form get_xml_table
    FORM get_xml_table CHANGING l_xml_table_size TYPE i
    l_xml_table TYPE STANDARD TABLE.
    Local variable declaration
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = pa_file.
    upload a file from the client's workstation
    CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
    filename = l_filename
    filetype = 'BIN'
    IMPORTING
    filelength = l_xml_table_size
    CHANGING
    data_tab = l_xml_table
    EXCEPTIONS
    OTHERS = 19.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Writing the XML document to the screen
    CLEAR l_str1.
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    WRITE: /.
    WRITE: /' XML File'.
    WRITE: /.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
    IN
    l_str1 WITH space.
    WRITE: / l_str1.
    ENDLOOP.
    WRITE: /.
    ENDFORM. "get_xml_table
    *& Form process_dom
    FORM process_dom USING document TYPE REF TO if_ixml_document.
    DATA: node TYPE REF TO if_ixml_node,
    iterator TYPE REF TO if_ixml_node_iterator,
    nodemap TYPE REF TO if_ixml_named_node_map,
    attr TYPE REF TO if_ixml_node,
    name TYPE string,
    prefix TYPE string,
    value TYPE string,
    indent TYPE i,
    count TYPE i,
    index TYPE i.
    node ?= document.
    CHECK NOT node IS INITIAL.
    ULINE.
    WRITE: /.
    WRITE: /' DOM-TREE'.
    WRITE: /.
    IF node IS INITIAL. EXIT. ENDIF.
    create a node iterator
    iterator = node->create_iterator( ).
    get current node
    node = iterator->get_next( ).
    loop over all nodes
    WHILE NOT node IS INITIAL.
    indent = node->get_height( ) * 2.
    indent = indent + 20.
    CASE node->get_type( ).
    WHEN if_ixml_node=>co_node_element.
    element node
    name = node->get_name( ).
    nodemap = node->get_attributes( ).
    WRITE: / 'ELEMENT :'.
    WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
    IF NOT nodemap IS INITIAL.
    attributes
    count = nodemap->get_length( ).
    DO count TIMES.
    index = sy-index - 1.
    attr = nodemap->get_item( index ).
    name = attr->get_name( ).
    prefix = attr->get_namespace_prefix( ).
    value = attr->get_value( ).
    WRITE: / 'ATTRIBUTE:'.
    WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
    value COLOR COL_TOTAL INVERSE.
    ENDDO.
    ENDIF.
    WHEN if_ixml_node=>co_node_text OR
    if_ixml_node=>co_node_cdata_section.
    text node
    value = node->get_value( ).
    WRITE: / 'VALUE :'.
    WRITE: AT indent value COLOR COL_GROUP INVERSE.
    ENDCASE.
    advance to next node
    node = iterator->get_next( ).
    ENDWHILE.
    ENDFORM. "process_dom
    Thanks,
    Susmitha

Maybe you are looking for

  • Layout issue: separation row / column

    Hello, We have a reasonably big report that we show using a web application. I would like to add rows and columns to separate data in order to make the report better readable. What I have done right now is, I added a column/row with a forumla which s

  • Most of my hard drive was erased how can I get it back on my computer as I dont have a hard copy

    My hard drive has been erased I do not have a hard copy, how can I get my operating system back on my computer?

  • DAC parameter error preventing task from running

    Hi All, Please see below this error which is preventing a SIL from running, I've never seen this one before, not sure if it's a config error or programatic/environment related. I'm particularly puzzled by the file name being repeated three times? Thi

  • Outages at least 3 times a week

    They don't have an option to select all services, but I am having outages at my home at least 4 times a week.  it's ridiculous that we pay so much for bad service.  I am tired of it happening like this.  It's not our fault, it's the lines in the area

  • Playing an album from start to  finish

    Is this possible on the Ipod Nano 6th gen? The only choice I seem to have is playing either one song at a time, or shuffle. Am really not happy if thats the only choice I have.