How to get a string of an HTML element

Imagine a normal web page with its tags. I have to get the
value of a precise element and convert it to a String in order to
show it in a TextField. Specifically, I have to take a precise cell
of a table and insert it in a string.
Does AIR help me with some method that catches specific
elements of a HTML code or have I to parse the string of the entire
HTML and try to reach the wanted value?
In this last case, how do I convert the entire HTML of a page
into a string?
Any other ideas are welcome.
Thanks.

quote:
Originally posted by:
Marco Sgna
Does AIR help me...
No, but I don't see that it has to. I presume
you're writing an AIR app with HTML and JavaScript. If so, you can
query and modify the HTML's DOM tree with JavaScript. Then, still
using JavaScript, you pass it off to the AIR side, using the "AIR
aliases" APIs. So:
<table><tr><td
id="foo">bar</td></tr></table>
<script>var mycontent =
document.getElementById('foo').innerHTML; // variable equals "bar"
now</script>
quote:
how do I convert the entire HTML of a page into a string?
document.toString(), perhaps.

Similar Messages

  • How to get a string "yyyyMMdd" into date like MM/dd/yyyy?.

    Hi
    How to get a string "yyyyMMdd" into date like MM/dd/yyyy?. i have used
    SimpleDateFormat.parse but it is giving long value. i want to disply the date
    like MM/dd/yyyy
    thank you

    Do you want the string rearranged or do you want to create an instance of some form of Date class?
    If you want to rearrange the string you could just do it yourself provided you know the date string is going to be of the format yyyyMMdd.
    something like this:
    String newDate = origStr.charAt(4) + origStr.charAt(5) + "/" + origStr.charAt(6) + origStr.charAt(7) + "/" ...etc.

  • How to get alternative strings in list of strings.

    Hi experts,
    how to get alternative strings in list of strings.
    eg
    'country1, italy, country2, india, country3, paris, country4, scottland, country5, rome'
    from the above list i need to fetch all the countries and their names separately.
    like country1, country2, country3, country4, country5
    italy, india, paris, scottland, rome
    i am trying the above one in the below fashion
    SELECT SUBSTR
              ('country1, italy, country2, india, country3, paris, country4, scottland, country5, rome',
               1,
                 INSTR
                    ('country1, italy, country2, india, country3, paris, country4, scottland, country5, rome',
                     1,
                     1
               - 1
      FROM DUAL
    can you please any one help me

    If you want the data to be more stuctured, and useful:
    col col_name for a20
    col col_value for a20
    var inlist VARCHAR2(2000)
    exec :inlist := 'country1, italy, country2, india, country3, paris, country4, scottland, country5, rome';
    exec :inlist := replace(:inlist,' ')
    select max(decode(mod(lvl,2),1,value)) col_name
          ,max(decode(mod(lvl,2),0,value)) col_value
    from   (select substr(:InList,start_pos+1, end_pos-start_pos-1) value
                  ,lvl
            from   (select :InList
                          ,case when level = 1 then
                             0
                           else
                             instr(:InList,',',1,level-1)
                           end start_pos
                           ,case when instr(:InList,',',1,level) = 0
                             then length(:InList)+1
                           else
                             instr(:InList,',',1,level)
                           end   end_pos
                         ,level lvl
                    from   dual
                    connect by level <=length(:InList)-length(replace(:InList,','))+1
    group by ceil(lvl/2)
    order by 1;
    COL_NAME             COL_VALUE
    country1             italy
    country2             india
    country3             paris
    country4             scottland
    country5             rome
    Untested on 10g
    Then you could stragg the rows together ...

  • How to get the name of a Data Element of a generic Table!

    Hi guys!
    In my function i have the following import paramenter
    i_outtab type standard table
    now i import a table and i want to get the dataelement of the fields.
    is there a way to do this??

    Hello Thomas
    Perhaps the following sample report may be useful for you.
    *& Report  ZUS_SDN_RTTI_STRUCT_COMPONENTS
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145711"></a>
    *& Thread: How to get the name of a Data Element of a generic Table!
    REPORT  zus_sdn_rtti_struct_components.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES: bukrs    TYPE bukrs.
    TYPES: kunnr    TYPE kunnr.
    TYPES: END OF ty_s_outtab.
    DATA: gdo_data    TYPE REF TO data.
    DATA: gs_outtab   TYPE ty_s_outtab.
    DATA: go_typedescr  TYPE REF TO cl_abap_typedescr,
          go_structdescr  TYPE REF TO cl_abap_structdescr,
          go_datadescr    type ref to cl_abap_datadescr.
    DATA: gs_comp        TYPE abap_compdescr,
          gd_dtel        type string,
          gt_dfies        type ddfields.
    FIELD-SYMBOLS:
      <gs_struct> TYPE ANY.
    START-OF-SELECTION.
      BREAK-POINT.
      GET REFERENCE OF gs_outtab INTO gdo_data.
      ASSIGN gdo_data->* TO <gs_struct>.
      go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struct> ).
      go_structdescr ?= go_typedescr.
      BREAK-POINT.
      LOOP AT go_structdescr->components INTO gs_comp.
        go_datadescr = GO_STRUCTDESCR->GET_COMPONENT_TYPE( gs_comp-name ).
        gd_dtel = go_datadescr->get_relative_name( ).
        write: / syst-tabix, 'Data element =', gd_dtel.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to get the focus of particular UI Element

    Hi All,
    How to get the focus of particular UI Element in webdynpro Page,
    I have a page where i am creating a ALV, I want to get that keyboard focus is on that element is there or not?
    Can anyone please give some update?
    Best regards,
    Rohit

    I would suggest try invoking REFRESH of ALV on the ON_CELL_ACTION event.
    Below excerpt is from Thomas
    The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
    ON_DATA_CHECK:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
    This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
    You could also consider ON_CELL_ACTION:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
    It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
    if you want to capture & refresh on some hot key combination then refer to this thread
    [https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3760417]

  • How to get 64 bit version for premiere elements 12

    How to get  64-bit version for Premier Elements 12 ? 
    I download from ADMISY site.
    Click on win 64 bit and download it.
    When I try to install ther is a error  this download version is not for 64 bit I have try many times but same result

    Hello
    I have been away some days
    ADMISY is a software partners for Adobe
    I running Win 7 Home Edition
    I have received a card with a code when I bought the program and the I
    download from ADMISY
    Sending serial and installation warning
    PhotoshopElements_12_WWEFDJ.7z
    PhotoshopElements_12_WWEFDJ
    PremiereElements_12_WWEFDJ_win32.7z
    PremiereElements_12_WWEFDJ_win32
    I can not find a 64 bit version of 32-bit or 64-bit version of downloads
    This is information I have
    Best regards
    Erling Magnusson
    2015-02-04 22:33 GMT+01:00 Adobe Forums <[email protected]>:
        How to get 64 bit version for premiere elements 12  created by A.T.
    Romano <https://forums.adobe.com/people/A.T.+Romano> in *Premiere
    Elements* - View the full discussion
    <https://forums.adobe.com/message/7162950#7162950>

  • JSP/Struts How to get a String to display as HTML?

    <logic:present name="ShowAnswers">
      <logic:iterate id="ShowAnswers" name="ShowAnswers">
       <br>
       <html:textarea name="ShowAnswers" property="anAnswer"> </html:textarea>
    </logic:iterate>I've got a Vector of Strings that are being written to a .jsp using <logic:iterate> as shown above. The String anAnswer contains HTML code.
    Is there a way to get it written using the above framework as HTML rather than text ?
    I've tried <bean:write name="ShowAnswers" property="anAnswer"/> which also just writes out the raw HTML rather than the formatted HTML.

    try using the "filter" attribute of bean:write.
    <bean:write name="ShowAnswers" property="anAnswer" filter="false"/>
    For clarity you should use different names for your loop variable and your actual list. I know that it currently works, but thats only because they are in two different scopes.
    Also standard coding conventions specify that variable names should always start with a lower case letter.
    <logic:present name="ShowAnswers">
      <logic:iterate id="anAnswer" name="ShowAnswers">
       <br>
        <bean:write name="anAnswer" property="anAnswer" filter="false"/>
    </logic:iterate>

  • How to get a string or byte array representation of an Image/BufferedImage?

    I have a java.awt.Image object that I want to transfer to a server application (.NET) through a http post request.
    To do that I would like to encode the Image to jpeg format and convert it to a string or byte array to be able to send it in a way that the receiver application (.NET) could handle. So, I've tried to do like this.
    private void send(Image image) {
        int width = image.getWidth(null);
        int height = image.getHeight(null);
        try {
            BufferedImage buffImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            ImageIcon imageIcon = new ImageIcon(image);
            ImageObserver observer = imageIcon.getImageObserver();
            buffImage.getGraphics().setColor(new Color(255, 255, 255));
            buffImage.getGraphics().fillRect(0, 0, width, height);
            buffImage.getGraphics().drawImage(imageIcon.getImage(), 0, 0, observer);
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(stream);
            jpeg.encode(buffImage);
            URL url = new URL(/* my url... */);
            URLConnection connection = url.openConnection();
            String boundary = "--------" + Long.toHexString(System.currentTimeMillis());
            connection.setRequestProperty("method", "POST");
            connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
            String output = "--" + boundary + "\r\n"
                          + "Content-Disposition: form-data; name=\"myImage\"; filename=\"myFilename.jpg\"\r\n"
                          + "Content-Type: image/jpeg\r\n"
                          + "Content-Transfer-Encoding: base64\r\n\r\n"
                          + new String(stream.toByteArray())
                          + "\r\n--" + boundary + "--\r\n";
            connection.setDoOutput(true);
            connection.getOutputStream().write(output.getBytes());
            connection.connect();
        } catch {
    }This code works, but the image I get when I save it from the receiver application is distorted. The width and height is correct, but the content and colors are really weird. I tried to set different image types (first line inside the try-block), and this gave me different distorsions, but no image type gave me the correct image.
    Maybe I should say that I can display the original Image object on screen correctly.
    I also realized that the Image object is an instance of BufferedImage, so I thought I could skip the first six lines inside the try-block, but that doesn't help. This way I don't have to set the image type in the constructor, but the result still is color distorted.
    Any ideas on how to get from an Image/BufferedImage to a string or byte array representation of the image in jpeg format?

    Here you go:
      private static void send(BufferedImage image) throws Exception
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        ImageIO.write(image, "jpeg", byteArrayOutputStream);
        byte[] imageByteArray = byteArrayOutputStream.toByteArray();
        URL url = new URL("http://<host>:<port>");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoOutput(true);
        connection.setRequestMethod("POST");
        OutputStream outputStream = connection.getOutputStream();
        outputStream.write(imageByteArray, 0, imageByteArray.length);
        outputStream.close();
        connection.connect();
        // alternative to connect is to get & close the input stream
        // connection.getInputStream().close();
      }

  • JSP: how to display a String that has HTML

    I'm reading contents of a file and want to display them on the JSP page. However, the contents may have HTML tags in them as well. Right now it just displays the String HTML tags, not actually rendering them. How do I display the String so the HTML tags are actually used?
    So if the String has "<b>Hello</b>"
    I want it to show up in the webpage with the word Hello bolded, not the actual <b> and </b> tags displayed.

    Something is escaping the file contents. Perhaps if you dropped a few
    hints about how you are actually doing this.

  • How to get the string's byte length?

    I have some string,I want to get the string's byte length,how
    can do it?
    for example:
    <cfoutput>#len('hihi,这是测试')#</cfoutput>
    output is 9
    I want to get the byte length is 14, how can i get it?
    Thanks.

    >> Fair cop. I didn't realise that asc() returned the
    codepoint rather than the
    > actual character code.
    >
    > and what would be the difference?
    Oh, sorry, whatever the term is (I'm crap with jargon). The
    value returned
    by asc() for those chars was only two bytes (ie: four hex
    digits). I
    didn't realise there was more to it than that, and that
    2-byte value maps
    to some other THREE byte value. I need to do some reading...
    > that's what both cf & java counted as the length.
    CHARACTER length, sure. No-one's disputing that. On the other
    hand,
    no-one's asking about it, either.
    > by adding a BOM you've already effected the encoding,
    which may or may not
    > match the original. so you still don't know how many
    bytes were in the original
    > string.
    [groan]
    Yes, that's a reasonable strawman there. I was only putting
    it in a file
    so I could save it and check the number of bytes occupied by
    the data.
    Clearly... CLEARLY... the OP is not asking for a character
    length of that
    string. They've said as much.
    I copy and pasted the string from their post, and used it as
    a
    demonstration of how "nine" is not the right answer for the
    BYTE LENGTH of
    that string. Whether or not the original string was UTF-8,
    UTF-16 or
    special-marmoset-encoding, it almost certainly was NOT in a
    fictitious kind
    encoding in which each of those particular characters only
    occupied one
    byte each, which would mean that "nine" is the correct answer
    to the
    question.
    When I copied those characters from either the web browser
    for from my
    text-based news agent, notepad identified them (and rendered
    them
    correctly) as UTF-8, so I'm fairly confident they ARE UTF-8.
    Of course
    this could be down to some intermediary encoding (pasting
    them in to the
    original posting, for example, via some encoding-transforming
    mechanism),
    but Occam's Razor suggests the original question was from a
    UTF-8 POV.
    But maybe we should quit speculating and ask the OP. Unless
    they've
    buggered off in despair of how drawn out all this is getting.
    For which I
    would not blame them.
    Adam

  • How to get the size of JSP html output?

    Hi,
    Is there a JSP method to get the size of JSP HTML output.
    e.g. I would like to print the size of the JSP e.g.
    Size of this page is <%=pageContext.getPageSize()%> Kb ???
    Any ideas? Thanks.
    George
    Edited by: googchro on Jan 5, 2010 4:45 PM

    Would you like to print "the size of this page is..." before or after you calculate the size of the page.
    Because adding that bit of text to the page will make the page bigger...
    Doing it in java, the best approach would probably to have a filter counting the number of bytes that gets sent to the writer/output stream.
    A client side tool measuring the amount of bytes received would probably be easier though.
    You can always look at the Content-length header sent with a response. Though you normally don't have access to that on the java/jsp side, as it is sent by the container.
    cheers,
    evnafets

  • How to get Chinese string in the database?

    Hi,
       My dear friends.
       I successfully connect the database, the data in the table as shown below
      When I try to get "小明", but the following results were obtained
    Does anyone know why, and how to get the correct result?
    Thank you.

    You need to be aware of character conversions. Look at WideString, it support UTF32 chars.

  • How to get a value from the previous element (XSLT/XPATH gurus ahoy!)

    Hi All,
    I am building an RTF template for a "letter of reference"-report. Sometimes there are several rows in the data, that need to be printed as one. This is due to consecutive temporary contracts, which will be printed out as one period of service.
    Here's a simplified data example to illustrate the problem.
    <ROW>
    <START_DATE>01-01-1980</START_DATE>
    <END_DATE>01-01-1988</END_DATE>
    </ROW>
    <ROW>
    <START_DATE>01-01-1988</START_DATE>
    <END_DATE>01-01-1990</END_DATE>
    </ROW>
    <ROW>
    <START_DATE>01-01-2000</START_DATE>
    <END_DATE>01-01-2005</END_DATE>
    </ROW>
    With the data above, I should print two lines:
    01-01-1980 - 01-01-1990
    01-01-2000 - 01-01-2005
    I need to compare START_DATE of an element (except for the first one) with the END_DATE of the previous element, to find out whether to print the END_DATE for that element or not. How can I get that value from the previous element?
    Thanks & Regards, Matilda

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • How to get the source code of UI elements ?

    What is the way to get the source code of the elements used in qUnit Page for sap.m.List and all sap.m List Items ? I am looking to implement the same in my applications ?

    Hi Micheal,
    You can see the source code here for controls in sap.m.
    sap.m Explored
    Also for the link you provided, You can right click on the page and click on the View Page Source will show you the source code.
    Regards,
    KK

  • How to get the values from a html form embedded in a swing container

    Hi all,
    I am developing an application in which i have to read a html file and display it in a swing container.That task i made it with the help of a tool.But now i want to get the values from that page.ie when the submit button is clicked all the values of that form should be retrived by a servlet/standalone application.I don't know how to proceed further.Any help in this regard will be very greatful
    Thanks in advance,
    Prakash

    By parsing the HTML.

Maybe you are looking for

  • How to take out put of each documents

    dear all, i want to know the detail configuration and settings in sd for out put. such as i need to take the print of sales order or invoices so what type of settings i have to do how one can take a print out after creation of a sales order,quotation

  • Java3D: 2D co-ords to 3D co-ords

    Hi I'm new to Java3D and am writing a program where it displays a cylinder at specified points. I have also implemented MouseListener for mouse control. The problem is the MouseListener is on different co-ordinates from what the Canvas3D is using, To

  • Difficulty opening a pdf file

    Why can I not open a simple pdf file? It used to open with no problem. Not it is "garble".

  • How do i download onto drive f. drive c memory if full

    I have no memory left on my hard drive (c). error says no disk space. I am now trying to download on the USB external in drive (F). everything i try to download keeps going to C. how do i download onto the USB, drive f.

  • Can I recover a lost Pages document on my iMac?

    I lost a document that was never saved. Is there any way to get it back? I'm using my iMac (Mac OS X Version 10.6.8) and Pages (Version 4.1 (923))