Read Text from HTML-Pages and want to solve "ChangedCharSetException"

Hello,
I have an app that connect via threads with pages and parse them an gives me only the Text-version of a HTML-page. Works fine, but if it found a page, where the text is within images, than the whole app stopps and gave me the message:
javax.swing.text.ChangedCharSetException
        at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(DocumentParser.java:169)
        at javax.swing.text.html.parser.Parser.startTag(Parser.java:372)
        at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1846)
        at javax.swing.text.html.parser.Parser.parseContent(Parser.java:1881)
        at javax.swing.text.html.parser.Parser.parse(Parser.java:2047)
        at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:106)
        at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:78)
        at aufruf.main(aufruf.java:33)So I tried to catch them with "getCharSetSpec()" and "keyEqualsCharSet( )" from the class "javax.swing.text.ChangedCharSetException" and hoped that this solved the problem. But still doesen't work...
Then I looked at the web and found, that I have to add the line:
doc.putProperty("IgnoreCharsetDirective", new Boolean(true));"doc." is a new HTML Dokument, created with the HTMLEditorKit. I do not have much knowledge about that and so I hope, that someone can explain me, how I can solve that problem, within my code.
Here we go:
import javax.swing.text.*;
import java.lang.*;
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
public class myParser extends Thread
        private String name;
        public void run()
                try
                        URL viele = new URL(name);                       // "name" ia a variable with a lot of links
                URLConnection hs = viele.openConnection();
                hs.connect();
                if (hs.getContentType().startsWith("text/html"))
                        InputStream is = hs.getInputStream();
                        InputStreamReader isr = new InputStreamReader(is);
                        BufferedReader br = new BufferedReader(isr);
                        Lesen los = new Lesen();
                        ParserDelegator parser = new ParserDelegator();
                        parser.parse(br,los, false);
        catch (MalformedURLException e)
                System.err.print("Doesn't work");
        catch (ChangedCharSetException e)
                e.getCharSetSpec();
                e.keyEqualsCharSet();
                e.printStackTrace();
        catch (Exception o)
        public void vowi(String n)
                name = n;
}and for the case that it is important here is the class "Lesen"
import java.net.*;
import java.io.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
class Lesen extends HTMLEditorKit.ParserCallback
        public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
                try
                        if ((t==HTML.Tag.P) || (t==HTML.Tag.H1) || (t==HTML.Tag.H2) || (t==HTML.Tag.H3) || (t==HTML.Tag.H4) || (t==HTML.Tag.H5) || (t==HTML.Tag.H6))
                                System.out.println();
                catch (Exception q)
                        System.out.println(q.getMessage());
        public void handleSimpleTag(HTML.Tag t,MutableAttributeSet a, int pos)
                try
                        if (t==HTML.Tag.BR)
                                System.out.println(); // Neue Zeile
                                System.out.println();
                catch (Exception qw)
                        System.out.println(qw.getMessage());
        public void handleText(char[] data, int pos)
                try
                        System.out.print(data);                                           // prints the text from HTML-pages
                catch (Exception ab)
                        System.out.println(ab.getMessage());
}Thanks a lot for helping...
Stephan

parser.parse(br,los, false);
parser.parse(br,los, true);

