CDATA in xml file

Hi everybody
Can anyone tell me the best way to transform parts of my xml file as CDATA ?
For some part of my xml file i need the '&lt' '&gt' instead of < and > .
Thanks for your help

Hi michal
I tried using [[!CDATA in different formats as you suggested but none is producing the desired result. Can you identify which format you have exactly used and let me know please?
This is my xml file
<ns0:QueryString_Initial_MT xmlns:ns0="urn:ABG.com/EDI/PurchaseOrders">
   <pin/>
   <user_id/>
   <pwd/>
   <orders_lines>
      <isbn>sfdg</isbn>
      <record_dues>fgfh</record_dues>
      <part_supply>fdg</part_supply>
      <order_quantity>fdds</order_quantity>
      <order_line_reference>ffg</order_line_reference>
      <special_instructions>f</special_instructions>
      <affiliate_id>dfg</affiliate_id>
      <promotional_code>df</promotional_code>
   </orders_lines>
   <orders_ref>f</orders_ref>
</ns0:QueryString_Initial_MT>
I want the <orders_line> tag and its sub tags to be presented as a string.
Even an XSLT for it be a great help.
thanks a lot

Similar Messages

  • Extracting cdata from xml file ( if_ixml_cdata_section )

    Hello,
    We will receive xml files containing product data that I want to upload into the sales text of our materials in JP28.
    Using the iXML library with T_FILE_PARSE program as an example I can easily extract most fields but the problem is that one field has paragraphs of text in CData. Using the code bellow I can extract some of the data as a string but it's too short to get everything.
    case node->get_type( ).
          when if_ixml_node=>co_node_cdata_section.
            break grainneq.
            text = node->get_value( ).
            write: / 'CDATA:'.
            write at indent text color col_group inverse.
    Looking in the library

    My bad, text was in fact receiving the full string (I thought it was truncating).
    So I've just added a function module to split the string into lines that the CREATE_TEXT fm can handle.
    Both responses were helpful so I've awarded points....although the question was probably confusing to you as the data was there along:)
    Thanks for the quick response in any case.
    when if_ixml_node=>co_node_cdata_section.
            text = node->get_value( ).
            call function 'SWA_STRING_SPLIT'
              exporting
                input_string           = text
                max_component_length   = 132
              tables
                string_components      = swastrtab.

  • Dreamweaver - using CDATA in xml file

    Greetings, I am a designer, not much of a coder... trying to bring in an xml file into an html file using the Spry Menu.  I went through creating the .xml file, inserting a Spry table, all working with success. EXCEPT that the CData link I have referenced is coming up as text, not a link.  I thought a CDATA attribute would be read as html.
    Here's the TEST.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <orgs>
    <org>
                <name><![CDATA[<a href="http://www.animaltribes.com">Animal Tribes</a>]]></name>
                <type>Sanctuary</type>
                <animal>Horses</animal>
                <animaltype>Wild Horses</animaltype>
                <city>Reno</city>
                <state>NV</state>
            </org>
    </orgs>
    And here's my page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>TEST XML</title>
    <script src="SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var dsTest1 = new Spry.Data.XMLDataSet("TEST.xml", "orgs/org",{sortOnLoad:"name",sortOrderOnLoad:"ascending",distinctOnLoad:true,useCache:fa lse});
    //-->
    </script>
    </head>
    <body>
    <div spry:region="dsTest1">
      <table>
        <tr>
          <th spry:sort="name">Name</th>
          <th spry:sort="type">Type</th>
          <th>Animal</th>
          <th spry:sort="animaltype">Animaltype</th>
          <th spry:sort="city">City</th>
          <th spry:sort="state">State</th>
        </tr>
        <tr spry:repeat="dsTest1">
          <td>{name}</td>
          <td>{type}</td>
          <td>{animal}</td>
          <td>{animaltype}</td>
          <td>{city}</td>
          <td>{state}</td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    I did not think I needed a .xsl page for a simple table like this.  I feel like I am missing something basic!  Please help.  Much appreciated.
    Kimberly

    Thanks for your quick response!
    So all I need to do is change the html file to add the line you suggested.  The html file looks like this now:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>TEST XML</title>
    <script src="SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var dsTest1 = new Spry.Data.XMLDataSet("TEST.xml", "orgs/org",{sortOnLoad:"name",sortOrderOnLoad:"ascending",distinctOnL oad:true,useCache:false});
    dsTest1.setColumnType("name", "html");
    //-->
    </script>
    </head>
    <body>
    <div spry:region="dsTest1">
      <table>
        <tr>
          <th spry:sort="name">Name</th>
          <th spry:sort="type">Type</th>
          <th>Animal</th>
          <th spry:sort="animaltype">Animaltype</th>
          <th spry:sort="city">City</th>
          <th spry:sort="state">State</th>
        </tr>
        <tr spry:repeat="dsTest1">
          <td>{name}</td>
          <td>{type}</td>
          <td>{animal}</td>
          <td>{animaltype}</td>
          <td>{city}</td>
          <td>{state}</td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    I am getting FAILED TO RETRIEVE DATA SET (dsTest1) FOR SPRY REPEAT.
    Or do should I start over and re-insert the Spry region?
    Sorry for being a neophyte and thank you for your patience!
    Kimberly

  • CDATA section in a tag of an XML file

    Hi SDNers:
    I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
    I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
    The XML file is perfectly alright. But now there's a need to add CDATA section.
    I need the CDATA section as follows in XML file...
    <CustomField>
        <![CDATA[
              First Line of Text
              Second line of Text
              Third Line of Text
          ]]>
    </CustomField>
    but don't know how to program this. Can anybody help/advice me on this?
    Looking forward to your optimum response(s).
    Best Regards

    Hi SDNers:
    I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
    I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
    The XML file is perfectly alright. But now there's a need to add CDATA section.
    I need the CDATA section as follows in XML file...
    <CustomField>
        <![CDATA[
              First Line of Text
              Second line of Text
              Third Line of Text
          ]]>
    </CustomField>
    but don't know how to program this. Can anybody help/advice me on this?
    Looking forward to your optimum response(s).
    Best Regards

  • Want parse huge xml file for CDATA

    HI all
    I want to parse hude xml file for getting values of CDATA
    can u plz give me sample code for that
    here i am attaching the part of my xml file
    <initParams>
    <param description="simulation mode " name="smtpSimulationMode" passOn="false" required="false" type="bool" varSubstitute="false">
    <![CDATA[false]]>
    </param>
    <param description="full name of smtp host" name="smtpHost" passOn="false" required="true" type="string" varSubstitute="false">
    <![CDATA[222222]]>
    </param>
    <param description="smtpUserName for authentication" name="smtpUserName" passOn="false" required="false" type="string" varSubstitute="false"/>
    <param description="smtpUserPassword for authentication" name="smtpUserPassword" passOn="false" required="false" type="string" varSubstitute="false"/>
    <param description="ip address for remote server" name="serverId" passOn="false" required="true" type="string" varSubstitute="false">
    <![CDATA[1111111]]>
    </param>
    <param description="location of file on remote server side" name="fileRemoteLocation" passOn="false" required="false" type="string" varSubstitute="false">
    <![CDATA[test/]]>
    </param>
    <param description="user name for authentication" name="userName" passOn="false" required="true" type="string" varSubstitute="false">
    <![CDATA[abc]]>
    </param>
    </initParams>
    thanks in advance

    There are several Java XML API's available. SAX, JXpath, DOM4J, Xerces, etcetera.

  • XML file size increases GREATLY with ![CDATA[

    I have several .xml files that provide info for a website of
    mine and was quite surprised to discover, while I was uploading
    them, that some of them were around 60-70kb, while others were 4kb
    or less. Knowing that the amount of content in all of them doesn't
    vary that much, I noticed that the biggest file sizes corresponded
    to the files using <![CDATA[ ]]>.
    I included a sample file code below. It's in Portuguese, but
    I think it's still obvious that this file could not be more than a
    few kb, and Dreamweaver (CS3) saves it with a whopping 62kb!
    I tried saving the exact same file in Text Edit and it
    resulted in a normal file size.
    Has anyone encountered similar situations? I'm guessing this
    is some sort of bug, that Dreamweaver puts some extra content -
    somewhere - because of the CDATA. Is there any sort of reason or
    fix for this?
    Thanks in advance.

    Ok... embarassing moment. Just realized that DW CS3 is not
    guilty. In Leopard, in the file's Get Info panel, I changed the
    preferred application to open it, and the file's size changed
    according to different applications. Reverting back to DW CS3, it
    still resulted in the 60-70kb size, but deleting the file and
    saving a new one it the same name solved the problem.
    Sorry guys.

  • Preserving CDATA when reading then writing XML files

    Hi All,
    I have some source XML that needs to have an update applied and then written back out into a new directory. This all works fine except some of the other elements have values with CDATA around them in the input file and on the output file the CDATA is replaced and the characters substituted ie: turned in &amp;
    This is (I guess) default behaviour but I would like the CDATA preserved and writing out into the new XML file.
    How can I do this ?
    Regards,
    Steve

    Found the answer :
            DOMParser dp = new DOMParser();
            dp.retainCDATASection(true);
            dp.parse(xmlFile);
            xmlDoc = (XMLDocument)dp.getDocument();

  • Reference a DSL from CDATA section in an Xml file

    I use a DSL along with some XML files in an Eclipse project. I would like to reference some of the DSL entities from within a CDATA section in the XML files and provide content assist for doing so.
    Would I need to define a DSL for the XML and then implement some DSL cross referencing ?
    Would I lose the default XML features of Eclipse if I do so ?
    Is there a way to overload the XML support built into Eclipse for implementing this ?

    I don't know about the extension capabilities of the XML editor. You would need to investigate how this editor can be extended first. This might be a question for Eclipse Web Tools Platform, if you use that XML editor (there are several XML editor plugins available).

  • Is it possible to generate this XML file?

    Hi guys,
    I'm starting to work with XML features at Oracle an I would like to know if it is possible to generate the following XML file with Oracle:
    <?xml version="1.0" encoding="UTF-8"?>
    <DATA_IMPORT LOCALE="en_GB" VERSION="5.2">
    <RULE_SET>
    <RULE BUSINESS_UNITS="Canada" CALENDAR="Main Monthly Calendar" EFFECTIVE_END_DATE="01-Jan-2200" EFFECTIVE_START_DATE="01-Jan-2005" NAME="CAN-Direct Sales Booking Credit" TYPE="DIRECT_TRANSACTION_CREDIT">
    <ACTION_EXPRESSION_SET>
    <ACTION_EXPRESSION>
    <FUNCTION ID="DIRECT_TRANSACTION_CREDIT" RULE_TYPES="DIRECT_TRANSACTION_CREDIT">
    <OUTPUT_REFERENCE NAME="CAN-Direct Sales Booking Credit" PERIOD_TYPE="month" TYPE="Credit" UNIT_TYPE="Can"/>
    <DATA_FIELD>SalesTransaction.value</DATA_FIELD>
    <HOLD_REF NAME="Release Immediately" PERIOD_OFFSET="0" PERIOD_TYPE="Release Immediately"/>
    <STRING_LITERAL>NULL</STRING_LITERAL>
    <CREDIT_TYPE>booking</CREDIT_TYPE>
    <BOOLEAN>false</BOOLEAN>
    <BOOLEAN>true</BOOLEAN>
    <DATA_FIELD>SalesTransaction.compensationDate</DATA_FIELD>
    </FUNCTION>
    </ACTION_EXPRESSION>
    </ACTION_EXPRESSION_SET>
    <CONDITION_EXPRESSION>
    <OPERATOR ID="ISEQUALTO_OPERATOR">
    <DATA_FIELD>SalesTransaction.eventType.eventTypeId</DATA_FIELD>
    <STRING_LITERAL><![CDATA[booking]]></STRING_LITERAL>
    </OPERATOR>
    </CONDITION_EXPRESSION>
    <TERRITORY_EXPRESSION>
    <RULE_ELEMENT_REF ID="TERRITORYVARIABLE" NAME="CAN-Territory Variable"/>
    </TERRITORY_EXPRESSION>
    </RULE>
    </RULE_SET>
    </DATA_IMPORT>
    I investigated some of the dbms_xmlgen features, but I can't understand how to define the following tag, for example:
    "<RULE BUSINESS_UNITS="Canada" CALENDAR="Main Monthly Calendar" EFFECTIVE_END_DATE="01-Jan-2200" EFFECTIVE_START_DATE="01-Jan-2005" NAME="CAN-Direct Sales Booking Credit" TYPE="DIRECT_TRANSACTION_CREDIT">"
    Any help is welcome.
    Thanks.
    Rui Barata

    I would offer that the SQL/XML functions of XMLElement/XMLForest/XMLAgg would be more appropriate to your situation. They give you finer control over the XML that is generated. You can find examples in this forum or the {forum:id=34} forum.

  • object is not working in CDATA in XML with flash

    hi, in my xml file I use CDATA to insert html code. I have put <object >.. .some flash movie file. .. . </object>. But in front end , I did not get any video played. Why <object> html element does not support + what would be next solution to show my you tube vidoe file.. Thanks for taking interest on this issue.

    what are you doing with the string "<object>...some flash movie...</object>"?

  • Xml file not displaying.

    Hello all,
    Pls i am trying to work on an example that displays some pics in form of slide show. Everything worked fine till i got to a point of displaying the content of an xml file. I tried all i could but things did not work out. someone pls help, i am frustrated. Below re my codes.
    test.xml
    <?xml version="1.0"?>
    <wedshow>
    <audio source="devpics/mus.mp3 />
    <photo duration="10" source="devpics/test.jpg" />
    <photo duration="20" source="devpics/tes.jpg" />
    <photo duration="20" source="devpics/testA.jpg" />
    </wedshow>
    WedShowPlayer2.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:MyComp="*" layout="absolute" initialize="init();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    private function init():void {
    service.send();
    ]]>
    </mx:Script>
    <mx:HTTPService id="service" url="component/test.xml" resultFormat="e4x" result="show.loadShow(
    XML(event.result) ); show.playShow();" />
    <MyComp:WedShow id="show" width="100%" height="100%" horizontalCenter="0"/>
    </mx:Application>
    WedShow.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import flash.display.Loader;
    [Bindable]
    private var _xml:XML;
    private var photos:ArrayCollection = new ArrayCollection();
    private var sound:Sound;
    private var iLoaded:uint = 1;
    private var isLoaded:Boolean = false;
    private var timer:Timer = new Timer(1000,0);
    private var photoIndex:int = 0;
    private var nextPhotoTime:int = 1;
    public function playShow():void {
    if(isLoaded) {
    play.visible = false;
    timer = new Timer(1000,0);
    timer.addEventListener( TimerEvent.TIMER, onTime );
    timer.start();
    if(sound!=null) {sound.play();}
    } else { loadShow( _xml ); }
    private function onTime( event:TimerEvent ):void {
    if( event.currentTarget.currentCount == nextPhotoTime ) {
    if( photos.length > photoIndex ) {
    image.load(Loader(photos[photoIndex]).content);
    // using e4x to access the photo duration attribute
    nextPhotoTime += int(_xml.photo[photoIndex].@duration);
    photoIndex++;
    } else {
    stopShow();
    public function stopShow():void {
    timer.stop();
    timer.reset();
    image.source="";
    SoundMixer.stopAll();
    photoIndex = 0;
    nextPhotoTime = 1;
    play.visible = true;
    public function loadShow( xml:XML ):void {
    _xml = xml;
    photos = new ArrayCollection();
    iLoaded = 1;
    isLoaded = false;
    photoIndex = 0;
    nextPhotoTime = 1;
    progress.visible = true;
    play.visible = false;
    for each(var photoNode:XML in _xml.photo) {
    var photo:Loader = new Loader();
    photo.load(new URLRequest(photoNode.@source));
    photo.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    onProgress);
    photo.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    photos.addItem(photo);
    progress.label="Loading Image " + iLoaded +" of " + photos.length + ".";
    private function onProgress( event:ProgressEvent ):void {
    var loaded:Number = 0;
    var total:Number = 0;
    if(iLoaded<photos.length) {
    for each(var item:Loader in photos) {
    loaded += item.contentLoaderInfo.bytesLoaded;
    total += item.contentLoaderInfo.bytesTotal;
    } else {
    loaded = event.bytesLoaded;
    total = event.bytesTotal;
    progress.setProgress(loaded,total);
    private function onComplete( event:Event ):void {
    if(iLoaded<photos.length) {
    iLoaded++;
    progress.label="Loading Image " + iLoaded + "of" +
    photos.length;
    } else if (sound==null && _xml.audio[0].@source!="") {
    sound = new Sound();
    sound.addEventListener(ProgressEvent.PROGRESS, onProgress);
    sound.addEventListener(Event.COMPLETE, onComplete);
    sound.load(new URLRequest(_xml.audio[0].@source));
    progress.label="Loading Audio";
    } else {
    progress.visible = false;
    play.visible = true;
    isLoaded = true;
    ]]>
    </mx:Script>
    <mx:LinkButton id="play" label="Play" horizontalCenter="0" verticalCenter="0" visible="false" color="0xFFFFFF" />
    <mx:ProgressBar id="progress" mode="manual" width="60%" horizontalCenter="0" verticalCenter="0" color="0xFFFFFF" />
    <mx:Image id="image" horizontalCenter="0" verticalCenter="0"/>
    </mx:Canvas>
    anyone pls help
    thanks in anticipation
    [email protected]

    hey try out this link it may help you
    http://www.judahfrangipane.com/blog/2007/01/01/error-2044-unhandled-ioerrorevent-texterror -2038-file-io-error/
    thanks & regards
    gajanan
    [email protected]

  • Uploading xml file in a background job .

    Hi Experts ,
    I am uploading a xml file from application server to internal table .
    While uploading from presentation server I get the value of stream as ( first few lines )
    Case 1 :
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>##  <IDOC BEGIN="1">##    <EDI_DC
    40 SEGMENT="1">##      <TABNAM>EDI_DC40</TABNAM>##
    but while uploading from  application server , I get :
    Case 2 :
    <?xml version="1.0" standalone="yes"?>##<WPUBON01>##  <IDOC BEGIN="1">##    <EDI
    DC40 SEGMENT="1">##      <TABNAM>EDIDC40</TABNAM>##      <MANDT>108</MANDT>##
    Difference is of  unicode 16 as seen in file from presentation server .
    As a result File from Presentation server is getting uploaded in internal table , but not from Application Server . In this case internal table is coming blank .
    I am using :
          CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
              EXPORTING
                text   = stream
              IMPORTING
                buffer = xstring
              EXCEPTIONS
                failed = 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.
    here xstring is coming blank when you use same file from application server .
    *Extract data from xsting to internal table
            CALL FUNCTION 'SMUM_XML_PARSE'
              EXPORTING
                xml_input = xstring
              TABLES
                xml_table = it_data
                return    = it_ret.
    I am getting error it it_ret as :
    line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment
    How to get file like case 1 . or how to convert to utf-16 ?
    I am using :
    OPEN DATASET l_filename FOR INPUT IN  BINARY MODE    .
    DO.
    READ DATASET l_filename INTO l_xml_line.
    IF sy-subrc EQ 0.
    APPEND l_xml_line TO l_xml_table.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET l_filename.
    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.
    Help please ......
    regards ,
    SA

    Hi Alpana ,
    Thanks for the reply .
    I already am uploading data in internal table . If you see through my question ,
    My problem is modify  the error in xml file uploaded in  l_xml_table through read dataset .
    My file has been uploaded   from application server as 
    <?xml version="1.0" standalone="yes"?>
    <WPUBON01>
      <IDOC BEGIN="1">
    This file is getting changed while uploading from presentation server as 
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>##  <IDOC BEGIN="1">##    <EDI_DC
    40 SEGMENT="1">##      <TABNAM>EDI_DC40</TABNAM>##
          <MANDT>108</MANDT>##      <DOCNUM>3C10000001
    notice the addition   'encoding="utf-16" '  .
    How to achieve this addition .
    If i am uploading it frompresentation server it is getting uploaded in internal table successfully , but not from application server
    so that i can parse this xml file into xstring successfulyy to get it into internal table thru function module
    CALL FUNCTION 'SMUM_XML_PARSE'
              EXPORTING
                xml_input = xstring
                xml_input = l_string_output
              TABLES
                xml_table = it_data
                return    = it_ret.
    Please help me in hanging the file stream .
    Regards ,
    SA

  • How to retrieve image from XML  file

    Hi All,
    I am new to XML. So any best guidance is appreciated.
    The application requirement is to display image retrived from uploaded xml file in file upload section of our application. And store that image in database.
    In my XML file , images & strings & numbers & booleans are there . I am able to save everything in database except images .
    I am using JSF, Seam & Hibernate combination. In my Hibernate entity class i took BLOB datatype for image.
    I am using following tags in my Xhtml file to display image
    <s:graphicImage value="#{hibernateentitybean.picBlobtype}" height="200" width="200">
    <s:transformImageSize width="200" height="200" />
    <s:transformImageType contentType="image/jpeg"/>
    But image is not displayed in Xhtml file
    I am using org.w3c.dom.Document for retrieving node name & corresponding value in that node in XML file.
    I am getting code like below for Image when i am logging all values from XML files in my bean class .
    x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl
    I want to convert this value to image. So i can convert image to bytes and store in BLOB.
    Can anyone guide me ? or any other approach .
    Thanks in advance for any reply.
    Regards,
    Naresh

    Dan_Koldyr wrote:
    agree, it's really odd. Just reread OP and it says:
    NareshDharmiVatsal  wrote:
    want to convert this value to image. In any case it doesn't get worth then another single code line:
    final String cdata = "x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl";
    final sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
    final byte[] data = decoder.decodeBuffer(cdata);
    Blob blob = new SerialBlob(data);//or what ever other DB-specific blob implementaiton Did i answered original question? Any more comments to my first replay?I can comment on this latest code. The package sun.misc is private to Sun (Oracle now of course). It is undocumented and may change or be removed altogether in a future release. There is a good free open source Base64 decoder in the Jakarta Commons Codec library.

  • EntityEncodeStrings and Internet Explorer w/ CDATA in XML

    Hello.
    I'm makin a sort of content management system which fetches
    data from an XML file:
    (pages.xml)
    <pages>
    <page id="1">
    <title>Home</title>
    <link>#1</link>
    <content><![CDATA[<h3>Welcome"</h3><p>We're
    experimenting a lot with different stuff on this page, please bare
    with us.</p>]]></content>
    </page>
    <page id="2">
    <title>About</title>
    <link>#2</link>
    <content><![CDATA[<h3>about</h3>Woah,
    hold it there, punk.]]></content>
    </page>
    [etc...]
    </pages>
    My XHTML-file has this in the header:
    var nav = new Spry.Data.XMLDataSet("/pages.xml",
    "pages/page");
    nav.setColumnType("@id", "number");
    nav.setColumnType("content", "html"); // skips entity
    encoding \o/
    I want to display everything in the <content />-xml
    tree as (X)HTML
    With the code I have everything works perfectly in Firefox,
    but in Internet Explorer (7) I'm getting no data at all because of
    entityEncodeStrings not functioning correctly (or so it seems). If
    I remove this it displays in both Firefox and Internet Explorer
    (though with the entities encoded).
    It doesn't matter which way I do it, using the option
    entityEncodeStrings: false or -1 I get the same (non-)results.
    I'm very thankful for any help!

    http://labs.adobe.com/technologies/spry/samples/data_region/XMLDataSetStringHandlingSample .html

  • Issue with uploading XML file from application server into internal table

    i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module   SMUM_XML_PARSE and the error message is "line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?  
        TYPES: BEGIN OF T_XML,
                 raw(2000) TYPE C,
               END OF T_XML.
    DATA:GW_XML_TAB TYPE  T_XML.
    DATA:  GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
    DATA:GI_STR TYPE STRING.
    data:  GV_XML_STRING TYPE XSTRING.
    DATA: GI_XML_DATA TYPE  TABLE OF SMUM_XMLTB INITIAL SIZE 0.
    data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
        OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          MESSAGE 'File does not exist' TYPE 'E'.
        ELSE.
          DO.
    * Transfer the contents from the file to the work area of the internal table
            READ DATASET LV_FILE1 INTO GW_XML_TAB.
            IF SY-SUBRC EQ 0.
              CONDENSE GW_XML_TAB.
    *       Append the contents of the work area to the internal table
              APPEND GW_XML_TAB TO GI_XML_TAB.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
    * Close the file after reading the data
        CLOSE DATASET LV_FILE1.
        IF NOT GI_XML_TAB IS INITIAL.
          CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
        ENDIF.
    * The function module is used to convert string to xstring
        CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
          EXPORTING
            TEXT   = GI_STR
          IMPORTING
            BUFFER = GV_XML_STRING
          EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
        IF SY-SUBRC <> 0.
          MESSAGE 'Error in the XML file' TYPE 'E'.
        ENDIF.
      ENDIF.
      IF GV_SUBRC = 0.
    * Convert XML to internal table
        CALL FUNCTION 'SMUM_XML_PARSE'
          EXPORTING
            XML_INPUT = GV_XML_STRING
          TABLES
            XML_TABLE = GI_XML_DATA
            RETURN    = GI_RETURN.
      ENDIF.
      READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
      IF SY-SUBRC EQ 0.
        MESSAGE 'Error converting the input XML file' TYPE 'E'.
      ELSE.
        DELETE GI_XML_DATA WHERE TYPE <> 'V'.
        REFRESH GI_RETURN.
      ENDIF.

    Could you please tel me  why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
    Becuase there will be lot of  XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
    what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?>   ??????
    Is there any other way we can do with out removing the lines?

Maybe you are looking for