Parsing  Binary data to XML

Hi,
I am new for ALSB and I have problem with it.
How can I transform binary Data to xml. The binary datas are in a directory and after mapping to xml, I want them to have in other directory or in Oracle DB.
With Query tool I created binary_to_XML.xq file but can't use it in ALSB.
ALSB passes the files with out mapping?!
Thanks,
Emulate

The ALSB forum is http://forums.bea.com/bea/category.jspa?categoryID=600000003

Similar Messages

  • How to convert Binary Data into XML ???

    I am calling the getTaskInfo method of TaskManagerService class using Web Service API.
    The result includes the formdata in two formats:
    1.  Binary content of the form
    2.  Remote URL of the form data
    I have to find a value of a particular field using one of the above information.
    I am unable to convert the binary data to XML directly. I have also tried fetch the document based on remoteURL parameter which is also not working.
    Any suggestions are highly appreciated.
    Thanks
    Nith

    Hi Steffen,
    I found the same solution and fixed the issue long time back. Just forgot to close this forum topic.
    Thanks for your knowledge sharing.
    Nith

  • Help needed with binary data in xml (dtd,xml inside)

    I am using the java xml sql utility. I am trying to load some info into a table.
    my.dtd:
    <!ELEMENT ROWSET (ROW*)>
    <!ELEMENT ROW (ID,JPEGS?)>
    <!ELEMENT ID (#PCDATA)>
    <!ELEMENT DESCRIPTION EMPTY>
    <!ATTLIST DESCRIPTION file ENTITY #REQUIRED>
    <!NOTATION INFOFILE SYSTEM "Files with binary data inside">
    <!ENTITY file1 SYSTEM "abc.jpg" NDATA INFOFILE>
    xml file:
    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE ROWSET SYSTEM "MY.DTD">
    <ROWSET>
    <ROW>
    <ID>1272</ID>
    <DESCRIPTION file="file1"/>
    </ROW>
    </ROWSET>
    I am using the insertXML method to do this. However, the only value that gets loaded is the ID. abc.jpg is in the same directory where I ran the java program.
    Thanks in advance.

    Sorry! wrong dtd. It should read this instead:
    my.dtd:
    <!ELEMENT ROWSET (ROW*)>
    <!ELEMENT ROW (ID,DESCRIPTION?)>
    <!ELEMENT ID (#PCDATA)>
    <!ELEMENT DESCRIPTION EMPTY>
    <!ATTLIST DESCRIPTION file ENTITY #REQUIRED>
    <!NOTATION INFOFILE SYSTEM "Files with binary data inside">
    <!ENTITY file1 SYSTEM "abc.jpg" NDATA INFOFILE>
    null

  • Binary data in xml document

    Hi,
    I have some tables and I store binary data in varchar2 column. I want to create xml document from one of the table using xsql. What will happen to binary data? Can xml document takes care of binary data? I will appreciate, if I get the answer/solution for this.
    Thanks
    Prasanta De

    Hi,
    I have some tables and I store binary data in varchar2 column. I want to create xml document from one of the table using xsql. What will happen to binary data? Can xml document takes care of binary data? I will appreciate, if I get the answer/solution for this.
    Thanks
    Prasanta De

  • Including binary data in XML

    Hi,
    Is there a standard way (or maybe encoding to be used) to include
    binary data in an XML document? I am interested in both inline
    inclusion and external inclusion.
    Thanks.
    - sam
    null

    There is no way to include binary data within the document;
    however it could be referenced as an external unparsed entity
    that resided in a different file.
    Sam Lee (guest) wrote:
    : Hi,
    : Is there a standard way (or maybe encoding to be used) to
    include
    : binary data in an XML document? I am interested in both inline
    : inclusion and external inclusion.
    : Thanks.
    : - sam
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Problem: Storing binary data in Xml Cdata section

    The objective : Tranport image using xml
    1. I convert the image to input stream.
    2. store it in an array.
    3. encode the string using Base64 library and get a string
    4.then i store it in xml CDATA section.
    the code snippet is
    public class ImgToXml01 {
         public static void main(String[] args) throws IOException
              File inputFile = new File("C:\\Arup\\ImgXml\\read\\Sample.jpg");
              FileInputStream in = new FileInputStream(inputFile);
              String str="";
              int c;
              while ((c = in.read()) != -1) {
              str+= ""+c;
              String val = util.Base64.encode(str);
              System.out.println(""+val);
              OutputStream fout = new FileOutputStream("img.xml");
              OutputStreamWriter out = new OutputStreamWriter(fout);
              out.write("<?xml version = \"1.0\" encoding = \"ISO-8859-1\"?>\r\n");
              out.write("<Image>\r\n");
              out.write("[CDATA["+val+"]]");
              //out.write("]]>");
              out.write("</image>\r\n");
              out.close();
    When i retrieve it i write the code:
    import org.xmldb.api.base.*;
    import org.xmldb.api.modules.*;
    import org.xmldb.api.*;
    import org.w3c.dom.*;
    import java.io.*;
    import org.xml.sax.SAXException;
    import oracle.xml.parser.v2.*;
    public class CdataToImage01 {
         public static void main(String[] args) //throws IOException
         try{
         String uri="c:\\Arup\\ImgXml\\img1.xml";
         String data="";      
         File file = new File(uri);
         FileInputStream fis = new FileInputStream(file);
         BufferedInputStream in = new BufferedInputStream(fis);      
         DOMParser parser = new DOMParser();
         parser.parse(in);      
         Document doc = parser.getDocument();
         Node r = doc.getElementsByTagName("Image").item(0);          
         NodeList kids = r.getChildNodes();
         if ( kids != null )     {
              for ( int i = 0; i < kids.getLength(); i++ ) {
                   if ( (kids.item(i).getNodeType() == Node.TEXT_NODE) ||
                             (kids.item(i).getNodeType() == Node.CDATA_SECTION_NODE)) {
                             data=kids.item(i).getNodeValue();
              String data1 = util.Base64.decode(data);
              File outputFile = new File("Sample.jpg");
              FileOutputStream out = new FileOutputStream(outputFile);      
              byte[] buff = data1.getBytes();
              InputStream inn = new ByteArrayInputStream(buff);
              int c;
              System.out.println(buff.length);
              while ((c = inn.read()) != -1) {
              out.write(c);
              inn.close();
              out.close();
         catch (SAXException e) {
              System.err.println(e);
              e.printStackTrace();
         catch (Exception ex){
              System.err.println("Exception occured " + ex.getMessage());
              ex.printStackTrace();
    But i am not getting the appropriate result .I get a corrupted image.
    FROM
    ARUP GHOSH

    String str="";
    int c;
    while ((c = in.read()) != -1) {
    str+= ""+c;
    }Your problem is here.
    Let's suppose you just have a trivial 3-byte file containing the bytes 27, 55, and 126. Your program will convert that into the string "2755126". Then you base-64 encode it, etc etc, then you base-64 decode it and (hopefully) produce the same string "2755126". Converting this string to bytes and writing it to a file produces a 7-byte file containing the bytes 50, 55, 53, 53, 49, 50, and 54. Not the same at all. You could prove this to yourself by putting in some debugging statements.
    I don't know how to suggest a fix because it looks to me as if your base-64 utility takes a String as its input. It should take an array of bytes, or an InputStream.
    PC&#178;

  • Please recommend a  tool or framework that parsing delimited text to XML

    Working on a project that need me read data from delimited text file, the data will be converted to a tree-structure. So it's better parse the data into XML format first.
    Besides j2se or jdom, any fast tool for it?
    Thank you

    alex888 wrote:
    Working on a project that need me read data from delimited text file, the data will be converted to a tree-structure. So it's better parse the data into XML format first.What??? Why? You've got a text file and need an object tree, why do you think going to XML in between is a good idea?
    Besides j2se or jdom, any fast tool for it?What do you mean with "j2se", that's not a XML handling tool (it contains several, 'though).
    SAX sounds good for building object trees from XML, but there are several XML mapping libraries out there (try google).

  • Map binary data (PDF) to XML not possible due to non-printable chars

    Hi XI Gurus,
    we have the following issue.
    We send a PDF as binary data (as a hex string '25255044462D3' ) along with some other information from ERP within one RFC to XI , doing a message split 1:n for those two kind of messages (1. the PDF, 2. the XML) an send the split messages to file/ftp receiver adapter.
    The message split and sending of the messages is working well, but we encounter some problems with non-printable chars (hex code below 0x20) in the pdf binary. The PDF data and the dynamic file name is mapped into an XML. But the non printable characters are converted into '#' when mapped into the XML target field.
    (Due to the 1:n multi mapping, we cannot put the filename into dynamic configuration, so we have to map the pdf and the filename into an XML and extract the content with variable substitution in receiver file adapter....)
    My question is: how can binary data with non-printable chars be sent through XI and can be mapped into an XML without beeing replaced by '#' ?
    Any help will be greatly appreciated.
    Thanks and regards
    Holger

    Maybe I didn´t explained it clearly enough.
    We do not have the issue that the RFC puts the '#' into the string. We got from the RFC a hex string containing the pdf as visible hex values like:
    As you can see we have the pdf as hex string. During message mapping XI replaces some non-printable chars like '0x04' or '0x19' with '#'.
    My question is: how can we avoid those char replacement ?
    BTW: I grabbed a pdf with sender file adapter, routed through XI without any mapping and send it with ftp in binary mode. But the pdf contains more chars as the origional file and the pdf content is not visible when opening with a pdf reader like Acrobat. I guess the file adpter has problems with carriage return and linefeed chars. Some CR and LF are replaced inserted somehow.
    Best regards,
    Holger

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How to parse a string containing xml data

    Hi,
    Is it possible to parse a string containing xml data into a array list?
    my string contains xml data as <blood_group>
         <choice id ='1' value='A +ve'/>
         <choice id ='2' value='B +ve'/>
             <choice id ='3' value='O +ve'/>
    </blood_group>how can i get "value" into array list?

    There are lot of Java XML parsing API's available, e.g. JAXP, DOM4J, JXPath, etc.
    Of course you can also write it yourself. Look which methods the String API offers you, e.g. substring and *indexOf.                                                                                                                                                                                                                                                                                                                                                                                                               

  • Convert binary data (TIFF image) into XML - how ?

    Hi,
    I have the following requirement:
    1. A document is scanned and a TIFF image is saved in a directory
    2. The File adapter picks up the image file and sends into XI
    3. The binary data is converted into XML so a Web Service can be called (this web service will store the image in a database application)
    <b>The part I am struggling with is the convert of the incoming binary data into a XML format document which will allow the Web Service to be called.</b>
    Graphical mapping cannot be used therefore I am left with 3 options:
    1. XSLT mapping
    2. Java mapping
    3. ABAP mapping
    Can anyone suggest the best option to use in these circumstances and provide some sample snippet of code on how to do it.
    I am alright at XSLT mapping but this is beyond me and Java mapping is completely new to me as I have very limited Java knowledge.
    Thanks for your help
    Colin.

    Hi Colin
    Look for the below link
    https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
    <b>***Reward point if helpfull</b>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b</a>

  • Parsing the data from and xml type field

    Hi - I have registered a schema and inserted arecord into the table with the xml type column. Now I want to parse the data from the xmltype field into a relational table. I have been using the following select statement to accomplish this - and it does work if there is data in all the selected fields but when the filed is null then the whole select statement fails and brings back 'no rows returned'.If the value is null I want the select statment to return null. please give any ideas.
    SELECT version,frmd_transaction_date,extractValue(value(b), 'event_update/location')"location",
    extractValue(value(b), 'event_update/sending_system')"sending_system",
    extractValue(value(b), 'event_update/event_identifier')"event_identifier",
    extractValue(value(b), 'event_update/event_link')"event_link",
    extractValue(value(b), 'event_update/organization_code')"organization_code",
    nvl(extractValue(value(c), '/schedule/event_duration_minutes'),'000')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c

    ...then I guess you have to rewrite the query.
    Is schedule another xml sequence inside of event_update sequence ?
    If it is not you can try this :
    SELECT version,frmd_transaction_date,extractValue(value(b), '/event_update/location/text()')"location",
    extractValue(value(b), '/event_update/sending_system/text()')"sending_system",
    extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",
    extractValue(value(b), '/event_update/event_link/text()')"event_link",
    extractValue(value(b), '/event_update/organization_code/text()')"organization_code",
    extractValue(value(b), '/event_update/schedule/event_duration_minutes/text()')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b
    ...if yes, did you try nvl function (I don't think this would be a solution of a problem):
    SELECT version,frmd_transaction_date,nvl(extractValue(value(b), '/event_update/location/text()')"location", 'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/sending_system/text()')"sending_system",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_link/text()')"event_link",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/organization_code/text()')"organization_code",'NULL VALUE'),
    nvl(extractValue(value(c), '/schedule/event_duration_minutes/text()')"event_minutes",'NULL VALUE')
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c
    If none of this works post your xml schema.

  • Cannot parse data from xml

    I am trying to obtain strings from a xml file:
    I tried the following:
    var url:URLRequest = new URLRequest("blog.xml");
    var xml:XML;
    var rss:URLLoader = new URLLoader();
    rss.load(url);
    rss.addEventListener(Event.COMPLETE, readRss);
    function readRss(e:Event):void{
           xml = XML(rss.data);
           txt_field.text=xml.entry[1].author.name;
    but had no results. TypeError: Error #1010:...
    I tried tracing xml and that worked fine.
    The xml structure seems to be too complex
    var blogList:XMLList = xml.children(); //returns a more simple xml structure but still no success in parsing parts of the xml such as "title" or "author".
    Any suggestions would be greatly appreciated.
    Thanks

    Hi Kglad,
    thank you for helping me with this post and all the previous threads.
    for accessing entry[1].title, i tried:
    xml..ns::entry[0].title // but didn´t really work.
    I also tried to retrieve all the items under "entry" with:
       var ns:Namespace=xmlData.namespace();
       var MSGCounter:int = 1;
       for each (var item:XML in xmlData..ns)
        txt_field.appendText("Post "+MSGCounter++ +"\n")
        txt_field.appendText("------------------------------------------------------------------- -----\n");
        txt_field.appendText(item.entry.title.toString());
        txt_field.appendText("\n");
        txt_field.appendText("\n");
        txt_field.appendText(item.entry.content.toString());
        txt_field.appendText("\n ");
        txt_field.appendText("\n ");
        txt_field.appendText(item.entry.author.name.toString());
        txt_field.appendText("\n\n");
    but had no success.

  • Parsing out Binary Data

    I am trying to parse data files that contain ASCII characters and chunks of binary data. My program uses a BufferedReader and reads a data file line by line. I have no problems using tokens or substrings to get the ASCII characters, but when I reach the binary data I'm not sure how to capture it. All I need to do is get the binary data and stuff it into a database as is. Any help would be appreciated.

    You need to define how you are going to decide what is binary and what isn't.
    Binary data is just bytes. And half of the legal bytes have the same bit representation as ASCII. So you can't differentiate solely one whether it is representablable as ascii.

  • Binary data into a XML

    Hello,
    I'd like to know how I could insert binary data into a XML message, for example, an image.
    Does XML Java API support binary data insertion into a XML message? Or should I make my own classes to do this?
    As I've read in the next url http://www.javaworld.com/javaworld/javatips/jw-javatip117.html ,
    the best approach is to use a Base-64 encoding. The encoding algorithm processes a byte stream in 3-byte sequences. Each 3-byte sequence parcels into four 6-bit data units. Each 6-bit data unit then encodes into the character stream as the corresponding character from the character set: A-Z, a-z, 0-9, +, and /.
    Thanks

    Does XML Java API support binary data insertion into a
    XML message? Or should I make my own classes to do
    this?The XML Java API's support producing well-formed XML according to the XML specifications. Those specifications do not say (or even suggest) how you should encode binary data to put it into XML. If you want to encode your binary data in some way then you are free to do so, but you'll have to write your own code.

Maybe you are looking for

  • Why do ALL browser windows open when I open a new browser window

    I don't know if this is a feature, but I find it ANNOYING. Say I have 2 browser windows minimized. I decide to open another window. Why do ALL minimized browser windows and how can I stop it.

  • Weblogic Foreign Server issue

    Hi, We were trying to integrate Tibco EMS with WLS 10.3 (using Foreign JMS Server). We are using Spring as our app container (the one which basically creates/manages connections, sessions etc) I am able to listen to the topics both durably and non-du

  • DVD region change?

    Hi, I have a brand new powerbook g4, 1.67ghz, superdrive. I just recently put a DVD in it for the first time, and it asked "what region do you want to set the drive to?" It gave me the option of 1 and 4, I think. Anways, I chose 1, because I had no i

  • Adapter Factory Question

    Hi, Is it possible to populate a Child Process Form using Adapter Factory ? For example: - in the User Profile I have defined a UDF , GroupWise alias - when this field is updated, I would like to fire a trigger that will modify the UD_NGW_NICK child

  • Creating a Paragraph Format

    Hi All, Please let me know how to create a paragraph format in sap scripts. I tried to create a paragraph format, because there were some tab space issues with the old paragraph formats.for this at the header level I clicked on paragraph format and e