XML to Itab - I've tried XSLT

Hi guys,
Before you guys go omg why didnt I search well I did. Hear me out.
I have a XML format which looks like this
<?xml version="1.0"?>
<SndPmtResp>
    <Tranx Id=u201D0000000001u201D type= u201CVPu201D status=u201D1u201D/>
</SndPmtResp
I did a quick test program based on previous work:
REPORT  ztest_ac_xml.
TYPE-POOLS: abap.
DATA: lt_xml_tab     TYPE STANDARD TABLE OF smum_xmltb,
      lw_xml_tab     LIKE LINE OF lt_xml_tab,
      lt_return      TYPE STANDARD TABLE OF bapiret2.
DATA: lt_result_xml  TYPE abap_trans_resbind_tab,
      lw_result_xml  TYPE abap_trans_resbind.
DATA: it_tab TYPE zstruct_sendfrombank_tt.
DATA: gs_rif_ex     TYPE REF TO cx_root,
      gs_var_text   TYPE string.
* Table for the XML content
DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
CONSTANTS gs_file TYPE string VALUE 'C:\temp\testing.xml'.
CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename                = gs_file
  CHANGING
    data_tab                = gt_itab
  EXCEPTIONS
    file_open_error         = 1
    file_read_error         = 2
    no_batch                = 3
    gui_refuse_filetransfer = 4
    invalid_type            = 5
    no_authority            = 6
    unknown_error           = 7
    bad_data_format         = 8
    header_not_allowed      = 9
    separator_not_allowed   = 10
    header_too_long         = 11
    unknown_dp_error        = 12
    access_denied           = 13
    dp_out_of_memory        = 14
    disk_full               = 15
    dp_timeout              = 16
    not_supported_by_gui    = 17
    error_no_gui            = 18
    OTHERS                  = 19.
GET REFERENCE OF it_tab INTO lw_result_xml-value.
lw_result_xml-name = 'ITEST'.
APPEND lw_result_xml TO lt_result_xml.
TRY.
    CALL TRANSFORMATION z_tab
      SOURCE XML gt_itab
      RESULT (lt_result_xml).
  CATCH cx_root INTO gs_rif_ex.
    gs_var_text = gs_rif_ex->get_text( ).
    MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
The program will work only if the XML is
<?xml version="1.0" encoding="iso-8859-1" ?>
<SNDPMTRESP>
<TRANX_ID>0000000001</TRANX_ID>
<TYPE>VP</TYPE>
<STATUS>12</STATUS>
</SNDPMTRESP>
The XML format is weird.....Any ideas on how to get the data from
<Tranx Id=u201D0000000001u201D type= u201CVPu201D status=u201D1u201D/> 
Thanks alot

Howdy,
Not sure it's exactly what you want but you should be able to tweak it from here.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/SndPmtResp">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <ITEST>
          <xsl:for-each select="//Tranx">
            <xsl:call-template name="Tranx"/>
          </xsl:for-each>
        </ITEST>
      </asx:values>
    </asx:abap>
  </xsl:template>
  <xsl:template name="Tranx">
    <item>
      <ZTXNID>
        <xsl:value-of select="@ID"/>
      </ZTXNID>
      <ZPYTYPE>
        <xsl:value-of select="@TYPE"/>
      </ZPYTYPE>
      <ZREPSTS>
        <xsl:value-of select="@STATUS"/>
      </ZREPSTS>
    </item>
  </xsl:template>
</xsl:transform>
Cheers
Alex