Similar Messages

  • I have been unable to print from FF to Brother HL-1440. print generate pages w/odd bits of text from the page, and sometimes one image. If I want to print off the web, I have to print PDF. Older versions of FF print fine.

    I have been unable to print from FF to Brother HL-1440. print generate pages w/odd bits of text from the page, and sometimes one image. If I want to print off the web, I have to print PDF. Older versions of FF print fine.

    I downloaded OpenOffice and am able to print documents (in particular, the same document I created in MS Word). I guess MS Word is to blame. I believe the issue is concluded, but I'd welcome any comments about the Active Directory, as I might have a problem
    with OpenOffice in the future regarding that.

  • How do I read text from specific rows and columns in a tree structure?

    How do I read text from specific rows and columns in a tree structure? In a table you can specify the cell to read from but I have not been able to figure out how to do this with a tree structure.

    You need to set two properties to activate the correct cell and then you can read it's string property.
    The positioning properties are the "ActiveItemTag" and
    "ActiveColNum" properties. With them you select the tree item by it's tag and the active column. The string can then be read from the "Cell String" property.
    MTO

  • Acquiring HTML Text From HTML Page

    Just wanting to make a simple html editor. I read the documentation, and yes I know that not all pages form to the specifiecations, but I just want to know how to get all that yummie HTML into text rather than serving up a webpage. I am using the JEditorPane, and I think this answer may lay in the javax.swing.text.*; packages.

    Just trying to make a code editor by allowing the loading of an html page as a text file. Assuming you have the HTML source and now you wish to get the plain text from the HTML source,the following piece of code can help you:
    private String getPlainText(String htmlText)
    String str=null;
    JTextPane text=new JTextPane();
    text.setContentType("text/html");
    text.setText(htmlText);
    try{
      str=text.getDocument().getText(0,text.getDocument().getLength());
    }catch(BadLocationException){e.printStackTrace();}
    return str;
    }

  • IPad won't copy text from web page and paste in email

    I'm trying to copy text from a web page, and when I paste it in Note or in a new email, it copied the web page link, not the text. Doing this in iPad.  What am I doing wrong? Thanks

    I think it depends on what you are trying to copy.
    To copy, put your finger on the text and hold until the copy thing shows up.  Adjust the size to whatnyou want, then touch copy.( I know, you already knew that).  To paste, touch the screen where you want it to go until the paste thing shows up.
    I just did it
    glass, metal and minimalist design. Two.    ( pasted from a web page)
    Some pages are set up so that you cannot copy words or images.
    So try a different page to see if you are doing it right.   
    If you want, post the link to the page and we call all try it as well.

  • How to retrive the font color, style and size of the copied text from html

    I have requirement, where I need to retrive font size and style of the copied text from html page. Here copied text I mean, the text we select and copy using either windows copy command or using Ctrl+C.
    Please help me to get the solution for this req.
    Thanks in advance,
    Amodnk.

    You can also try this, especially if you've got the Text Inspector and the Color Picker open already.
    Select the text to be colored (note that if the text is already multiple different colors the swatch under Color & Alignment section of the Text Inspector still only shows one out of the several)
    Find the color you want in the Color Picker
    Click and drag from the Color Picker into the swatch under Color & Alignment in the Text Inspector
    That will also change all the selected text to the chosen color.
    Also, regarding web safe colors, that SHOULD come as a part of the Color Picker. With the Color Picker open, select the third icon at the top (If you mouse over it, it should indicate Color Palettes. Click the popup menu button and you should see Web Safe Colors as one of the choices. With this and the Text Inspector open, you can drag and drop your way to identical colors in no time!
    That same drag and drop trick works for text on the slide as well. If you just created a bit of text and you want to apply a color, scroll until you find the color you want, then drag and drop over to the text (it will highlight in blue showing you what you're about to color).

  • Read values from html response

    Hi,
    I am trying to make a call to an API using UTL_HTTP POST method over SSL and read the response html page and extract the values from the reponse.
    I am able to call and get a response back in html format. I have stored the html response in a clob variable.
    Now i want to parse this html and extract values from the form input items and send them out through OUT parameters.
    For example, from below reponse i want to extract the value '1111d7nhcwse30wq' from 'I4GO_UNIQUEID'
    Can anyone help me with the code to parse this html response and extract the values.
    Any help is greatly appreciated.
    Thanks
    Sharath
    sample Code:
    PROCEDURE get_token (
    p_requesterreference IN VARCHAR2,
    p_cardnumber IN VARCHAR2,
    p_cardtype IN VARCHAR2,
    p_cardholdername IN VARCHAR2,
    p_expirationmonth IN VARCHAR2,
    p_expirationyear IN VARCHAR2,
    p_streetaddress IN VARCHAR2,
    p_postalcode IN VARCHAR2,
    p_cvv2code IN VARCHAR2,
    po_uniqueid OUT VARCHAR2,
    po_errorindicator OUT VARCHAR2,
    po_primaryerrorcode OUT VARCHAR2,
    po_response OUT VARCHAR2,
    po_status_code OUT VARCHAR2,
    po_reason_phrase OUT VARCHAR2
    IS
    v_url VARCHAR2 (200);
    v_url_params VARCHAR2 (32767);
    v_resp_str VARCHAR2 (32767);
    l_http_req UTL_HTTP.req;
    l_http_resp UTL_HTTP.resp;
    v_requesterreference VARCHAR2 (12) := p_requesterreference;
    v_i4go_cardnumber VARCHAR2 (32) := p_cardnumber;
    v_i4go_streetaddress VARCHAR2 (30) := p_streetaddress;
    v_i4go_postalcode VARCHAR2 (9) := p_postalcode;
    v_i4go_expirationmonth VARCHAR2 (2) := p_expirationmonth; -- MM format
    v_i4go_expirationyear VARCHAR2 (2) := p_expirationyear; -- yy format
    v_i4go_cvv2code VARCHAR2 (3) := p_cvv2code;
    v_name VARCHAR2 (256);
    v_value VARCHAR2 (1024);
    l_clob CLOB;
    pv_amp CONSTANT CHAR (1) := CHR (38);
    CURSOR setup_cur
    IS
    SELECT interface_id, interface_name, interface_url, account_id, site_id
    FROM rsv.shift4_setup
    WHERE interface_name = 'I4GO';
    v_setup_rec setup_cur%ROWTYPE;
    BEGIN
    OPEN setup_cur;
    FETCH setup_cur
    INTO v_setup_rec;
    CLOSE setup_cur;
    v_url := 'https://certify.i4go.com//index.cfm?fuseaction=account.PostCardEntry';
    v_url_params :=
    pv_amp
    || 'i4GO_AccountID='
    || v_setup_rec.account_id
    || pv_amp
    || 'i4Go_SiteID='
    || v_setup_rec.site_id
    || pv_amp
    || 'i4Go_CardNumber='
    || v_i4go_cardnumber
    || pv_amp
    || 'i4Go_ExpirationMonth='
    || v_i4go_expirationmonth
    || pv_amp
    || 'i4Go_ExpirationYear='
    || v_i4go_expirationyear
    || pv_amp
    || 'i4Go_CVV2Code='
    || v_i4go_cvv2code
    || pv_amp
    || 'i4Go_PostalCode='
    || v_i4go_postalcode;
    -- begin request using POST method
    UTL_HTTP.set_response_error_check (FALSE);
    UTL_HTTP.set_transfer_timeout (180);
    UTL_HTTP.set_wallet ('file:/etc/ORACLE/WALLETS/oracle', 'welcome1');
    l_http_req := UTL_HTTP.begin_request (v_url, 'POST');
    UTL_HTTP.set_header (l_http_req, 'User-Agent', 'Mozilla/4.0');
    UTL_HTTP.set_header (l_http_req, 'Content-Type', 'application/x-www-form-urlencoded');
    UTL_HTTP.set_header (l_http_req, 'content-length', LENGTH (v_url_params));
    UTL_HTTP.write_text (l_http_req, v_url_params);
    -- get response
    l_http_resp := UTL_HTTP.get_response (l_http_req);
    po_status_code := l_http_resp.status_code;
    po_reason_phrase := l_http_resp.reason_phrase;
    -- read response into a clob
    DBMS_LOB.createtemporary (l_clob, FALSE);
    BEGIN
    LOOP
    UTL_HTTP.read_text (l_http_resp, v_resp_str, 32767);
    DBMS_LOB.writeappend (l_clob, LENGTH (v_resp_str), v_resp_str);
    END LOOP;
    EXCEPTION
    WHEN UTL_HTTP.end_of_body
    THEN
    -- end response
    UTL_HTTP.end_response (l_http_resp);
    END;
    -- Fre resources
    DBMS_LOB.freetemporary (l_clob);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_LOB.freetemporary (l_clob);
    DBMS_OUTPUT.put_line (UTL_HTTP.get_detailed_sqlerrm);
    RAISE;
    END;
    sample response:
    <!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">
    <head>
         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
         <title>Return With Payment Token</title>
         <script src="js/jquery-1.6.4.min.js" type="text/javascript"></script>
         <script type="text/javascript"><!--
              picSpinner= new Image(40,40);
              picSpinner.src="images/loading040.gif";
              bodyOnLoad = function() {
                   $("#noScriptDiv").hide();
                   $("#scriptDiv").show();
                   $("#i4GoMainForm").submit();
         //--></script>
    </head>
    <body onload="bodyOnLoad();">
         <form name="i4GoMainForm" id="i4GoMainForm" action="http://google.com" method="POST" onsubmit="$('#i4Go_submit').attr('disabled','disabled');">
                   <input name="I4GO_RESPONSE" type="hidden" value="SUCCESS" />
                   <input name="I4GO_RESPONSECODE" type="hidden" value="1" />
                   <input name="I4GO_CARDTYPE" type="hidden" value="VS" />
                   <input name="I4GO_UNIQUEID" type="hidden" value="1111d7nhcwse30wq" />
                   <input name="I4GO_EXPIRATIONMONTH" type="hidden" value="12" />
                   <input name="I4GO_EXPIRATIONYEAR" type="hidden" value="2012" />
                   <input name="I4GO_CARDHOLDERNAME" type="hidden" value="" />
                   <input name="I4GO_STREETADDRESS" type="hidden" value="" />
                   <input name="I4GO_POSTALCODE" type="hidden" value="65000" />
              <div id="scriptDiv" style="font-family:Arial, Helvetica, sans-serif;font-size:18px;visibility:hidden;">
                   <img src="images/loading040.gif" alt="Spinner..." />  Loading...
              </div>
              <div id="noScriptDiv" style="font-family:Arial, Helvetica, sans-serif;">
                   <noscript>
                                       <h1>Statement of Tokenization</h1>
                                       <p>The payment information you have submitted has been securely stored in the Shift4 PCI-DSS certified data center and a token representing this information will be sent to the merchant for processing. Below is the information that will be returning to the originating merchant:</p>
                                       <ul>
                                            <li>Response: <strong>SUCCESS</strong></li>
                                            <li>Response Code: <strong>1</strong></li>
                                            <li>Card Type: <strong>VS</strong></li>
                                            <li>Token: <strong>1111d7nhcwse30wq</strong></li>
                                       </ul>
                   </noscript>
    <input type="submit" name="i4Go_submit" id="i4Go_submit" value="Continue" />
              </div>
         </form>
    </body>
    </html>
    Edited by: sgudipat on Apr 24, 2012 1:20 PM

    Here is working example for your HTML using xpath to extract values from html
    You can store your html response in clob variable and then extract the value with xpath
    declare
       l_clob clob;
       l_value varchar2(100);
       l_xml xmltype;
      begin
         l_clob :='<!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">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Return With Payment Token</title>
      <script src="js/jquery-1.6.4.min.js" type="text/javascript"></script>
      <script type="text/javascript"><!--
       picSpinner= new Image(40,40);
       picSpinner.src="images/loading040.gif";
       bodyOnLoad = function() {
       $("#noScriptDiv").hide();
       $("#scriptDiv").show();
       $("#i4GoMainForm").submit();
      //--></script>
       </head>
       <body onload="bodyOnLoad();">
       <form name="i4GoMainForm" id="i4GoMainForm" action="http://google.com" method="POST" onsubmit="$(''#i4Go_submit'').attr(''disabled'',''disabled'');">
       <input name="I4GO_RESPONSE" type="hidden" value="SUCCESS" />
       <input name="I4GO_RESPONSECODE" type="hidden" value="1" />
       <input name="I4GO_CARDTYPE" type="hidden" value="VS" />
       <input name="I4GO_UNIQUEID" type="hidden" value="1111d7nhcwse30wq" />
       <input name="I4GO_EXPIRATIONMONTH" type="hidden" value="12" />
       <input name="I4GO_EXPIRATIONYEAR" type="hidden" value="2012" />
       <input name="I4GO_CARDHOLDERNAME" type="hidden" value="" />
       <input name="I4GO_STREETADDRESS" type="hidden" value="" />
       <input name="I4GO_POSTALCODE" type="hidden" value="65000" />
      <img src="images/loading040.gif" alt="Spinner..." />  Loading...
       <noscript>
       Statement of Tokenization
       The payment information you have submitted has been securely stored in the Shift4 PCI-DSS certified data center and a token representing this information will be sent to the merchant for processing. Below is the information that will be returning to the originating merchant:
           Response: SUCCESS
           Response Code: 1
           Card Type: VS
           Token: 1111d7nhcwse30wq
       </noscript>
       <input type="submit" name="i4Go_submit" id="i4Go_submit" value="Continue" />
       </form>
       </body>
       </html>';
         execute immediate 'alter session set events =''31156 trace name context forever, level 2''';
         l_xml := xmltype(l_clob);
         execute immediate 'alter session set events =''31156 trace name context off''';
         select extractvalue( l_xml
                            , '/html/body/form/input[@name="I4GO_CARDTYPE"]/@value'
                            , 'xmlns="http://www.w3.org/1999/xhtml"' )
         into l_value
         from dual;
         dbms_output.put_line(l_value);
       end;
    Problem when parsing html with xpath and xmltype
    Edited by: peterv6i.blogspot.com on Apr 26, 2012 9:38 AM

  • How to read text from a web page

    I want to read text from a web page. Can any body tell me how to do it.

    Ok i tell you detail. visit the site " http://seriouswheels.com/" you will a index from A to Z which are basically car name index i want to read each page get car name and its model and store it in data base. I you can provide me the code i will be very thankful.

  • Most compatable file type to use when copying and pasting specially formatted text into html pages?

    Hello,
      I have a simple web site at http://www.psychicmeatloaf.com which is an online poetry journal site. I use files people send me (mostly .doc or .docx) and cut and paste the text from those files into html pages in an older version of Dreamweaver and some of the text has special formatting (like this page: http://www.psychicmeatloaf.com/Chang-poetry.htm ). The best way I have found to maintain the special text formatting is to open the .docx files and "save as a web page" in Word and then open the web page from Dreamweaver and then "Preview the page" in Explorer and copy and paste from the preview into an html page in Dreamveaver. Even using this method, some text will not maintain it's special formatting and for those I just save the page as a .jpg file and use that, because I have no other choice.
      My question is, is there a better way and is there a better file type to work from other than .docx?
    Thanks a milliom,
    George

    neophyte weaver wrote:
    The best way I have found to maintain the special text formatting is to open the .docx files and "save as a web page" in Word and then open the web page from Dreamweaver and then "Preview the page" in Explorer and copy and paste from the preview into an html page in Dreamveaver.
    That's a lot of steps to get to a single end that could be done with a simple copy & paste of the text into code. Like Photoshop and Fireworks, Word writes some very bulky and dirty code. I wouldn't recommend it for direct copy by the method described above.
    I personally copy the text and paste it into code view. It takes a little more work, but I don't get dozens of lines of inline styles added with it and using a preformatted post div (saved and hidden in the code (<!--post block code goes inside-->), I can quickly put title, date, byline and links up with a cut & paste.
    That's just my $0.02 worth
    Also, since nearly EVERYONE will use a different formatting in a Word doc, putting a bunch of differently formatted posts into a page will make it look like one of those ransom notes made of cut out text from different newspapers and magazines.  Better to keep everything in a single format (your format) so it doesn't become an eyesore.
    Message was edited by: Curtis_E_Flush

  • Is there a way to  have the iPad 2 "read" text from iBooks as with web sites or pages?

    is there a way to  have the iPad 2 "read" text from iBooks as with web sites or pages? A different App perhaps?

    Isn't that you asking how to get it (undefined) back?
    If you never had Pages '09, you can buy it from Amazon very cheaply:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=432&sid=f68e84cd2ec6 123bd2ed93806c7e7fb6&mforum=iworktipsntrick
    Peter

  • Problem with reading text from .DOC files through java and POI

    I have used a jar file "poi-scratchpad-3.2-FINAL-20081019.jar" and "poi-3.2-FINAL.jar" to read text from a .DOC file. I used the "getParagraphText()" function of the class "org.apache.poi.hwpf.extractor.WordExtractor" to get the text.
    I am able to get the text in the .DOC file but along with that i am getting the following messages/warnings
    Current policy properties
    *     thread.thread_num_limited: true*
    *     file.write.state: disabled*
    *     net.connect_ex_dom_list:*
    *     mmc.sess_cab_act.block_unsigned: false*
    *     mmc.sess_cab_act.action: validate*
    *     mmc.sess_pe_act.block_blacklisted: false*
    *     mmc.sess_pe_act.block_invalid: true*
    *     jscan.sess_applet_act.stub_out_blocked_applet: true*
    *     file.destructive.in_list:*
    *     jscan.sess_applet_act.block_all: false*
    *     file.write.in_list:*
    *     file.nondestructive.in_list:*
    *     window.num_limited: true*
    *     file.read.state: disabled*
    *     jscan.session.origin_uri: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/poi/poi/3.2-FINAL/poi-3.2-FINAL.jar*
    *     file.nondestructive.state: disabled*
    *     jscan.session.user_ipaddr: 10.136.64.153*
    *     net.connect_other: false*
    *     thread.thread_num_max: 8*
    *     file.destructive.ex_list:*
    *     file.nondestructive.ex_list:*
    *     file.write.ex_list:*
    *     jscan.sess_applet_act.sig_invalid: block*
    *     file.read.in_list:*
    *     mmc.sess_cab_act.block_invalid: true*
    *     jscan.session.policyname: TU1DIERlZmF1bHQgUG9saWN5*
    *     mmc.sess_pe_act.action: validate*
    *     thread.threadgroup_create: false*
    *     net.connect_in_dom_list:*
    *     net.bind_enable: false*
    *     jscan.sess_applet_act.sig_trusted: pass*
    *     jscan.session.user_name: 10.166.64.201*
    *     jscan.session.user_hostname:*
    *     file.read.ex_list:*
    *     jscan.sess_applet_act.sig_blacklisted: block*
    *     jscan.session.daemon_protocol: http*
    *     net.connect_src: true*
    *     jscan.sess_applet_act.unsigned: instrument*
    *     mmc.sess_pe_act.block_unsigned: false*
    *     file.destructive.state: disabled*
    *     mmc.sess_cab_act.block_blacklisted: true*
    *     window.num_max: 5*
    Below the above messages/warnings the data is getting printed. Only the text part of the data is retrieved not the fonts, styles and bullets etc.
    Can anyone explain me why I am getting above warnings and how can I remove them. Is it possible to fetch the text depending on delimiters.
    Thanks in advance,
    Tiijnar
    Edited by: tiijnar on May 21, 2009 2:45 AM

    The jar files which were used are downloaded from http://jarfinder.com. Those jars created the problem of displaying those messages on console. I downloaded APIs from apache.org and used them in my application. Now my application is running good.
    Tiijnar

  • Drag and drop a image from html page into flex

    how can i drag a image form the html page and drop it into
    the flex application.

    Hi,
    There's no direct support for this. But you could implement
    drag and drop the way you normally would in javascript. Except
    here, on mouseUp over a div encapsulating the object or embed tag
    (the flash object), you'll need to make a call into actionscript
    from javascript indicating that a drag and drop happened.
    For more info, see
    how
    to drag and drop using javascript and
    actionscript
    and javascript communication

  • We want to read data from weigh bridge and display in oracle forms & store

    Sir/Madam,
    in our organisation we had one requirement. i.e is reading data from weigh bridge using serial port, displying that data in oracle forms and when ever user click save button we store that into my oracle database. we are using oracle 8i and forms 6i and windows OS environment. we don't know reading data from serial port and placing that into form items. please help me as early as possible if there is any property available in d2k regarding this requirement .
    thank you,
    vishnu

    There's no property in Forms that makes you read serial ports, but as far as I know you need to know the API of the machine which you want to read data from (it should come with machine's manual) and then it will be easy to store it in forms item.
    Tony

  • I want to take an Input from the Page and pass to a plsql package

    Here i am extending a controller class i am get number of errors can you plz chk the syntax:-----
    I am taking Attribute1 ,2,3 from the page and input it into procedure and get the out variable into project number in the page:----
    public class adtDetailDataInputCO extends oracle.apps.ap.oie.webui.DetailDataInputCO
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    public void assignProjectNumber(OAPageContext pageContext, OAWebBean webBean)
    OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
    OADBTransaction dbtrans = oaapplicationmodule.getOADBTransaction();
    OAViewObject vo = (OAViewObject)oaapplicationmodule.findViewObject("OneReceiptBasedVO");
    for (Row row = vo.first();
    row != null;
    row = vo.next())
    String lattribute1 = (String) row.getAttribute("Attribute1");
    String lattribute2 = (String) row.getAttribute("Attribute2");
    String lattribute3 = (String) row.getAttribute("Attribute3");
    String lProjectNumber="";
    String l_status="";
    String l_message="";
    if (lattribute1 != null && lattribute2 != null && lattribute3 != null)
    OADBTransaction txn = oaapplicationmodule.getOADBTransaction();
    CallableStatement cs = txn.createCallableStatement("begin ADTP_PA_COMMON_UTILITY.get_project_from_tcc(:1,:2,:3,:4,:5,:6); END;",1);
    try
    cs.setString(1,lattribute1);
    cs.setString(2,lattribute2);
    cs.setString(3,lattribute3);
    cs.registerOutParameter(4, Types.VARCHAR, 200);
    cs.registerOutParameter(5, Types.VARCHAR, 0, 2000);
    cs.execute();
    l_status = cs.getString(4);
    l_message = cs.getString(5);
    cs.close();
    catch (SQLException sql)
    System.out.println(sql.getLocalizedMessage());
    cs.close();
    row.setAttribute("ProjectNumber",lProjectNumber);
    row.setAttribute("TaskNumber",lTaskNumber);
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    assignProjectNumber(pageContext, webBean);
    }

    I've done a similar PL/SQL package call using the following:
    You need update or add the following to your EO using the following:
    public class AcctMapEOImpl extends OAPlsqlEntityImpl //replaced with OAPlsqlEntityImpl
    public void create(AttributeList attributeList)
    Number n = new Number(0);
    if (getEntityState() != STATUS_NEW)
    super.create(attributeList);
    OADBTransaction transaction = getOADBTransaction();
    setFormId(n);
    setCreationDate(transaction.getCurrentDBDate());
    setLastUpdateDate(transaction.getCurrentDBDate());
    setCreatedBy(getCreatedBy());
    setLastUpdatedBy(getCreatedBy());
    public void insertRow()
    try
    OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
    String a = "begin apps.spl_jdev_api_item_console.spl_create_part(p_acct_nbr =>:1,p_part_nbr =>:2,p_part_desc =>:3,p_part_price =>:4,p_bin_bulk_yn =>:5,p_case_lot_yn =>:6,p_serial_yn =>:7,p_repack_yn => null,p_part_length =>:8,p_part_width =>:9,p_part_height =>:10,p_part_weight =>:11,p_done_flag =>null,p_creation_date =>null,p_uom =>:12,p_revision =>null,p_trans_type =>:13,p_lock_flag =>null,p_lock_id =>null,";
    String b = "p_item_status =>null,p_hazard_class_id =>:14,p_shelf_life_code =>null,p_part_weight_uom =>null,p_volume_uom =>null,p_unit_volume =>null,p_dimension_uom =>null,p_un_number_id =>null,p_un_num_desc =>null,p_haz_id_desc =>null,p_last_update_date =>null,p_last_updated_by =>null,p_created_by =>:15,p_process_key =>null,p_part_type => null,p_comm_code => null,p_cat_desc0 => null,p_attribute1 =>:16,p_attribute2 =>:17,";
    String c = "p_attribute3 =>:18,p_attribute4 =>:19,p_attribute5 =>:20,p_attribute6 =>:21,p_attribute7 =>:22,p_attribute8 =>:23,p_attribute9 =>:24,p_attribute10 =>:25,p_attribute11 =>:26,p_attribute12 =>:27,p_attribute13 =>:28,p_attribute14 =>:29,p_attribute15 =>:30); end;";
    String s = (a+b+c);
    OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransactionimpl.createCallableStatement(s, -1);
    oraclecallablestatement.setString(1,getAcctNbr());
    oraclecallablestatement.setString(2,getPartNbr());
    oraclecallablestatement.setString(3,getPartDesc());
    oraclecallablestatement.setNUMBER(4,getPartPrice());
    oraclecallablestatement.setNUMBER(5,getBinBulkYn());
    oraclecallablestatement.setString(6,getCaseLotYn());
    oraclecallablestatement.setString(7,getSerialYn());
    oraclecallablestatement.setNUMBER(8,getPartLength());
    oraclecallablestatement.setNUMBER(9,getPartWidth());
    oraclecallablestatement.setNUMBER(10,getPartHeight());
    oraclecallablestatement.setNUMBER(11,getPartWeight());
    oraclecallablestatement.setString(12,getUom());
    oraclecallablestatement.setString(13,getTransType());
    oraclecallablestatement.setNUMBER(14,getHazardClassId());
    oraclecallablestatement.setNUMBER(15,getCreatedBy());
    oraclecallablestatement.setString(16,getAttribute1());
    oraclecallablestatement.setString(17,getAttribute2());
    oraclecallablestatement.setString(18,getAttribute3());
    oraclecallablestatement.setString(19,getAttribute4());
    oraclecallablestatement.setString(20,getAttribute5());
    oraclecallablestatement.setString(21,getAttribute6());
    oraclecallablestatement.setString(22,getAttribute7());
    oraclecallablestatement.setString(23,getAttribute8());
    oraclecallablestatement.setString(24,getAttribute9());
    oraclecallablestatement.setString(25,getAttribute10());
    oraclecallablestatement.setString(26,getAttribute11());
    oraclecallablestatement.setString(27,getAttribute12());
    oraclecallablestatement.setString(28,getAttribute13());
    oraclecallablestatement.setString(29,getAttribute14());
    oraclecallablestatement.setString(30,getAttribute15());
    oraclecallablestatement.execute();
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    catch(Exception exception)
    throw OAException.wrapperException(exception);
    Method added to your AM:
    public void createPart()
    OAViewObject vo = (OAViewObject)getPartGenerationVO1();
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    // Required per OA Framework Model Coding Standard M69
    row.setNewRowState(Row.STATUS_INITIALIZED);
    } // end createPart()
    Code in your *VOImpl:
    public void initQuery()
    setWhereClauseParams(null); // Always reset
    executeQuery();
    }

  • Reading text from server socket stream

    I have a basic cd input program i've been trying to figure out the following problem for a while now, the user enters the artist and title etc and then a DOM (XML) file is created in memory this is then sent to the server. The server then echos back the results which is later printed on a html page by reading the replys from the server line by line.
    The server must be run it listens for clients connecting the clients connect and send DOM documents through the following jsp code.
    <%@page import="java.io.*"%>
    <%@page import="java.net.*"%>
    <%@page import="javax.xml.parsers.*"%>
    <%@page import="org.w3c.dom.*"%>
    <%@page import="org.apache.xml.serialize.*"%>
    <%!
       public static final String serverHost = "cdserver";
       public static final int serverPort = 10151;
    %>
    <hr />
    <pre>
    <%
            Socket mySocket = null;          // socket object
            PrintWriter sockOut = null;      // to send data to the socket
            BufferedReader sockIn = null;    // to receive data from the socket
            try {
                //  #1 add line that creates a client socket
                mySocket = new Socket(serverHost, serverPort);
                // #2 add lines that create input and output streams
                //            attached to the socket you just created
                 sockOut = new PrintWriter(mySocket.getOutputStream(), true);
                 sockIn = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
            } catch (UnknownHostException e) {
                throw e; // This time the JSP can handle the exception, not us
            } catch (IOException e) {
                throw e; // This time the JSP can handle the exception, not us
    String cdTitle, cdArtist, track1Title, track1Time, track1Rating;
    // Retrieve the HTML form field values
    cdTitle = request.getParameter("cdtitle");
    cdArtist = request.getParameter("cdartist");
    track1Title = request.getParameter("track1title");
    track1Time = request.getParameter("track1time");
    track1Rating = request.getParameter("track1rating");
    // Create a new DOM factory, and from that a new DOM builder object
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    // Note that we are creating a new (empty) document
    Document document = builder.newDocument();
    // The root element of our document wil be <cd>
    // It gets stored as the child node of the whole document (it is the root)
    Element rootElement = document.createElement("cd");
    document.appendChild(rootElement);
    // Create an element for the CD title called <title>
    Element cdTitleElement = document.createElement("title");
    // Add a text code under the <title> element with the value that
    // the user entered into the title field of the web form (cdTitle)
    cdTitleElement.appendChild(document.createTextNode(cdTitle));
    // Place the <title> element underneath the <cd> element in the tree
    rootElement.appendChild(cdTitleElement);
    // Create an <artist> element with the form data, place underneath <cd>
    Element cdArtistElement = document.createElement("artist");
    cdArtistElement.appendChild(document.createTextNode(cdArtist));
    rootElement.appendChild(cdArtistElement);
    // Create a <tracklist> element and place it underneath <cd> in the tree
    // Note that it has no text node associated with it (it not a leaf node)
    Element trackListElement = document.createElement("tracklist");
    rootElement.appendChild(trackListElement);
    // In this example we only have one track, so it is not necessary to
    // use a loop (in fact it is quite silly)
    // But the code below is included to demonstrate how you could loop
    // through and add a set of different tracks one by one if you
    // needed to (although you would need to have the track data already
    // stored in an array or a java.util.Vector or similar
    int numTracks = 1;
    for (int i=0; i<numTracks; i++) {
      String trackNum = Integer.toString(i+1);
      Element trackElement = document.createElement("track");
      trackElement.setAttribute("id", trackNum);
      trackListElement.appendChild(trackElement);
      // Track title element called <title>, placed underneath <track>
      Element trackTitleElement = document.createElement("title");
      trackTitleElement.appendChild(document.createTextNode(track1Title));
      trackElement.appendChild(trackTitleElement);
      // Track time element called <time>, placed underneath <track>
      Element trackTimeElement = document.createElement("time");
      trackTimeElement.appendChild(document.createTextNode(track1Time));
      trackElement.appendChild(trackTimeElement);
      // Track rating element called <rating>, placed underneath <track>
      Element trackRatingElement = document.createElement("rating");
      trackRatingElement.appendChild(document.createTextNode(track1Rating));
      trackElement.appendChild(trackRatingElement);
    OutputFormat format = new OutputFormat();
    format.setIndenting(true);
    // Create a new XMLSerializer that will be used to write out the XML
    // This time we will serialize it to the socket
    // #3 change this line so that it serializes to the socket,
    // not to the "out" object
    XMLSerializer serializer = new XMLSerializer(writer, format);
    serializer.serialize(document);
            // Print out a message to indicate the end of the data, and
            // flush the stream so all the data gets sent now
            sockOut.println("<!--QUIT-->");
            sockOut.flush();
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            String fromServer;
            String fromUser;
             #4 add a while loop that reads text from the
            server socket input stream, line by line, and prints
            it out to the web page, using out.println(...);
            Note that because the reply from the server will contain
            XML, you will need to call upon the toHTMLString() method
            defined below to escape the < and > symbols so that they
            will display correctly in the web browser.
            Also note that as you receive the reply back from the
            server, you should look out for the special <!--QUIT-->
            string that will indicate when there is no more data
            to receive.
            while ((fromServer = sockIn.readLine()) != null) {
            out.println(sockIn.readLine());
                // If the reply from the server said "QUIT", exit from the
                // while loop by using a break statement.
                if (fromServer.equals("QUIT")) {
                    out.println("Connection closed - good bye ...");
                // Print the text from the server out to the user's screen
                out.println("Reply from Server: " + fromServer);
                // Now read a line of text from the keyboard (typed by user)
                fromUser = stdIn.readLine();
                // If it wasn't null, print it out to the screen, and also
                // print a copy of it out to the socket
                if (fromUser != null) {
                    out.println("Client: " + fromUser);
                    sockOut.println(fromUser);
            // Close all the streams we have open, and then close the socket
            sockOut.close();
            sockIn.close();
            mySocket.close();
    %>
    I'm suppose to modify the commented sections labled with #.
    #1,2 are correct but i have doubts on the 3rd and 4th modification.
    for #3 i changed so i serializes to the socket not to the "out" object:
    from
    XMLSerializer serializer = new XMLSerializer(out, format);
    to
    XMLSerializer serializer = new XMLSerializer(writer, format);
    with "out" it prints out some of the results entered but it just hangs i'm thinking it might be the while loop that i added in #4. If i changed it to serialize the socket XMLSerializer serializer = new XMLSerializer(writer, format); it doesn't print out nothing at all; just a blank screen where it hangs.
    I can post the rest of the code (server thats in java and cdinput.html) but since i want to keep my post short and if required i'll post it later on i also omitted some of the code where it creates the DOM textnodes etc to keep my post short.

    On your previous thread, why did you say the server was using http POST and application/xml content type when it quite obviously isn't, but a direct socket communication that abuses XML comments for message end delimiters?
    The comments imply you need to wait for "<!--QUIT-->" on a line by itself, but your loop is waiting for "QUIT".
    Pete

Maybe you are looking for

  • MacBook Pro can't actually connect to Wi-Fi with Self-Assigned IP

    Hi there I have a 15 inch MacBook Pro and it can connect to Wi-Fi but have no actual data coming in. And it says self-assigned IP. This only happens to my home Wi-Fi, however, I can connect and use Wi-fi at school or anywhere else perfectly. In the m

  • Area chart

    I'm using an area chart I was wondering if there is a way to show targets all the time? just a dot or something so that the data is more obvious? I tried this but it did not work. <mx:AreaChart x="134" y="10" id="areachart1" showDataTips="true" showD

  • Can not open iTune 12.0.1

    I have downloaded and installed the iTunes. When I open it, a error message says" apple application support was not found"

  • Tablular form element max length

    Hi, I could not find a way to limit tabular form element length. Is there a way we can enforce the max length ? If there is no way of doing that, can we use JavaScript to jup to next element as soon as max length is reached? Thanks in advace, Asha

  • Display panel used in Z1

    Hi, There are roumors that Sony is using the leftover display panels of Xperia Z in our Z1. Is there any way to check the same, whether we have got a triluminous display or not?  And which panel is used in Xperia Z and Z1? I would appreciate a reply