Reading XML Data from ABAP Program?

Hi,
How do I read XML Data from an ABAP Program? For example if I have the below basic XML Code-
<xml>
<Name> Thiru </Name>
<Age> 24 </Age>
<City> chennai </Chennai>
</xml>
How do i read the data within the Name,Age, and City tags into variables in the ABAP Program?
Regards,
Thiru

if you decide to do in XSLT, I have a sample list here:
XML file like this:
<?xml version="1.0" encoding="UTF-16"?>
<F>
<P1>
<t_1>value1</t_1>
<t_2>testvalue</t_2>
</P1>
<P2>
</P2>
</F>
XSLT file like this:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="F">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<<b>DOCUMENT</b>>
<xsl:apply-templates/>
</<b>DOCUMENT</b>>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="P1">
<ENTRY>
<<b>T_1</b>><xsl:value-of select="t_1"/></T_1>
<<b>T_2</b>><xsl:value-of select="t_2"/></T_2>
</ENTRY>
</xsl:template>
</xsl:transform>
ABAP program like this:
DATA: BEGIN OF wa_upload,
text(255) TYPE c,
END OF wa_upload,
itab_upload LIKE TABLE OF wa_upload,
BEGIN OF wa_document,
t_1 TYPE string,
t_2 TYPE string,
END OF wa_document,
itab_document LIKE TABLE OF wa_document.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'XXXXX'
filetype = 'ASC'
TABLES
data_tab = itab_upload.
CALL TRANSFORMATION zrappel_xml_test
SOURCE XML itab_upload
RESULT <b>document</b> = itab_document.
You should pay attention to the bold words.
hope it will be helpful
thanks