Similar Messages

  • PageDef.xml is not found when trying to enable MDS

    Our application uses JPA in the back end and fusion in the front end. we donot use databindings for integrating the backend object to the UI. I am trying to enable the mds by following the instructions in http://www.oracle.com/technetwork/developer-tools/jdev/metadataservices-fmw-11gr1-130345.pdf.  Initially using filebasedmetadata service to check if MDS is working in our enviroment. I have configured mds to save table and columns when i change the value for the user it stores the value for that jspx file in chartingBreakdownL1.jspx.xml but when  it is trying to access the changed setting when i log out and log back in it is not able to restore the changed value. in the logs i get this
    59db3<rootKey=StoredKey</sourceBreakdown/chartingBreakdownL1PageDef.xml>,value=null> - unlocked  count=0
    <null> <null> PDCache.getInternal() Cache hit : (/sourceBreakdown/mdssys/cust/user/test.user1/chartingBreakdownL1PageDef.xml.xml=>NOT_FOUND)
    <null> <null> PDCache.getInternal() Cache hit : (/sourceBreakdown/mdssys/cust/user/test.user1/chartingBreakdownL1PageDef.xml.xml=>NOT_FOUND)
    </oracle/mds/internal/persistence/file/FileMetadataStoreConnection/> <getDocument> ENTRY /sourceBreakdown/mdssys/cust/user/test.user1/chartingBreakdownL1PageDef.xml.xml
    <null> <null> oracle.mds.core.MOKey.createMOKey() - key       = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
    - moRef     = /sourceBreakdown/chartingBreakdownL1PageDef.xml
    - typeQName = {http://xmlns.oracle.com/adfm/uimodel}pageDefinition
    - priorKey  = null
    <null> <null> oracle.mds.core.MOKey.createMOKey() - key = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
       base read only = true
    <null> <null> MOKey.create() - key       = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
       create MOKey
    <null> <null> oracle.mds.core.MOKey.createMOKey() - key       = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
    - moRef     = /sourceBreakdown/chartingBreakdownL1PageDef.xml
    - typeQName = {http://xmlns.oracle.com/adfm/uimodel}pageDefinition
    - priorKey  = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
    <null> <null> oracle.mds.core.MOKey.createMOKey() - key = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
       base read only from prior key = false
    <null> <null> MOKey.create() - key       = /sourceBreakdown/chartingBreakdownL1PageDef.xml~1386710950000
       create MOKey
    Can someone help me in figuring out this issue.
    Bhoopathy

    1) Yes I am using file based MDS.
    2) the changed value is stored in the respective jspx file (chartingBreakdownL1.jspx.xml) when i log out and log back in the values are not restored from this file.
    3) In the log it is looking for the pagedef file  (chartingBreakdownL1PageDef.xml.xml) in the mds repository which is not stored as part of the mds file system. i have this file in the code base and using it for compiling but it is not getting saved to mds file system. It is trying to access this file and it is not able to read the values that is why it is saying "base read only = true". If you need this file is there a way to get this in the mds file repository.
    I am running this locally as a standalone server. i dont have enterpise manager installed. i have enabled the logging in "oracle diagnostics logging configuration" . for oracle.mds i have to set to finest that is why i am able to get the logs.
    thank you for the quick response.
    Bhoopathy

  • Xslt copy-of creates a xml which returns empty while trying to access elements using XPATH

    Hi
    I am trying to do a copy-of function using the XSLT in jdev. This is what I do
        <xsl:param name="appdataDO"/>
        <xsl:template match="/">
        <ns1:applicationData>
          <ns1:applicationId>
            <xsl:value-of select="$appdataDO/ns1:applicationData/ns1:applicationId"/>
          </ns1:applicationId>
          <xsl:copy-of select="/fslo:ExternalapplicationData/fslo:ApplicationsHDRAddInfo">
          </xsl:copy-of>
        </ns1:applicationData>
        </xsl:template>
        </xsl:stylesheet>
    After this I can see the document created in the process flow as this :
        <ns1:applicationData>
        <ns1:applicationId>MMMM</ns1:applicationId>
        <ns2:ApplicationsHDRAddInfo>
        <ns3:genericFromBasePrimitive>iuoui</ns3:genericFromBasePrimitive>
        <ns4:EstimatedMarketValue>77</ns4:EstimatedMarketValue>
        <ns4:PropertyInsuranceFee>jih</ns4:PropertyInsuranceFee>
        <ns4:LoanOriginationFee>hjh</ns4:LoanOriginationFee>
        <ns4:RegistrarFee>kkkkk</ns4:RegistrarFee>
        <ns4:LoanCashInFee>hjh</ns4:LoanCashInFee>
        <ns4:LoanPaidInCashFlag>cddffgd</ns4:LoanPaidInCashFlag>
        </ns2:ApplicationsHDRAddInfo>
        </ns1:applicationData>
    But whenever I am trying to extract any of the output nodes I am getting an empty result. I can copy the whole dataset into similar kind of variable.
    But I am unable to get individual elements using XPATH.
    I tried using exslt function for node set and xslt 2.0 without avail.
    The namespaces might be the culprit here . The test method in the jdev is able to output a result but at runtime the xpath returns empty .
    I have created another transform where I try to copy data from the precious dataobject to a simple string in another data object .
    This is the test sample source xml for the transform created by jdev while testing with all namespaces, where I try to copy the data in a simple string in another data object.
        <applicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/bpmpa/fs/ulo/types file:/C:/JDeveloper/NewAPP/Xfrm/xsd/ApplicationData.xsd" xmlns="http://xmlns.oracle.com/bpmpa/fs/ulo/types">
           <applicationId>applicationId289</applicationId>
           <ApplicationsHDRAddInfo>
              <genericFromBasePrimitive xmlns="http://xmlns.oracle.com/bpm/pa/extn/types/BasePrimitive">genericFromBasePrimitive290</genericFromBasePrimitive>
              <EstimatedMarketValue xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">291</EstimatedMarketValue>
              <PropertyInsuranceFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">PropertyInsuranceFee292</PropertyInsuranceFee>
              <LoanOriginationFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanOriginationFee293</LoanOriginationFee>
              <RegistrarFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">RegistrarFee294</RegistrarFee>
              <LoanCashInFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanCashInFee295</LoanCashInFee>
              <LoanPaidInCashFlag xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanPaidInCashFlag296</LoanPaidInCashFlag>
           </ApplicationsHDRAddInfo>
        </applicationData>
    And the xslt
        <xsl:template match="/">
            <ns1:DefaultOutput>
              <ns1:attribute1>
                <xsl:value-of select="/fslo:applicationData/fslo:ApplicationsHDRAddInfo/custom:LoanOriginationFee"/>
              </ns1:attribute1>
            </ns1:DefaultOutput>
          </xsl:template>
    This results in a empty attribute1. Any help will be appreciated .

    Please delete attributeFormDefault="qualified" elementFormDefault="qualified" from your XSD
    Please check the next link:
    http://www.oraclefromguatemala.com.gt/?p=34

  • Problem converting XML back to ABAP Structure using XSLT

    Hi Experts,
    I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
    Sample XML File:
    Thanks for your help in advance.
    Regards,
    Srini

    here is the XSLT program YSIMPLEXMLTOITAB1
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTTAB>
              <xsl:for-each select="//String">
                <ZTEST11>
                  <FINAL_RESULT>
                    <xsl:value-of select="."></xsl:value-of>
                  </FINAL_RESULT>
                </ZTEST11>
              </xsl:for-each>
            </OUTTAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    ABAP report program to test this.
    REPORT yjfkdjkfmxl
           NO STANDARD PAGE HEADING.
    DATA: BEGIN OF ztest11  OCCURS 0,
          final_result(220),
          END OF ztest11 .
    DATA: xml_string TYPE string .
    DATA: xslt_error     TYPE REF TO     cx_xslt_exception,
    xslt_message     TYPE     string .
    CLEAR xml_string .
    CONCATENATE
    `<?xml version="1.0" encoding="utf-8"?>`
    `<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> `
    `<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">`
    `<ns:matchResponse xmlns:ns='http://www.openuri.org/'>`
    `<matchResult xsi:type='SOAP-ENC:Array' SOAP-ENC:arrayType='xsd:string[18]'>`
    `<String xsi:type='xsd:string'>23901|EUS|20060625 |ABU NIDAL ORGANISATION||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23934|EUS|20060625 |ABU NIDAL ORGANISATSIOON||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23940|EUS|20060625 |ABU NIDALORGANIZACIJA||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>4228|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||DZ|ALGERIA|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4229|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||LB|LEBANON|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4231|sdme|19950301 605084 19950125|ABU NIDAL ORGANIZATION||||||LY|LIBYAN ARAN JAMAHIRIYA|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4232|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||SD|SUDAN|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4233|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||IQ|IRAQ|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>6643|dto|19971008 6252649 199710086651088 200110056856860 20031002|ABU NIDAL ORGANIZATION||||||XX|ALL|68|56860 |20031002|19971008|20880808</String>`
    `<String xsi:type='xsd:string'>23941|EUS|20060625 |ABU NIDAL SZERVEZET||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>4332|sdme|19950126 605084 19950125|NIDAL, ABU|DOB: May 1937 or 1940||JAFFA|||IL|ISRAEL|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>23950|EUS|20060625 |ORGANIZACIJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23911|EUS|20060625 |ORGANIZACIÓN ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23946|EUS|20060625 |ORGANIZACJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23916|EUS|20060625 |ORGANIZAÇÃO ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23955|EUS|20060625 |ORGANIZZAZIONE ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23949|EUS|20060625 |ORGANIZÁCIA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:nil='true'></String>`
    `</matchResult>`
    `</ns:matchResponse>`
    `</SOAP-ENV:Body>`
    `</SOAP-ENV:Envelope>`
    INTO xml_string .
    TRY .
        CALL TRANSFORMATION (`YSIMPLEXMLTOITAB1`)
        SOURCE XML  xml_string
        RESULT     outtab = ztest11[].
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
    ENDTRY.
    Regards
    Raja

  • Problem converting XML back to ABAP Structure using XSLT program

    Hi Experts,
    I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
    Sample XML File:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <soapenv:Header/>
    <soapenv:Body>
    <m:matchResponse xmlns:m="http://www.openuri.org/">
    <matchResult soapenc:arrayType="xs:string[1]">
    <enc:String xmlns:enc="http://www.openuri.org/encodedTypes">
    23417|finc|20060427        |BELMETALNERGO||||||X
    X|ALL||||20060427|20880808
    </enc:String>
    </matchResult>
    </m:matchResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    My XSLT Program:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hp="http://www.openuri.org/" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTTAB>
              <xsl:for-each select="soapenv:Envelope/soapenv:Header/soapenv:Body/m:matchResponse/matchResult/enc:String">
                <ZA2_RPL_DETAILS_S>
                  <FINAL_RESULTS>
                    <xsl:value-of select="."/>
                  </FINAL_RESULTS>
                </ZA2_RPL_DETAILS_S>
              </xsl:for-each>
            </OUTTAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    My Structure is : Structure Name is ZA2_RPL_DETAILS_S.
    filed is: FINAL_RESULT CHAR553
    My requirement is to store the complete value between <String> and </String>.
    Currently it is giving the blank records
    Thanks for your help in advance.
    Regards,
    Rao

    Hi,
    post here
    expert forums -> sapnetweaver -> exchange infrastructure
    Regards

  • XML file to Internal table through XSLT - Call Transformation

    Hi Friends,
    I am trying to work a scenario where i have a simple XML file and i need to convert the data in to an internal table. When i execute the XSLT seperately, it works fine. I get the output, but when it is invoked through a ABAP program, i am getting the error "The called method START_XSLT_DEBUGGER of the calss CL_WB_XSLT_DEBUGGER returned the exception CX_XSLT_FORMAT_ERROR"
    I feel my XSLT program is not correct, but i am unable to find out what the issue is. Any help is really apreciated. I have gone through the SDN forum replies. But could not figure out what is wrong with my program
    Below given are the details.
    My XML File:
    <?xml version="1.0" encoding="utf-8"?>
    <List>
      <ITEM>
        <ITEMQUALF>ITEM1</ITEMQUALF>
        <MATERIAL>MAT1</MATERIAL>
      </ITEM>
      <ITEM>
        <ITEMQUALF>ITEM2</ITEMQUALF>
        <MATERIAL>MAT2</MATERIAL>
      </ITEM>
      <ITEM>
        <ITEMQUALF>ITEM3</ITEMQUALF>
        <MATERIAL>MAT3</MATERIAL>
      </ITEM>
    </List>
    My XSLT program:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" exclude-result-prefixes="asx" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
      <!--xsl:template match="/"-->
      <xsl:template match="List">
        <asx:abap version="1.0">
          <asx:values>
            <T_ACTUAL>
              <xsl:for-each select="*">
                <ITEMQUALF>
                  <xsl:value-of select="ITEMQUALF" />
                </ITEMQUALF>
                <MATERIAL>
                  <xsl:value-of select="MATERIAL" />
                </MATERIAL>
              </xsl:for-each>
            </T_ACTUAL>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    In my ABAP program:
    REPORT  z_xslt_abap_2.
    TYPES:
      BEGIN OF ty_actual,
        itemqualf   TYPE char50,
        material    TYPE char50,
      END OF ty_actual,
      line_t(4096)  TYPE x,
      table_t       TYPE STANDARD TABLE OF line_t,
      ty_t_actual   TYPE STANDARD TABLE OF ty_actual.
    DATA:
      t_actual    TYPE ty_t_actual,
      t_srctab    TYPE table_t,
      v_filename  TYPE string.
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    v_filename = 'D:\XML\xslt_test.xml'.
    * Function call
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = v_filename
        filetype = 'BIN'
      TABLES
        data_tab = t_srctab
      EXCEPTIONS
        OTHERS   = 1.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Call Transformation
    TRY.
        CALL TRANSFORMATION (`ZXSLT_RAM`)
                SOURCE XML t_srctab
                RESULT     t_actual = t_actual.
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY .
    IF t_actual IS NOT INITIAL.
      WRITE: 'Success'.
    ENDIF.
    When i run the XSLT program seperately, this is the output that i get:
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <T_ACTUAL>
          <ITEMQUALF>ITEM1</ITEMQUALF>
          <MATERIAL>MAT1</MATERIAL>
          <ITEMQUALF>ITEM2</ITEMQUALF>
          <MATERIAL>MAT2</MATERIAL>
          <ITEMQUALF>ITEM3</ITEMQUALF>
          <MATERIAL>MAT3</MATERIAL>
        </T_ACTUAL>
      </asx:values>
    </asx:abap>
    I have been stuck with this for more than two days. If anyone can help me out with this, it would be really great. Please let me know, where i am going wrong.
    Thanks in advance.
    Best Regards,
    Ram.

    Hi,
    You can try this sample program, hopefully will help you.
    <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/readdatafromXMLfileviaXSLT+program&">Read Data From XML</a>.
    Regards,

  • Outputting XML carriage return in HTML via XSLT

    Hi,
    I have a scenario where I execute a View Object query in ADF to retrieve results from a particular table in the Database. I then iterate through the results in my Java managed bean and manually construct an XML file with all the appropriate tags. I then pass the XML file through a Transformer class in the Java bean based on an XSLT I have created to produce an HTML page. However I have an issue when it comes to handling carriage returns. One of the database table columns can contain carriage returns within its value but in the final HTML page the carriage returns don't have any effect and the text just displays on one line.
    In the database, the values are stored with the carriage return and in SQL Developer, Toad etc this can be seen e.g. Text1 Text2 Text3 Text4 will display on separate lines. In the XML, the carriage return seems to still be there as when I open the file my element which contains the carriage returns shows each part on a new line e.g. <textElement>Text1
                                                           Text2
                                                           Text3
                                                           Text4</textElement>     (The Text2, Text3 and Text4 all start on a new line at the beginning and there's no prior white space as shown in this post)
    The XML file in JDeveloper also shows carriage return arrow symbols where there is one.
    The HTML page just shows them as Text1 Text2 Text3 Text4 all on one line. Inspecting the source of the HTML shows that the carriage return is in fact there as it also displays as per the XML with the values on separate lines.
    Outputting the value from the View Object in Java to the log shows the value coming out like this - Text1 Text2Text3Text4, which is strange but I know the carriage returns are there so I'm not too fussed about this.
    I have tried escaping the characters in the Java by doing str.replaceAll("[\\r\\n]", ""); (but replacing the "" with &#xD; &#xA; or &x0A;) so in the XML it replaces carriage returns and line feeds with these escaped characters. However, when the XSLT parses the XML it doesn't pick these up and instead actually outputs these actual characters as they are e.g. Text1&x0A;Text2&x0A;Text3&x0A;Text4
    So I can confirm that the carriage return is carrying all the way through to the XSL but I can't help but think that maybe I need to do something in the XSL to process this somehow, e.g. doing the equivalent of the 'replace' in Java but I don't know what I need to search for in the XML and also what to actually replace it with..Do I just replace it with a </BR> in HTML?
    We also parse the XML using PDF and Excel XSL Transformer class and see the same results.
    Any help would be appreciated.
    Thanks

    That's a very commonly asked question.
    HTML doesn't preserve linefeeds, except for the <pre> tag.
    You'll have to replace those characters with <BR/> tags in the XSLT.
    Search the Internet for terms like "XSLT HTML LF", you'll find some XSLT sample templates to handle the replacement.

  • Xml To itab

    Hi ,
    i'm trying extract data from PDF file. (Adobe Offline scenario).
    I'm getting this XML runtime error.
    could anybody can help me to solve this problem.
    This is my code ,
    CALL TRANSFORMATION id
    SOURCE XML lv_xml_data_string
    RESULT zscustomer12 = wa_zcustomer12.
    Here is the error
    The reason for the exception is:
    Either the source document contains invalid XML or it is handled
    incorrectly in the ABAP program that called the transformation.
    How to correct the error
    The most common cause of this error is a conflict between the encoding
    specified in the declaration <?xml version="1.0" encoding="..."?> in the
    document and the actual encoding of the data.
    If the document is held in an ABAP string, the actual encoding is the
    system code page. If this does not match the declaration, a parsing
    error may occur.
    These conflicts are a particular issue when XML documents are produced
    in one system and then imported into a system with a different code page
    (as strings).
    For this reason, XML documents should be held as binary data (X strings)
    , if they are extracted from the system or accessed from outside.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "XSLT_BAD_SOURCE_CONTEXT" "CX_XSLT_RUNTIME_ERROR"
    "ZFORM_12_RECEIVEPDF" or "ZFORM_12_RECEIVEPDF"
    "START-OF-SELECTION"
    please help me out.
    Regards,
    Keerthi

    code:
    TYPES: BEGIN OF T_ATTACHMENT,
    LINE_NO(5),
    FILENAME(200),
    DESCRIPTION TYPE STRING,
    END OF T_ATTACHMENT,
    D_ATTACHMENT TYPE T_ATTACHMENT OCCURS 0.
    TYPES: BEGIN OF T_ATTACHMENTLIST,
    ATTACHMENT TYPE D_ATTACHMENT,
    END OF T_ATTACHMENTLIST,
    D_ATTACHMENTLIST TYPE T_ATTACHMENTLIST OCCURS 0.
    TYPES: BEGIN OF T_HEADER,
    NAME(140),
    PHONE(23),
    EMAIL(100),
    ATTACHMENTLIST TYPE D_ATTACHMENTLIST,
    END OF T_HEADER,
    D_HEADER TYPE T_HEADER OCCURS 0.
    TYPES: BEGIN OF T_ITEM,
    HEADER TYPE D_HEADER,
    END OF T_ITEM.
    TYPES:D_ITEM TYPE T_ITEM OCCURS 0.
    TYPES: BEGIN OF T_LIST,
    ITEM TYPE D_ITEM,
    END OF T_LIST,
    D_LIST TYPE T_LIST OCCURS 0.
    TYPES: BEGIN OF TYPE_DATA,
    LIST TYPE D_LIST,
    END OF TYPE_DATA.
    DATA: ITEMLIST TYPE STANDARD TABLE OF T_LIST INITIAL SIZE 0.
    DATA: XMLOUT TYPE STRING.
    DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
    PERFORM UPLOAD_XML.
    *& Form UPLOAD_XML
    text
    --> p1 text
    <-- p2 text
    FORM UPLOAD_XML .
    REFRESH ITAB.
    clear ITEMLIST.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:\test11.XML'
    filetype = 'BIN'
    TABLES
    data_tab = ITAB.
    LOOP AT ITAB.
    CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.
    ENDLOOP.
    CALL TRANSFORMATION ('ZTEST11X2A')
    SOURCE XML XMLOUT
    RESULT ITEMLIST = ITEMLIST.
    BREAK-POINT.
    ENDFORM.[/code]
    Regards
    Venkat

  • Approach on parsing an XML file (JAXP, JAXB, DOM, SAX, XSLT)

    I have a pretty basic xml file that contains a database table name, fields, and sort order. My job is to read the XML file, construct the query based on the information in the nodes, and then output it in various ways. I know I can use JAXP, JAXB, DOM, SAX, and XSLT for this.
    I have the experience doing this using DOM. I have read up on JAXP, JAXB, and XSLT. I'm having a little bit of a difficult time on chosing the most appropriate way to do this. Again, I've always done it using DOM, but I'm not so sure that is the best way to do it here. Just looking for some recommendations from people whom are more familiar with XML parsing and processing.

    markwagoner wrote:
    I tried several of those but found them rather tedious. Now I just use JDOM for everything, it make life much easier.It doesn't, actually. It kept your learning curve shallow, but that's all. If you were to invest some time in JAXB, you'd find it made life easier for some things. If you invested time in XSLT, it would make life easier. Endlessly working with JDOM is incredibly tiresome after a while. You just don't know it because you never invested enough in learning anything else.
    Don't bother posting any code to "enlighten" me as to how simple JDOM is. I've been using it for years.

  • Help with xslt xml, "the value specified in the xslt file field is not an xslt file." ???

    when trying to attach an XSLT to an XML file I am getting this error message:
    "the value specified in the xslt file field is not an xslt file."
    this is the first time I am ever doing this and I dont have the faintest clue what might be wrong and how to go about fixing it...
    help?

    http://www.w3schools.com/xml/xml_xsl.asp
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web-design.blogspot.com/

  • How to get the WHOLE xml document inside a string using XSLT mapping

    Hi folks,
    I have a deep xml structure that I want to embed as body, tags included, in a mail message (not as an attachment).
    I'm trying to use Michal's method in this blog
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    However, I can't get it to deliver the entire structure instead of just specific elements.
    Any help is greatly appreciated,
    Thanks,
    Guy

    Ashok,
    I was able to work it out for my case.
    This XSL......
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <inside>
    <namestring>
    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>
    <xsl:copy-of select="outside/name/*"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>
    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    </namestring>
    </inside>
    </xsl:template>
    </xsl:stylesheet>
    ...will transform this input....
    <?xml version="1.0" encoding="UTF-8"?>
    <outside>
    <name>
    <nameone>name1</nameone>
    <nametwo>name2</nametwo>
    <namethree>name3</namethree>
    </name>
    </outside>
    ...and put the whole lot into the CDATA element.
    Hope this helps you,
    Guy

  • Check XML file against XSD? Via XSLT?

    Hello,
    we´re using a 6.20 system (XI not available) and want to check XML files against a XML-schema definition file (xsd).
    Is there a function in 6.20 available for this? Is it possible to use "CALL TRANSFORMATION" for it? I´ve seen other XSLT parser in the internet which are able to check a source XML against an XSD before transforming it to the result XML.
    But is this possible with an 6.20 system?
    Thank you for your help,
    best regards,
    Stefan

    Here is the sample XML and the schema.
    XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <book isbn="0836217462">
    <title>
      Being a Dog Is a Full-Time Job
    </title>
    <author>Charles M. Schulz</author>
    <character>
      <name>Snoopy</name>
      <friend-of>Peppermint Patty</friend-of>
      <since>1950-10-04</since>
      <qualification>
        extroverted beagle
      </qualification>
    </character>
    <character>
      <name>Peppermint Patty</name>
      <since>1966-08-22</since>
      <qualification>bold, brash and tomboyish</qualification>
    </character>
    </book>
    XSD:
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="book">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="author" type="xs:string"/>
            <xs:element name="character" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="name" type="xs:string"/>
                  <xs:element name="friend-of" type="xs:string" minOccurs="0"
                          maxOccurs="unbounded"/>
                  <xs:element name="since" type="xs:date"/>
                  <xs:element name="qualification" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="isbn" type="xs:string"/>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    - Suman

  • Mapping XML stream to C structure using XSLT ?

    Can I use XSLT to map an XML stream to a C structure ?. is there any samples ?
    Raees

    Can I use XSLT to map an XML stream to a C structure ?. is there any samples ?
    Raees

  • Generate XML out of internal Table (via XSLT)

    Hi NG,
    is there an easy way to generate an XML document out of an internal ABAP Table? Maybe there is even a chnage to use XSLT as an template to define the structure of the XML file.
    Thanks
    Stefan

    check out following thread you will find more than one answer. I like CL_XML_DOCUMENT solution, that is so simple.
    Re: Convert to XML format
    -Sanjeev

  • Exception javax.xml.ws.soap.SOAPFault when trying to invoke OBR

    Hi,
    1 .I am have created a SOA Composite which has an OBR. I deployed that project and that was working fine.
    2 .In Order to call the OBR service from another composite I have created another composite in which a web service(reference) adapter which is towards the right side of the composite shall call the web service of the OBR composite.
    When I point the URL to the WSDL of the OBR web service, I get the error. The screenshot of the error is avbl at the following URL. http://img199.imageshack.us/img199/7015/37887205.jpg
    3 .So I have manually saved the WSDL of OBR web service as a file and saved it in the proj that i mentioned in 2. Then I was able to create web service adapter with out any problem. Then I created a composite (screenshot http://img59.imageshack.us/img59/7826/30673557.jpg ) which calles the OBR web service and gets the reply.
    4. After deploying the composite, when I am trying to invoke the OBR service, I get the following error in the console of the Soa server.
    SEVERE: AbstractWebServiceBindingComponent.dispatchRequest Unable to dispatch re
    quest to http://rws60045rems:5002/soa-infra/services/default/EventLogProj/OracleRules1_DecisionService_1 due to exceptionjavax.xml.ws.soap.SOAPFaultException
    SEVERE: Received a business fault{http://xmlns.oracle.com/OracleRules2/OracleRul
    es2_DecisionService_1}operationErroredFault. Sending fault to fault action
    SEVERE: AbstractWebServiceBindingComponent.dispatchRequest Unable to dispatch re
    quest to http://rws60045rems:5002/soa-infra/services/default/HighValueOrderOBRPr
    oject/OracleRules2_DecisionService_1 due to exceptionjavax.xml.ws.soap.SOAPFault
    Exception: Invalid URI "ID:<65469.1271952700558.0>" in Addressing element Relate
    sTo.
    : Got an exception: oracle.fabric.common.FabricInvocationException
    oracle.tip.mediator.infra.exception.MediatorException: ORAMED-03303:[Unexpected exception in case execution]Unexpected exception in request response operation "callFunctionStateless" on reference "CallHighValOrdService". Possible Fix:Check whether the reference service is properly configured and running or look at exception for analysing the reason or contact oracle support.
    Please help me to resolve these errors. Please let me know what could have led to this problem and exceptions.
    Thanks,
    Raj kumar
    Edited by: Raja Kumar on Apr 22, 2010 10:06 AM
    Edited by: Raja Kumar on Apr 22, 2010 10:07 AM

    Hi,
    The problem is solved now. While creating the WS adapter in Jdev, I have tried specifying the URL with the Ip address instead of server name. seems Jdev was not able to resolve the name of the server. Once I created composite with this and deployed the error got resolved.
    Thanks,
    Raj

Maybe you are looking for