Save an Image object into a XML text document

ello:
I have a problem with saving an image. I need to encapsulate it into two XML tags:
<Image> xxxxxx </Image>
The "xxxx" must be a String that represents my Image object.
In J2ME I haven't serialization, and all the examples about "manual serialization" works with primitive types :(
I've already read that I can do .getRGB() over my Image object, and obtain an array of int, wich represent each pixel. Ok, I can transform the array into a String, and write it in my XML text document, but later: how I obtain my array from that String?
Thak you very much

private Image img;
byte rgb[] = null;
private rgbLength; // get lenth of your string
rgb = new byte(rgbLength);
rgb = ... //load data from string to this array
img = createRGBImage(rgb, int width, int height, false) ;You must know length of your string and must encapsulate in to XML width and height of this image;

Similar Messages

  • Convert  Objects into an XML Document? Possible?

    Hello,
    Is there a way to convert different objects into an XML File/Document
    If I create 10 objects and then I want to create an XML Document
    of these objects,is it possible to do this?
    Ajay

    Hello,
    Is there a way to convert different objects into an
    XML File/Document
    If I create 10 objects and then I want to create an
    XML Document
    of these objects,is it possible to do this?
    Ajayjust override the .toString() method...

  • I want to transform an object into a XML-String

    Hallo,
    in my BSP I want to transform an object into a xml string to set a server side cookie.
    Therefore my code is:
      DATA:
        lv_xml      TYPE string,
        lv_username TYPE string.
    model    ?= get_model( model_id = 'main' ).
      lv_username = sy-uname.
      Call TRANSFORMATION id SOURCE o = model  RESULT XML lv_xml.
      cl_bsp_server_side_cookie=>set_server_cookie(
            name                  = 'MODEL'
            application_name      = runtime->application_name
            application_namespace = runtime->application_namespace
            username              = lv_username
            session_id            = runtime->session_id
            data_value            = lv_xml
            data_name             = 'MODEL'
            expiry_time_rel       = 3600 ).
    But after the command "Call Transformation" the xml-string doesn't contain all the data of my object, only this:
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><O href="#o19"/></asx:values><asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <cls:ZCL_M_ESS_TRV_OVW id="o19"/
    ></asx:heap></asx:abap>
    What is wrong?
    Regards.
    Martin

    see thread nr.: Re: Call transformation with an object

  • Save a numbers spreadsheet as a simple text document?

    How do you save a numbers spreadsheet as a simple text document? I can't seem to find this option anywhere. Simply renaming the extension also seems to maintain rich text.

    An extension name is just a reminder helping us and the operating system to recognize which kind is the contents of a given file.
    Changing a trousers against a dress will not change Mr. Obama in Mrs. Clinton;-)
    Same thing for the files.
    At this time, Numbers doesn't offer the ability to export as a text file.
    Happily, our machines are delivered with TextEdit.
    Copy the block of cells of your choice to the clipboard
    Paste in an empty TextEdit document
    Format > Convert as text
    Save
    That's all folks.
    Of course, you may
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'09
    Yvan KOENIG (from FRANCE mardi 5 août 2008 18:07:34)

  • I can not save my PDF file into a Word file document...how do I do this?

    How do I convert/save my PDF file into a Word format document?

    Hi Thomas,
    Please check out our Getting Started Guide: http://forums.adobe.com/docs/DOC-2412
    If you have any questions, please let us know!
    -David

  • Insert large Image object into Database

    Hello
    I have a large (!MB) image which needs to be stored in a database BLOB column, and I'm running out of memory with my naive code..
    Nothing other than the code is within my control. I cannot change my heap size; I have no file-system, so cannot write the image.
    The awt.Image is created and drawn elsewhere in the application. My thought was to create a byte stream and have that inserted chunk-by-chunk, but I just can't find out how to do this in a limited time.
    Any help would be much appreciated.
    Lee

    leegee23 wrote:
    Thanks for your help. Have tried this:
    ImageInputStream is = ImageIO.createImageInputStream(gif);But got null. The docs read:
    Returns an ImageInputStream that will take its input from the given Object. The set of ImageInputStreamSpis registered with the IIORegistry class is queried and the first one that is able to take input from the supplied object is used to create the returned ImageInputStream. If no suitable ImageInputStreamSpi exists, null is returned.
    Am I barking up the wrong tree?I think you're on the right track. A quick browse found that an ImageWriter (GIFImageWriter) can be used to write an image to an output stream (use ImageIO.createImageOutputStream()), and then you can probably use PipedInputStream/PipedOutputStream to obtain an inputStream that you can pass to your JDBC driver to store the blob.
    That's just from reading Javadocs though, I'm not sure how to connect the dots.
    And also, make sure you post a reference to this thread on the new one you created. You wouldn't want people to waste time answering that thread if there's an answer here already, or vice versa.
    Edit: I was thinking specifically of using a GifImageWriter constructed with a OutputStreamImageOutputStreamSpi that was passed in a PipedOutputStream which you would in turn connect to a PipedInputStream which you would pass in to the JDBC method.
    But I'm not sure, it looks like even then it either uses a memory cache or a file cache. When you have compression, the writer will typically need to have access to all the bytes of the image before starting to write. It would be a two-pass algorithm, most likely. Which basically means you might have memory issues anyway.
    Edited by: endasil on 22-Sep-2009 1:12 PM

  • I am able to click on a picture in iPhoto to edit it opens automatically in photoshop cs6.  However when i am done editing I can not save that image back into iPhoto.  Can anyone help with a setting I am missing maybe?

    I am able to click on a pic in iphoto to edit it and opens automatically in photoshop CS6. However when I am done editing and save I can not save back into Iphoto.  Can any one help wiht this?

    Thanks Terence. What a relief. I still don't understand what the book I read was talking about then. Here's a quote from the section I was referring to in "iPhoto 08: The Missing Manual" book, p 91 (ISBN: 0596-516185):
    "Note, however, that the instant you edit a TIFF-format photo (Chapter 7), iPhoto converts it into JPEG.
    That's fine if you plan to order prints or a photo book (Chapter 11) from iPhoto, since JPEG files are required for those purposes. But if you took that once-in-a-lifetime, priceless shot as a TIFF file, don't do any editing in iPhoto-don't even rotate it- if you hope to maintain its perfect, pristine quality."
    After my test results, I thought maybe this was something that had changed from iPhoto 08 to iPhoto 09, so I went to the bookstore yesterday and checked the same book for iPhoto 09, and there it was, the same quote! (on a different page, of course).
    Anyway, thanks once again for your confirmation that my test was indeed correct. Linda

  • Loading an image in an XML text file

    I've gotten the DateChooser component to work very well
    loading dynamic text fields with data from an external XML file.
    Can I embed a jpeg into the XML text like I would with the
    <img> tag in an HTML text file?
    Many thanks in advance for any tips...
    George

    I assume your XML looks something like this...
    <event date='11/11/1111'>
    <PerformerName>SomeInfoHere</PerformerName>
    </event>
    You could add the image info anywhere you want in the XML.
    Perhaps an attribute of the PerformerName tag?
    <PerformerName
    image='myImage.jpg'>SomeInfoHere</PerformerName>
    or
    <PerformerName image='
    http://www.myDomain.com/images/myImage.jpg'>SomeInfoHere</PerformerName>
    When you parse the XML data and build your Array, then you
    just need to capture the additional tag attribute. Similar to how
    you got the date attribute.
    Then at that point you would add it into the textField of
    your info_txt.
    Read this page in the docs to see how to add the image.
    http://livedocs.adobe.com/flash/8/main/00001464.html

  • Converting EJB Object into XML

    All:
    Suppose I have an EJB that is named MyDog, it has attributes as follows:
    name
    breed
    weight
    age
    Is there a way to convert this Object into an XML document? Something like:
    <?xml version=\"1.0\" ?>
    <MyDog>
    <name>Bubba</name>
    <breed>Australian Shepherd</breed>
    <weight>65 lbs</weight>
    <age>6 years old</age>
    </MyDog>
    I can't find any information on doing this - any ideas, links, etc? There has to be a way to do this, but I can't find it. I'm welcome to any ideas out there!

    check JAXB - might be usefull for you: http://java.sun.com/xml/jaxb/index.html

  • I need to add the values stored in the session object into the html textbox

    Dear Sir,
    i have been trying to create an edit employee details page
    What i have done till now is as follow:
    1. Got employee id from HTML page.
    2. Compared it with the id stored in the database.
    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.
    4. Dispatched the session values to another servlet EditEmpDetails2.java
    what i need to do now
    5. Now i need to set the session values in the text field of the html form
    6. I also need to be able to edit those vales and store the edited values in the database.
    Please help me as i have tried doing it for 1 week without any clues
    i have tried to create a html page which is something like this:
    <html>
    <head>
    <title>Edit Employee Details Page</title>
    <body BGCOLOR="red" text="black">
    <h1 ><font color="black">Edit Employee Details Page</font></h1>
    <form action = "EditEmpDetails" method="Get">
    <table width="50% align="center"
    <tr><td>Employee ID: </td>
    <td><INPUT TYPE="TEXT" name="employeeid"<br></td></tr>
    <tr><td><center><input type="submit" value="submit"></center></td></tr>
    <tr><td><center><input type="reset" value="reset" ></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    design of my servlet EditEmpDetails.java
    public void EditEmpDetails1 extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    HttpSession session = request.getSession();
    String employeeid;
    String X = request.getParameter("employeeid");
    System.out.println("Employee iD:" + X);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:murphy");
    String query = "Select * from users where employeeid=?";
    PreparedStatement stat = con.prepareStatement(query);
    System.out.println(stat);
    stat.setString(1,X);
    ResultSet rs = stat.executeQuery();
    while(rs.next())
    String Z = rs.getString(password);
    if(Z.equals(X))
    String A = rs.getString(1);
    session.setAttribute("employeeid", A);
    String B = rs.getString(2);
    session.setAttribute("firstname", B);
    String C = rs.getString(3);
    session.setAttribute("lastname", C);
    String D = rs.getString(4);
    session.setAttribute("gender", D);
    String E = rs.getString(5);
    session.setAttribute("dateofbirth", E);
    String F = rs.getString(6);
    session.setAttribute("address", F);
    String G = rs.getString(7);
    session.setAttribute("postalcode", G);
    String H = rs.getString(8);
    session.setAttribute("phone", H);
    String I = rs.getString(9);
    session.setAttribute("mobile", I);
    String J = rs.getString(10);
    String url = "/EditEmpDetao;s.java";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url)
    dispatcher.forward(request,response);
    catch (Exception e)
    system.out.println(e)
    I do not know how to put the values stored in the session object into the html text box

    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.do you really need to store this in session object?
    5. Now i need to set the session values in the text field of the html form which form? in a new html/jsp page? i suggest go for a JSP
    In your JSP page use JSP expression tags to put the session attributes.
    it's something like : <input type='text' name='employeeid' value='<%= session.getAttribute("employeeid") %>' >and you need to generateanother servlet for saving the details/modifications to the database.
    I think i m clear enough.
    if you need more clarifications. just try it and then post your problem.
    Diablo

  • How do i convert an image object to a byte array ?

    Hi
    how do i convert an image object into a byte array
    early reply apperciated

    Oh sorry my method and the other method need to have the pixels from the Image passed to them which you get my using pixelgrabber:
    //create width and height variables from image
              int w = img.getWidth(this);
              int h = img.getHeight(this);
              //retrive picture from image
              int[] pix = new int[w * h];
              PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pix, 0, w);
              try{ pg.grabPixels();
              } catch (InterruptedException ioe) {
                   System.err.println("Interrupted");
              if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
              System.err.println("image fetch aborted or errored");
              }

  • App for editing/reading/writing Excel, Word, Windows notepad text documents

    I was wondering if any of you's could recommend some apps (from experience) that would allow me to, edit/read/write Excel, Word, Windows notepad text documents.
    I could make do with an app that would do the above but without the ability to create, edit Windows notepad text documents. But been able to read, write, edit Word and Excel documents would have to be a must.
    Thanks in advance.

    Thanks everyone for the help it was much appreciated.
    After debating, I decided on Docs To Go at £9.99. For this amount its a universal app and as such I can have it installed on my iPhone as well as my iPad (which is what I have done), so £5 for to have it on each device is good value I feel. Quick Office on the other hand would have cost £8.99 for the iPad version and £5.99 for the iPhone version a total of almost £15, which is quite a bit more than I paid for Docs To Go.
    Upto now, I find Docs To Go does everything I want from it, with regards to editing, reading, writing my Excel files. I tried transferring a Microsoft Windows Notepad text document over to the iPad/iPhone, I was able to read this and also add additional text/words to it and save it too. I do use text documents sometimes because if I want to add them onto a friend's computer for example, I know that they will be able to read them because with them having a Windows PC and also my friend does not have the Microsoft Office program on their PC.
    The transferring of files from the computer to the iPhone/iPad is done via a free download of the Docs To Go desktop software program (which is both PC and Mac) compatible). You first need to go into the Docs To Go app and select 'ADD DESKTOP'. This then allows you to add a device to the Docs To Go desktop program thus enabling transfer. You are shown a pin number on the screen which you enter into the Docs To Go app, this procedure only needs to be done once.
    The Docs To Go desktop program creates a folder during installation, where all the files etc are stored that are transferred/going to be transferred over are kept.
    Some people might think needing to use a program to transfer files over is a bit of a nuisance, when other similar programs allow transfer via a web browser. Personally I find that those programs, the transfer is a bit cumbersome and can be a bit slow. I find the transfer via the Docs To Go desktop program is a lot easier and faster than using the web browser. The only downside I can see with needing to use the Docs To Go desktop program is that.. If I am at a friend's house and want to transfer something on to my iPhone/iPad. My friend would need to install the program, but saying that, its a very small program and its not a big deal having to install it. If they didn't want to install it, then there is either emailing the file or transferring the file to my Dropbox account. I forgot to mention that Docs To Go supports cloud/online storage such as Dropbox, GoogleDocs as well as others.
    Once the above is done, you switch the wifi on, load the Docs To Go app, load the Docs To Go desktop program. You then just drag and drop the folders etc that you are wanting transferred over into the The Docs To Go desktop program, then you click on the circular arrow button and they are then transferred over onto the iPhone/iPad.
    Once on the iPhone/iPad, you can view them, add additional information, when you make any changes you can press the circular arrow symbol (bottom left of the Docs To Go app) on the Docs To Go app and the changes are then synced back to the same file that is stored on the computer, so its very easy to keep everything in sync and up to date.
    It is possible whilst using a Microsoft Word document to have a word count, you just touch the symbol at the bottom right of the Docs To Go app and choose Word Count from the drop down menu. I have heard a few people in some reviews saying that 'Docs To Go doesn't have a word count', when indeed it does.
    One surprise is that Docs To Go, does not have a spell checker, but hopefully during later updates, the feature might be added. I sent my feedback to Docs To Go requesting this feature on future releases. I expect that there will be many other people who have requested this feature too.
    I just thought I would share my experience with using Docs To Go.
    Thanks again everyone for the help, it was much appreciated

  • Can you embed object into text in Indesign?

    I am about to do a large project in Indesign that will involve a lot of charts and text. I used to work in Quark and I could embed objects into the text so that the object and text flowed together (instead of the object sitting on top of the text). Can anyone tell me if this is possible in Indesign?

    Cathy,
    You're using the word "embed" in a way that is confusing.
    An embedded object in InDesign is one where the link to the outside photoshop or other graphic file format has been cut and the entire file information is contained within the InDesign file.
    This has nothing to do with having images move along with the text.
    InDesign has two types of images that move along with the text.
    b Anchored objects
    are the easier ones to create but they have less controls.
    b Inline graphics
    are the more complex.
    Look these up in the Help files.
    Or get yourself a good book on InDesign.

  • How scan a text document and save as editable text not image

    I have a new ENVY 5660 and a macbook pro running yosemite.  When I scan a text document and try to save it, I am only given a choice of image formats.  How can I save it as an editable text in pages or word?

    Hi , Welcome to the HP Forums! I see that you are wondering how to scan a text document, and save as editable text, and not a image, with your HP Envy 5660, on Mac OS X 10.10. I am happy to look into this for you!  According to your printer's specifications, it states: NOTE: Integrated OCR software is available only with Officejet 5740 and 8040 models. Which means, this software is not included with this printer. You might be able to perform this operation, if you are able to get third-party OCR software. Such as: ReadIris.  Hope this answers your question!  “Please click the Thumbs up icon below to thank me for responding.”

  • Saving business objects into xml file

    I have the following XML file parsed into a DOM tree, with 2 different types of nodes "TestCase" and
    "RealCase". Then I mapped each type to a different type of business object, TestCaseObj and RealCaseObj.
    Now, there may be addition of new objects, or modifications to the data stored in the business objects
    by my application. Eventually when I save the business objects back into the XML file, how should I go
    about doing that?
    <ROOT>
    <TestCase TestID="T1">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
    </TestCase>
    <TestCase TestID="T2">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
    </TestCase>
    <RealCase ID="R1">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
         <Element3>Data3</Element3>
    </RealCase>
    <RealCase ID="R2">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
         <Element3>Data3</Element3>
    </RealCase>
    </ROOT>

    The DocumentBuilder class does not allow you to parse a portion of the xmlfile. Therefore, it will not be possible to read "TestCase" into the DOM without bringing in "RealCase" nodes as well. As such, these codes will parse the entire xml file into DOM:
    DocumentBuilder builder = builderFactory.newDocumentBuilder();
    Document document = builder.parse( xmlFile );
    However, your problem can be solved by reading only "TestCase" nodes in DOM, as follows:
    NodeList elementNodeList =
    elementNode.getElementsByTagName("TestCase");
    Your codes will then change the data in the elementNodeList, without affecting "RealCase" although it is loaded into DOM. You can be sure that elementNodeList contains only "TestCase" nodes.
    Once you have made your changes, save the DOM back to the XML file, using the serializer method as discussed earlier.
    Good luck.

Maybe you are looking for

  • Aq_tm_processes parameter in Oracle 10.2.0.4.0-10.2.0..5.0

    Hi all, Just a question regarding aq_tm_processes. As per OWB Installation guide, this parameter should be one. But also in metalink there is a recommendation to leave it unset in database version up to 10.2. There is a script to check if this parame

  • Why aren't recipients receiving the whole of my email?

    It has come to my attention that some recipients of emails are not receiving the entire message. On two recent occaisions I received replies asking for information I knew I'd already sent. Scrolling down showed that they'd only received a part of my

  • [UNSOLVED] qt4-gnome-globalmenu-git

    I am trying to compile a plugin that should make gnome-globalmenu work with qt apps. It should be fairly simple, the source tree only holds 3 files. I am however, sadly so incompetent that I can't work out what to do with my own improvised PKGBUILD t

  • IPad WiFi signal

    Why would my iPad have a weak or even no signal? I updated the router, we removed the leather cover.

  • Is isight compatibile with windows xp

    Got windows xp on my laptop can i use the isight onit or do i need new drivers and sofware