Similar Messages

  • Passing data from abap-program to mssql database table thro native sql

    Hi,
    To pass the data from abap-program to mssql server,i have created database connection through dbco t.code.
    now i am trying to get connection thro native sql but am not able to get it .Am working in ECC 5.0.
    Could anyone help me on this.Did i miss anything?
    i have tried Native-sql like this.
    DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
    EXEC SQL.
      CONNECT TO :con_name AS 'C1'
    ENDEXEC.
    Thanks in advance.

    Hi,
    Trying to do the same here, only using Oracle DB.
    DATA:     dbc TYPE DBCON_NAME VALUE 'BI'
    TRY.
      EXEC SQL.
        CONNECT TO :dbc
      ENDEXEC.
      IF sy-subrc NE 0.
        RAISE EXCEPTION TYPE cx_sy_native_sql_error.
      ENDIF.
    CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
      sql_emsg = oref_native_sql_error->get_text( ).
      MESSAGE sql_emsg TYPE 'I'.
    ENDTRY.
    I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
    Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
    I suggest the same to you..
    In the meantime, if anyone can help out, it will be appreciated.
    Regards,
    SD

  • Reading Webservice information from ABAP Program

    Hi All,
    How to read a webservice information from a ABAP program ?
    Are there any webservices available in ABAP which can do this .
    Gopal.

    Hi,
    The following code will call the web service and fill the data into internal table which was received from the Web service. This code will send & Receive the data from ABAP to Webservice.
    Change the Header detail as per your Webservice.
    REPORT  ZWORKORDER.
    TYPES: BEGIN OF OUTTAB1 ,
      JOBCODE(20),
      COMPONENTCODE(20),
      ACCURATEHOURS(20),
      ACCURATECOST(20),
      LENGTH TYPE I,
       END OF OUTTAB1 .
    DATA: OUTTAB TYPE  TABLE OF OUTTAB1.
    DATA: TAB TYPE OUTTAB1.
    DATA: WF_O LIKE LINE OF OUTTAB .
    DATA: XSLT_ERR TYPE REF TO CX_XSLT_EXCEPTION .
    DATA: RLENGTH TYPE I,
          TXLEN TYPE STRING  .
    DATA: HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT .
    DATA: WF_STRING TYPE STRING .
    DATA: WF_STRING1 TYPE STRING .
    DATA: WF_PROXY TYPE STRING ,
          WF_PORT TYPE STRING .
    CLEAR WF_STRING .
    Form the input string to send the Input Data to Web service.
    CONCATENATE
    '<?xml version="1.0" encoding="utf-8"?>'
    '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
    '  <soap:Body>'
    '    <GetWorkOrder xmlns="http://*******erica.net/webservices/">'
    '      <nWorkOrder>2</nWorkOrder>'
    '      <nDistributorCode>4871</nDistributorCode>'
    '      <model>HM400</model>'
    '     <type>1 </type>'
    '    </GetWorkOrder>'
    '  </soap:Body>'
    '</soap:Envelope>'
    INTO WF_STRING .
    CLEAR :RLENGTH , TXLEN .
    RLENGTH = STRLEN( WF_STRING ) .
    MOVE: RLENGTH TO TXLEN .
    CLEAR: WF_PROXY, WF_PORT .
    CALL METHOD CL_HTTP_CLIENT=>CREATE
      EXPORTING
        HOST    = '192.168.1.41' "'http://****merica.net/webservices'
        SERVICE = '8080'
        SCHEME  = '1'
      IMPORTING
        CLIENT  = HTTP_CLIENT.
    HTTP_CLIENT->PROPERTYTYPE_LOGON_POPUP = HTTP_CLIENT->CO_DISABLED.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = '~request_method'
        VALUE = 'POST'.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = '~server_protocol'
        VALUE = 'HTTP/1.1'.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = '~request_uri'
        VALUE = '/service/accurate/workorder.asmx?'.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = 'Content-Type'
        VALUE = 'text/xml; charset=utf-8'.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = 'Content-Length'
        VALUE = TXLEN.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
      EXPORTING
        NAME  = 'SOAPAction'
        VALUE = 'http://********merica.net/webservices/GetWorkOrder'.
    CALL METHOD HTTP_CLIENT->REQUEST->SET_CDATA
      EXPORTING
        DATA   = WF_STRING
        OFFSET = 0
        LENGTH = RLENGTH.
    Send the Input Data to Web service.
    CALL METHOD HTTP_CLIENT->SEND
      EXCEPTIONS
        HTTP_COMMUNICATION_FAILURE = 1
        HTTP_INVALID_STATE         = 2.
    Receive the Input from Web Serice.
    CALL METHOD HTTP_CLIENT->RECEIVE
      EXCEPTIONS
        HTTP_COMMUNICATION_FAILURE = 1
        HTTP_INVALID_STATE         = 2
        HTTP_PROCESSING_FAILED     = 3.
    CLEAR WF_STRING1 .
    WF_STRING1 = HTTP_CLIENT->RESPONSE->GET_CDATA( ).
    DATA: LENGTH TYPE I.
    LENGTH = STRLEN( WF_STRING1 ).
    DATA: VALUE_FIELD TYPE NAME_KOMP.
    DATA: VALUE TYPE REF TO DATA.
    FIELD-SYMBOLS: <FS_CONVERTED_DATA>.
    DATA: TAB1 TYPE TABLE OF STRING.
    DATA: FROM_LENGTH TYPE I VALUE 1.
    DATA: TO_LENGTH TYPE I.
    DATA: DIFF TYPE I.
    DATA: START TYPE I VALUE 1.
    DO.
    JOBCODE.
      SEARCH WF_STRING1 FOR 'JobCode=' . "STARTING AT START .
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      FROM_LENGTH = SY-FDPOS .
      FROM_LENGTH = FROM_LENGTH  + 8.
      SEARCH WF_STRING1 FOR 'JobDescription=' ."STARTING AT START ..
      TO_LENGTH = SY-FDPOS .
      DIFF = TO_LENGTH - FROM_LENGTH .
      MOVE WF_STRING1+FROM_LENGTH(DIFF) TO TAB-JOBCODE.
      TO_LENGTH = DIFF + TO_LENGTH.
      SHIFT WF_STRING1 BY TO_LENGTH PLACES.
    COMPONENT CODE
      SEARCH WF_STRING1 FOR 'ComponentCode=' .
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      FROM_LENGTH = SY-FDPOS .
      FROM_LENGTH = FROM_LENGTH  + 14.
      SEARCH WF_STRING1 FOR 'ComponentDescription=' .
      TO_LENGTH = SY-FDPOS .
      DIFF = TO_LENGTH - FROM_LENGTH .
      MOVE WF_STRING1+FROM_LENGTH(DIFF) TO TAB-COMPONENTCODE.
      TO_LENGTH = DIFF + TO_LENGTH.
      SHIFT WF_STRING1 BY TO_LENGTH PLACES.
    AccurateHours
      SEARCH WF_STRING1 FOR 'AccurateHours=' .
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      FROM_LENGTH = SY-FDPOS .
      FROM_LENGTH = FROM_LENGTH  + 14.
      SEARCH WF_STRING1 FOR 'AccurateCost='.
      TO_LENGTH = SY-FDPOS .
      DIFF = TO_LENGTH - FROM_LENGTH .
      MOVE WF_STRING1+FROM_LENGTH(DIFF) TO TAB-ACCURATEHOURS.
      TO_LENGTH = DIFF + TO_LENGTH.
    AccurateCost
      SEARCH WF_STRING1 FOR 'AccurateCost='.
      FROM_LENGTH =  SY-FDPOS.
      FROM_LENGTH =  FROM_LENGTH + 13.
      SEARCH WF_STRING1 FOR '/>'.
      TO_LENGTH = SY-FDPOS.
      DIFF = TO_LENGTH - FROM_LENGTH .
      MOVE WF_STRING1+FROM_LENGTH(DIFF) TO TAB-ACCURATECOST.
      TO_LENGTH = DIFF + TO_LENGTH.
      SHIFT WF_STRING1 BY TO_LENGTH PLACES.
      APPEND TAB TO OUTTAB.
    ENDDO.
    WRITE: (10) 'JOBCODE'.
    WRITE (20) 'COMPONENTCODE'.
    WRITE (30) 'ACCURATEHOURS'.
    WRITE (40) 'ACCURATECOST'.
    LOOP AT OUTTAB INTO TAB.
      WRITE:/ TAB-JOBCODE .
      WRITE (20) TAB-COMPONENTCODE.
      WRITE (30) TAB-ACCURATEHOURS.
      WRITE (40) TAB-ACCURATECOST.
    ENDLOOP .
    It is better to create a proxy, it then puts a level of abstraction between in that coding. All you need to do is then access the proxy class.
    Besides that i think you can do it by configuring the ITS and calling the webservice by means of using BSP applications in ABAP
    <b>I believe you need to create a proxy in order to consume your web service.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/frameset.htm
    Reward points</b>
    Regards

  • XML files from ABAP programs

    Hi everyone!
    Is there a way in ABAP to output XML files?  Pls. send code/ function module if any.
    From ABAP programs, we are sure that we can output TEXT files, but how about XML files?
    The significance of this question is related
    Currently we are using XI to interface SAP and AMS, this question for ABAP to produce XML file arose, if for example, the XI server is down and we have to still send data from one system to another. IDocs can also produce XML files, pls confirm.  Earlier however, we have preferred XI rather than IDocs to do this.  Anyway, any idea regarding this scenario will be greatly appreciated. 
    Thanks and God bless!
    Celeste

    Hi,
    Please check this sample codes from other thread.
    1. itab --- > xml
        xml ---> itab.
    2. This program will do both.
    (just copy paste in new program)
    3.
    REPORT abc.
    *-------------- DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    *------------------ Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
    EXPORTING
    TEXT = xml_out
    * IMPORTING
    * LENGTH =
    TABLES
    FTEXT_TAB = itab.
    *-------------- Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:xx.xml'
    TABLES
    data_tab = itab.
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    Regards,
    Ferry Lianto

  • Reading XML data from .pages file

    Hi All!
    I've been trying to get a script up and running, but frankly I'm lost. The script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
    What I'm having a problem with is reading the data from the .pages file and I don't know what the best way to do it is because I'm still a novice at this.
    So there are two ways I can think of:
    1. Read directly from the Pages document when it is open. The problem with this is that it's a Pages template and it contains tables. Perhaps the easiest thing would be just to select certain cells directly from pages, but I have no idea how they're labeled or how to access them so I came up with a second idea. If you happen to know how to do this, I would greatly appreciate it.
    2. Pages documents can be unzipped and one of the files is an xml file with a lot of tags and the data I need. I found the following post that talks about how to parse XML via an XSL stylesheet. After going through some tutorials, I got stuck because the xml itself in the Pages file is just a mess to me and I'm confused about which node to choose. In other xml docs you can see a clear, nicely laid out tabbed structure so you can at least figure out the path to the node you want. I stumbled across a nice script for TextWrangler which cleans up XML, but it just barks at the Pages file.
    3. On top of that, I will need to use the name field and match that with an Address Book e-mail address. Should I change the template and make it into an address book field?
    Thanks in advance,
    Paul

    The script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
    Maybe you might want to try the following script:
    tell application "Pages"
        activate
        tell foreground layer of page 1 of front document
            select (text box 1 whose vertical position < 0.5)
            tell application "System Events"
                keystroke "c" using {command down} -- ⌘C
                keystroke "a" using {shift down, command down} -- ⇧⌘A
            end tell
            set theText to the clipboard
        end tell
    end tell
    set TID to AppleScript's text item delimiters
    set AppleScript's text item delimiters to tab
    set theTextFields to text items of theText
    set AppleScript's text item delimiters to TID
    set {theDate, theLessonNo, theStudent} to {item 2, item 4, item 6} of theTextFields

  • Read XML data from URL

    Hello,
    Greetings to everybody. I am having a problem reading or capturing the XML data being send by a URL and the said URL does not send the XML data as a file, but it just send it out as data.
    I do not know how to capture the said xml data from the said given URL. Please Help. Thank You, very, very, very much.
    Cheers !
    vins
    [email protected]

    public String getXml(String strURL){
    URL url  = null;
    URLConnection conn = null;
    BufferedReader in = null;
    try{
        url = new URL(strURL);
        conn = url.openConnection();
        in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line = null;
        StringBuffer xml = new StringBuffer();
        while ((line = in.readLine()) != null){
            xml.append(line);
    catch (Exception e){ }
    finally {  // close th eresource
    return xml.toString()
    }String xml = getXml("http://www....");
    InputSource source = new InputSource(new StringReader(xml));
    // use a parse to parse the xml document in the inputsource

  • PASS DATA FROM ABAP PROGRAM TO WORKFLOW CONTAINER

    Hello Everybody,
    I am a workflow beginner and I want to pass a data from my ABAP code to a workflow container. This workflow container is used in the Send Mail step.
    The ABAP  Program is:
    REPORT  zdb_work_flow.
    tables : vbak.
    DATA : k TYPE sweinstcou-objkey,
                e TYPE swetypecou-event.
    DATA : st TYPE swcont,
                itab TYPE STANDARD TABLE OF swcont.
    PARAMETERS : vbeln TYPE vbak-vbeln.
    start-of-selection.
      st-element = 'VBELN'.   "This is my WORKFLOW CONTAINER
      st-tab_index = 1.
      st-elemlength = 10.
      st-type = 'C'.
      st-value = vbeln.
      append st to itab.
      k = vbeln.
      e = 'TRIGGER'               "This is an event in my BUS OBJ ZDB_WFLOW
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype                               = 'ZDB_WFLOW'   "My BUS OBJ
          objkey                                 = k
          event                                  = e    "Event TRIGGER in ZDB_WFLOW
        tables
          event_container               = itab
        exceptions
          objtype_not_found             = 1
          OTHERS                        = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.         .
      COMMIT WORK.
    Now I have created a workflow in SWDD as ZDB_WF_SW.
    In this WF I have created a container as VBELN.
    In the SEND MAIL I have given a header as "Worflow Triggered for &VBELN&"
    PROBLEM.
    The Workflow is getting triggered. I am also getting a mail "Workflow Triggered for" in my mailbox but the &VBELN& is missing from the header.
    I have set the IMPORT EXPORT flag of the WF CONTAINER "VBELN"
    Please Help.
    Edited by: Deepankar.B on Feb 22, 2011 4:08 PM
    Edited by: Deepankar.B on Feb 22, 2011 4:10 PM

    You wouldn't use a SMA as an assistance class - but refer to one within it.
    I would use Shared Memory Area classes - but I'd also build a SMA that could talk across multiple application servers.
    Thomas Jung proposed this in a forum reply some time ago.
    It shouldn't be too difficult to use RFC's to access the content of SMA's in multiple app servers - ensuring synchronisation across multi app servers. I've not yet had the need, so haven't attempted.
    The long polling in 7.02 apparently uses this approach, so in a 7.02 system there may even be standard components/ SMAs that you could use.
    I do not think global areas in FM's are available across sessions - I don't think you could use that as a data transport.

  • Read DB2 tables from ABAP program

    Hi All,
    I have a requirement to read a DB2 table(in our landscape) from the ABAP program.  I appreciate any pointers.
    Thanks,
    Kiran.

    Connecting to an External database from SAP
    Step 1: Create an entry for the External database in DBCON table using Trxn: DBCA.
    Table: DBCON (Description of Database Connections)
    Field Name Description Value (For: E.g.:)
    CON_NAME Logical name for a database RAJ
    DBMS Database system MSS
    USER_NAME Database user <username>
    PASSWORD Password for setting up the connection to the database <pwd>/<pwd>
    CON_ENV Database-specific information for a database connection MSSQL_SERVER=depotserver MSSQL_DBNAME=HOF_INDORE
    DB_RECO Availability type for an open database connect
    Step 2: Now you can write code to connect to the external database…
    Your Sample code can be something like this……
    FUNCTION-POOL z_houston. "MESSAGE-ID ..
    DATA: BEGIN OF wa,
    c_locid(3),
    c_locname(50),
    c_locstate(5),
    END OF wa.
    FUNCTION z_houston_connect.
    ""Local interface:
    EXEC SQL.
    CONNECT TO 'RAJ' AS 'V'
    ENDEXEC.
    EXEC SQL.
    SET CONNECTION 'V'
    ENDEXEC.
    *- Get the data from MS-SQL Server
    EXEC SQL.
    open C1 for
    select
    loc_id,
    loc_name,
    loc_state
    from ho_loc_mast
    ENDEXEC.
    DO.
    EXEC SQL.
    FETCH NEXT C1 into :wa-c_locid, :wa-c_locname, :wa-c_locstate
    ENDEXEC.
    IF sy-subrc = 0.
    PERFORM loop_output.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    EXEC SQL.
    CLOSE C1
    ENDEXEC.
    ENDFUNCTION.
    *& Form LOOP_OUTPUT
    Output
    FORM loop_output .
    WRITE: /5 wa-c_locid, 10 wa-c_locname, 65 wa-c_locstate.
    CLEAR wa.
    ENDFORM. " LOOP_OUTPUT

  • Import data from ABAP program to Excell template file

    Hello everyone
    I have  a such task: In abap program I have fields(screen fields), which I want to import into excell file. I don't want to export into empty file but into ready template .xls. Is there any possibility to match corresponding fields?
    I really need to know, I will be gratefully for any suggestions.
    Greetings

    Hi Katarzyna ,
    something like
    DATA: EXCEL TYPE OLE2_OBJECT.
    DATA: BOOKS TYPE OLE2_OBJECT.
    DATA: BOOK  TYPE OLE2_OBJECT.
    DATA: CELL  TYPE OLE2_OBJECT.
    DATA: FONT  TYPE OLE2_OBJECT.
    DATA: FILE  TYPE OLE2_OBJECT.
      CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
      CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
      CALL METHOD OF  FILE 'OPEN' EXPORTING #1 = P_FILE
                                            #2 = 1.  
      CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = P_LINE
                                                    #2 = P_COLUMN.
      SET PROPERTY OF CELL 'VALUE' = P_VALUE.
      CALL METHOD OF EXCEL 'QUIT'.
    This is just a compilation from a complex program. Do some modularization (i.e. create FORM fill_cell using P_line P_column P_value...)
    Hope I did not forget anything. Meanwhile we have much more modern and advanced methods and classes - this one is of 2000 (Release 4.5?).
    Regards,
    Clemens

  • JAXB: Read XML data from a String?

    Hi,
    I get XML data not from file but as a string and I wanted to use JAXB to parse it and get my Java Objects.
    The unmarshall methods wants an "InputStream", but "StringBufferInputStream" is deprecated, so that I don't know a way to use my String as InputStream.
    Can someone give me a hint other then writing the data in a file first?

    Hi FrankSch,
    The unmarshall methods wants an "InputStream", but
    "StringBufferInputStream" is deprecated, so that I
    don't know a way to use my String as InputStream.
    Can someone give me a hint other then writing the data
    in a file first?Yes, the class StringBufferInputStream is deprecated, and the deprecation notice reads:
    Deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.
    The JDK API usually mentions an alternative to the deprecated method/class and in this case, you should use java.io.StringReader. It has one constructor and should suite you nicely:
    StringReader(String s) That way, you get an InputStream object; you can now use JAXB.
    Hope this helps,
    -ike, .si

  • Reading  xml data from url and insert into table

    CREATE TABLE url_tab2
    URL_NAME VARCHAR2(100),
    URL SYS.URIType
    INSERT INTO url_tab2 VALUES
    (’This is a test URL’,
    sys.UriFactory.getUri(’http://www.domain.com/test.xml’)
    it is giving error as invalid character

    Check if your single quotes are the correct single quotes.
    The principle works as advertised in the XMLDB Developers Guide...
    C:\>sqlplus / as sysdba
    SQL*Plus: Release 11.1.0.7.0 - Production on Tue Nov 25 21:44:46 2008
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create user OTN identified by OTN account unlock;
    User created.
    SQL> grant dba, xdbadmin to OTN;
    Grant succeeded.
    SQL> conn OTN/OTN
    Connected.
    SQL> CREATE TABLE uri_tab (docUrl SYS.URIType, docName VARCHAR2(200));
    Table created.
    SQL> -- Method SYS.URIFACTORY.getURI() with absolute URIs
    SQL> -- Insert an HTTPUri with absolute URL into SYS.URIType using URIFACTORY.
    SQL> -- The target is Oracle home page.
    SQL> INSERT INTO uri_tab VALUES
      2  (SYS.URIFACTORY.getURI('http://www.oracle.com'), 'AbsURL');
    1 row created.
    SQL> -- Insert an HTTPUri with relative URL using constructor SYS.HTTPURIType.
    SQL> -- Note the absence of prefix http://. The target is the same.
    SQL> INSERT INTO uri_tab VALUES (SYS.HTTPURIType('www.oracle.com'), 'RelURL');
    1 row created.
    SQL> -- Insert a DBUri that targets employee data from database table hr.employees.
    SQL>
    SQL> INSERT INTO uri_tab VALUES
      2  (SYS.URIFACTORY.getURI('/oradb/HR/EMPLOYEES/ROW[EMPLOYEE_ID=200]'), 'Emp200');
    1 row created.
    SQL> SELECT e.docUrl.getCLOB(), docName FROM uri_tab e;
    E.DOCURL.GETCLOB()
    DOCNAME
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    <head>
    AbsURL
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    E.DOCURL.GETCLOB()
    DOCNAME
    <head>
    RelURL
    <?xml version="1.0"?>
    <ROW>
      <EMPLOYEE_ID>200</EMPLOYEE_ID>
      <FIRST_NAME>Jenn
    Emp200
    SQL> set long 1000
    SQL> select HTTPURITYPE('www.oracle.com').getCLob() from dual;
    HTTPURITYPE('WWW.ORACLE.COM').GETCLOB()
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
    ">
    <html>
    <head>
    <title>Oracle 11g, Siebel, PeopleSoft |
    Oracle, The World's Largest Enterprise S
    oftware Company</title>
    <meta name="title" content="Enterprise Applications | D
    atabase | Fusion Middleware | Applicatio
    ns Unlimited | Business | Oracle, The Wo
    rld's Largest Enterprise Software CompanEdited by: Marco Gralike on Nov 25, 2008 10:13 PM

  • Read XML data from file

    Hello!
    I have data in an xml file which i want to read into my program. The problem is i do not want to parse the whole file at once, but in sequece, maybe in to or three sequences. In other words i want to parse the frist part of the file, and then the next sequence.
    Is this possible and how? I use a SAXParser right now, but it parses the whole file at once. Examles and refrences to java api is appreciated
    Best Regards
    Yoshi

    Ok!
    the problem is not to call the function several times, but that the function parse in SAXParser parses the whole xml file at once, so im not sure how a switch case loop is going to help me, maybe you could clarify a little.
    The data in the xml file contains history im going to read into the program, simulating progress. each root element contains a progress. So i want to read one element at a time everey time i call the parse function or a function containing the SAXParse function
    like this
    <datafile>
    <loggfile>
    <time>10:11</time>
    <data>12323></data>
    </loggfile>
    <loggfile>
    <time>10:12</time>
    <data>12424</data>
    </loggfile>
    </datafile>
    best regards
    Yoshi

  • How to read XML data from URL

    Hi All,
    I have one requirement. I have one URL which gives me data in XML format. I need to read this file and store this data into my SAP tables.
    Can anybody suggest how read this XML file using URL?
    Thanks in advance,
    P.Shridhar.

    Use a Server java proxy generated from your inbound message interface which would make a URLConnection to the specified URL after it gets triggered by BPM. A code snippet to achieve the same could be
    URL url  = null;
    URLConnection conn = null;
    BufferedReader in = null;
    url = new URL("http://someurl.someserver.com");
    conn = url.openConnection();
    in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line = null;
    StringBuffer xml = new StringBuffer();
    while ((line = in.readLine()) != null){
            xml.append(line);
    -- amol

  • Upload data from abap program to abap inbound proxy

    Hi,
    I have requirement to upload flat file data to an internal table and call Inbound proxy abap class and pass all the internal table data to tha proxy clas method structure.
    So could any one help me how to send/pass data to class, Please give some e.g.
    thanks
    bobby
    Edited by: Bobby G on Nov 18, 2009 4:35 AM

    hi;
    you may follow the following ways
    1. create a report and by using GUI_upload, give the path as default , you can convert the flat file's data into internal table.
    2. call that report in proxy method by returning parameter as a table, this table can use further in the proxy.
    Another way, you have
    1.  Create a transparent table and by using the GUI_Upload in report,  you may  store the data.
    2.  from step 1, you may use data in the proxy.
    Regards
    Shashi

  • How to read xml data from jsf,

    Hi
    I would like to know how to read data in an xml so as we can display that data onto the jsf page to the user, say as a data table, or in an output txt box etc...

    This is nothing JSF-special. Just convert XML to objects (DTO's) and then use them in JSF.
    There are several ways to crawl the XML tree. JXPath and DOM4J are popular.

Maybe you are looking for

  • Dreamweaver / flash custom sites on .Mac accounts

    Hello everyone and Happy New Year! How can i upload custom pages created with dreamweaver and flash onto my .Mac account? Thank you, Jonathan

  • Security in human task views

    Can anybody explain or give a pointer to documentation on how to implement security (authorization with roles) in BPM human task views? What do we need to configure to achieve this? // npettersson Edited by: npettersson on 2011-jul-29 05:07

  • WEP or WPA security

    D-Link DI-624 offers either mode. The WEP mode is easier to understand and relatively painless for setting up under 64-bit passwords. Do 128-bit passwords offer a much greater level of security? (The network is home based, in a small town.) Should I

  • Rollover Area appeared on all slides

    While editing a project in Captivate 5.5 I realized that at some point I've done something to make a Rollover area appear on all slides. During editing I saved the file with a new name in case I needed to go back to the original. When I check the old

  • Changing the R/3 system

    Hello, We are on EP7.0 and trying to connect to a different R/3 system from the one which we are currently connected to ...after creating the jco's I get the following error when trying to access ESS services: Caused by: com.sap.tc.webdynpro.services