Extract Title + Decription from HTML
I'm looking for a Efficient way to extract the Title and Desription from a Webpage. I guess it will need to parse the HTML for the tags and extract whatever is between them. Any ideas?
Thanks.
Yep, you would have to parse the HTML file for the tags. Easiest is to read in each line from your HTML file, and see if it contains the tag. It it does, go past the tag and just read the title up to the start of the next tag.
Alan
Similar Messages
-
Extract email address from html
Hi,
I am trying to extract "email address" from an html output query. How would I do that?
I am on CF9.
example:
Query col1:
<html><head></head><body>today they emailed about it from (mailto:[email protected]) ...hello there and here</body></html>Argh! No!
God I hate it when people knock together a regex like this and go "Look! Email address validation!"
Before one starts down this road, one should read the RFC (http://tools.ietf.org/html/rfc5322, summarised here: http://en.wikipedia.org/wiki/Email_address).
Your own regex fails my spamtrap email address (for example: [email protected]), because you've forgotten that a + is a legitimate character in the local part of an email address. Along with a bunch of other completely legit characters.
Reading on through the RFC you will realise than ANYTHING is valid in the local part of an email address, provided it's quoted (double-quote being another character your regex doesn't accept).
If someone doesn't want to give you their valid email address, they won't. I can give you [email protected], and that will pass. If I do want to give you my address, you should make sure your code will actually accept it!
I can understand wanting to make sure the punter doesn't key their email address in incorrectly, but your method doesn't help here. It'd pass [email protected], despite the fact that it should be [email protected] "Close" is not good enough in these cases.
The only sensible way of doing this is to ask them to type it in twice. This will assist people who don't just roll their eyes and copy and paste what they typed in the first box into the second box, wondering why you're wasting their time. So a typo will be transferred, so it's no help.
If you really want to get a person's email address, deprive them of something until they respond to an email that you end them. At the email address they specified. Because they actually don't mind you having their email address. This only works if you're not simply trying to harvest email addresses for your own benefit, and not the benefit of your subscribers.
Bottom line: email address is a mug's game, and one not often played by people who know the rules.
Adam -
Extracting Image Links From HTML
Hi, at the moment am trying to extract image locations from the html files i.e. the "src" part of <img> tag. Have tried using HTMLParserCallback as I know this allow you to extract links from a page. However when I open a document I know to have <img> tags in it, handleStartTag() is not called, I only get all the other tags. Any idea how to solve this problem? Thanks very much,
RossHi,
Here's a portion of a class I wrote a while back....
Note the useMap variable I introduced in the constructor.
Some HTML files had the images in a "map" attribute, others in an "imgmap" attribute.
regards,
Owen
private class CallbackHandler extends HTMLEditorKit.ParserCallback
private HTML.Tag tag; // The most recently parsed tag
private HTML.Tag lastTag; // The last tag encountered
private int nested = 0;
private boolean useMap;
public CallbackHandler(boolean useMap)
super();
this.useMap = useMap;
public void handleText ( char[] data, int pos )
public void handleStartTag ( HTML.Tag t, MutableAttributeSet attSet, int pos )
public void handleSimpleTag ( HTML.Tag t, MutableAttributeSet attSet, int pos )
if ( t.toString().equalsIgnoreCase ( "input" ) )
boolean imagemap = false;
String name = null;
String src = null;
if ( attSet instanceof SimpleAttributeSet )
SimpleAttributeSet sattSet = (SimpleAttributeSet)attSet;
Enumeration atts = sattSet.getAttributeNames();
Object att;
while ( atts.hasMoreElements() )
att = atts.nextElement();
if ( att.toString().equalsIgnoreCase ( "name" ) )
name = (String)sattSet.getAttribute ( att );
// got the name of the attribute
// Note : useMap is a boolean flag for you to set.
// Some HTML pages used "map" attributes, others "imgmap" attributes
if ( useMap )
if ( name.equalsIgnoreCase ( "map" ) )
imagemap = true;
else
if ( name.equalsIgnoreCase ( "imgmap" ) )
imagemap = true;
if ( att.toString().equalsIgnoreCase ( "src" ) )
src = (String)sattSet.getAttribute ( att );
if ( imagemap )
try
imagemapURL = new URL ( src );
catch ( MalformedURLException malEx )
System.out.println ("Invalid Image Map URL : " + src );
public void handleEndTag ( HTML.Tag t, int pos )
} -
How to Extract TEXT ONLY from HTML ?
I am developing speech-enabled browser and what I would like to do is to read aloud all the texts within webpage. My problem is how can I get only the text, not HTML tags, from the webpage. Similar question has been asked before in this forum but none of the given suggestions seem to work. Any help would greatly be appreciated.
Is there anyone out there who is also using speech package? Is there any forum for java speech package?don't know about the speech part, but the text parsing
is pretty simple, if you just want the text. You just
take the string and run thru it char by char and
remove the stuff between the < and > chars.Also you'd have to unescape anything that was escaped for HTML, such as & should be replaced by & and é should be replaced by é and so on. -
Problem to extract text from HTML document
I have to extract some text from HTML file to my database. (about 1000 files)
The HTML files are get from ACM Digital Library. http://portal.acm.org/dl.cfm
The HTML page is about the information of a paper. I only want to get the text of "Title" "Abstract" "Classification" "Keywords"
The Problem is that I can't find any patten to parser the html files"
EX: I need to get the Classification = "Theory of Computation","ANALYSIS OF ALGORITHMS AND PROBLEM COMPLEXITY","Numerical Algorithms and Problem","Mathematics of Computing","NUMERICAL ANALYSIS"......etc .
The section code about "Classification" is below.
Please give any idea to do this, or how to find patten to extract text from this.
<div class="indterms"><a href="#CIT"><img name="top" src=
"img/arrowu.gif" hspace="10" border="0" /></a><span class=
"heading"><a name="IndexTerms">INDEX TERMS</a></span>
<p class="Categories"><span class="heading"><a name=
"GenTerms">Primary Classification:</a></span><br />
� <b>F.</b> <a href=
"results.cfm?query=CCS%3AF%2E%2A&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Theory of Computation</a><br />
� <img src="img/tree.gif" border="0" height="20" width=
"20" /> <b>F.2</b> <a href=
"results.cfm?query=CCS%3A%22F%2E2%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">ANALYSIS OF ALGORITHMS AND PROBLEM
COMPLEXITY</a><br />
� � � <img src="img/tree.gif" border="0" height=
"20" width="20" /> <b>F.2.1</b> <a href=
"results.cfm?query=CCS%3A%22F%2E2%2E1%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Numerical Algorithms and Problems</a><br />
</p>
<p class="Categories"><span class="heading"><a name=
"GenTerms">Additional�Classification:</a></span><br />
� <b>G.</b> <a href=
"results.cfm?query=CCS%3AG%2E%2A&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Mathematics of Computing</a><br />
� <img src="img/tree.gif" border="0" height="20" width=
"20" /> <b>G.1</b> <a href=
"results.cfm?query=CCS%3A%22G%2E1%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">NUMERICAL ANALYSIS</a><br />
� � � <img src="img/tree.gif" border="0" height=
"20" width="20" /> <b>G.1.6</b> <a href=
"results.cfm?query=CCS%3A%22G%2E1%2E6%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Optimization</a><br />
� � � � � <img src="img/tree.gif" border=
"0" height="20" width="20" /> <b>Subjects:</b> <a href=
"results.cfm?query=CCS%3A%22Linear%20programming%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Linear programming</a><br />
</p>
<br />
<p class="GenTerms"><span class="heading"><a name=
"GenTerms">General Terms:</a></span><br />
<a href=
"results.cfm?query=genterm%3A%22Algorithms%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Algorithms</a>, <a href=
"results.cfm?query=genterm%3A%22Theory%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Theory</a></p>
<br />
<p class="keywords"><span class="heading"><a name=
"Keywords">Keywords:</a></span><br />
<a href=
"results.cfm?query=keyword%3A%22Simplex%20method%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">Simplex method</a>, <a href=
"results.cfm?query=keyword%3A%22complexity%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">complexity</a>, <a href=
"results.cfm?query=keyword%3A%22perturbation%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">perturbation</a>, <a href=
"results.cfm?query=keyword%3A%22smoothed%20analysis%22&coll=ACM&dl=ACM&CFID=22820732&CFTOKEN=38147335"
target="_self">smoothed analysis</a></p>
</div>One approach is to download Htmlparser from sourceforge
http://htmlparser.sourceforge.net/ and write the rules to match title, abstract etc.
Another approach is to write your own parser that extract only title, abstract etc.
1. tokenize the html file. --> convert html into tokens (tag and value)
2. write a simple parser to extract certain information
find out about the pattern of text you want to extract. For instance "<class "abstract">.
then writing a rule for extracting abstract such as
if (tag is abstract ) then extract abstract text
apply the same concept for other tags
Attached is the sample parser that was used to extract title and abstract from acm html files. Please modify to include keyword and other fields.
good luck
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class ACMHTMLParser
private String m_filename;
private URLLexicalAnalyzer lexical;
List urls = new ArrayList();
public ACMHTMLParser(String filename)
super();
m_filename = filename;
* parses only title and abstract
public void parse() throws Exception
lexical = new URLLexicalAnalyzer(m_filename);
String word = lexical.getNextWord();
boolean isabstract = false;
while (null != word)
if (isTag(word))
if (isTitle(word))
System.out.println("TITLE: " + lexical.getNextWord());
else if (isAbstract(word) && !isabstract)
parseAbstract();
isabstract = true;
word = lexical.getNextWord();
lexical.close();
public static void main(String[] args) throws Exception
ACMHTMLParser parser = new ACMHTMLParser("./acm_html.html");
parser.parse();
public static boolean isTag(String word)
return ( word.startsWith("<") && word.endsWith(">"));
public static boolean isTitle(String word)
return ( "<title>".equals(word));
//please modify according to the html source
public static boolean isAbstract(String word)
return ( "<p class=\"abstract\">".equals(word));
private void parseAbstract() throws Exception
while (true)
String abs = lexical.getNextWord();
if (!isTag(abs))
System.out.println(abs);
break;
class URLLexicalAnalyzer
private BufferedReader m_reader;
private boolean isTag;
public URLLexicalAnalyzer(String filename)
try
m_reader = new BufferedReader(new FileReader(filename));
catch (IOException io)
System.out.println("ERROR, file not found " + filename);
System.exit(1);
public URLLexicalAnalyzer(InputStream in)
m_reader = new BufferedReader(new InputStreamReader(in));
public void close()
try {
if (null != m_reader) m_reader.close();
catch (IOException ignored) {}
public String getNextWord() throws IOException
int c = m_reader.read();
if (-1 == c) return null;
if (Character.isWhitespace((char)c))
return getNextWord();
if ('<' == c || isTag)
return scanTag(c);
else
return scanValue(c);
private String scanTag(final int c)
throws IOException
StringBuffer result = new StringBuffer();
if ('<' != c) result.append('<');
result.append((char)c);
int ch = -1;
while (true)
ch = m_reader.read();
if (-1 == ch) throw new IllegalArgumentException("un-terminate tag");
if ('>' == ch)
isTag = false;
break;
result.append((char)ch);
result.append((char)ch);
return result.toString();
private String scanValue(final int c) throws IOException
StringBuffer result = new StringBuffer();
result.append((char)c);
int ch = -1;
while (true)
ch = m_reader.read();
if (-1 == ch) throw new IllegalArgumentException("un-terminate value");
if ('<' == ch)
isTag = true;
break;
result.append((char)ch);
return result.toString();
} -
Extract textdata from HTML with AUTO_FILTER
Hi,
we're using Oracle AUTO_FILTER to extract text-information from DOC and PDF - Documents.
Works fine.
We also have data stored within a HTML structure.
We use our filter with the following options:
ctx_ddl.create_preference('SEARCH_iMT_ATTRIB_AFILTER', 'AUTO_FILTER');
ctx_ddl.create_policy('SE_IMT_POLICY', 'SEARCH_iMT_ATTRIB_AFILTER');
The filter itself is called within a loop:
CTX_DOC.Policy_Filter('SE_IMT_POLICY', v_blobtab(i), v_ctmp, TRUE);
It seems as if AUTO_FILTER converts our HTML to HTML again.
When trying to insert the AUTO_FILTER, I get an ora-31167: XML nodes over 64K in size cannot be inserted
How can I force the AUTO_FILTER only to return plain-text?
Thanks in advance
Message was edited by:
user557708You need to create a section group preference employing HTML_SECTION_GROUP and then use it when creating your Policy.
Faisal -
Change Html Title dynamic from Flash
Hi,
I want to change the Title of the Html page dynamically from
the embedded Flash.
The Title, that appears on Browser bars etc.
Could I do this?
On init I can load the Html source code in with LoadVars, and
onData (src) change the Title with subString method, but, how then
could I pass the new value back to the Html page, so the Browser
Title changes?
Thank you.
LuciewongThank you both GWD and Dave for the help.
I know your code works under normal circumstances, just in my
case, I can't get it to work.
Because, on a subsequent Frame, called after the
ExternalInterface.call,
I have a getURL(javascript) to change the doc. background
color.
Now, either the Title changes or the background color
changes, but both after each other, can't make it.
I have tried Ext,CallBack function, so when the Title changes
and callBack is true, move on, but still then it changes the BG,
but not the title anymore.
I must do something wrong with the callBack function?
Thank you for your help.
Regards,
Luciewong -
Requesting help in extracting user comments from a forum ( HTML WEBSITE)
hello experts,
As i m new to java and i got this college project in hand which has to completed in few days i require some expert advise.
Basically what my job is to extract all the user comments from a forum and make a text file.. for example this is one of the website http://www.gsmarena.com where user have posted many reviews and comments about mobile phones . ex : http://www.gsmarena.com/nokia_n97-reviews-2615p2.php .
now looking at source code , all user comment are inside <P class="uopin"> tag under <DIV class="user-thread"> element.
So i want to ask if there is any method in java that can extract all contents from class "uopin" directly ?
i have no problem opening URL connection and reading the webpage but i m not able to extract that specific content . please enlighten me in this regard.
Actually i m searching this forum since last 3 hours trying to find an answer and i found that i have to learn Regex , indexOf() subString() , HTMLEditorKit() etc.
I ma planning to learn them in detail but as i have very less time ( 2 days to be specific) , i want help from you experts to solve this problem. plz guide me with some code snippets .
Thankyou for your advises in advance :)ok.. sorry for asking that way.
Here is my work till now....
i wrote this code :
import java.io.*;
import java.io.Console;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MyRobot3
public static void main(String[] args) throws IOException
BufferedReader in = new BufferedReader(new FileReader("MyRobot3.txt"));
String inputLine , nextLine,kutta;
FileOutputStream out; // declare a file output object
PrintStream p; // declare a print stream object
out = new FileOutputStream("myfile3.txt");
p = new PrintStream( out );
while ((inputLine = in.readLine()) != null)
Pattern p1 = Pattern.compile("(<p\\sclass=\"uopin\">)(.*$)" );
// Pattern p1 = Pattern.compile("(<p\\sclass=\"uopin\">)(.*$\r\n.*$)" , Pattern.MULTILINE | Pattern.UNIX_LINES); //not working
//Pattern p1 = Pattern.compile("(<p\\sclass=\"uopin\">)(.*\\s)" , Pattern.MULTILINE );
Matcher m1 = p1.matcher(inputLine);
boolean found = false;
while (m1.find())
p.println(m1.group(2));
}I am testing with a little file MyRobot3.txt which contains
<p class="uopin">Although they didn't announce any winner here. But to me the winner is <br/>
N900. Then opera is in second position. (overall averare result)</p>And i am getting output in a file : myfile3.txt
Although they didn't announce any winner here. But to me the winner is <br/>which is just the first line , but i need to match that line break also. i m not able to figure it out .please help me fixing this code so that it can match all the text and remove the <br> tag .. -
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 PMHere 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 -
Please help me capturing data from HTML table
Hello Everyone,
Our Storage subsystem generates a html table containing all LUN allocation for printing. I am saving this html file on disk to collect all table infomation and to put it into a database.
I am having problems extracting table information from the html file. I tried using regular expressions but still not going anywhere. Below is a sample few lines from the html file.
Please your help is appreciated solving this problem how to collect this information from a HTML file or if Java has any class for this type of purpose.
Please advice
arsi
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0068)https://10.210.44.14/cgi/rsConfigPrintDisplay?200702121685061633,FS,2 -->
<HTML><HEAD><TITLE>Volume Assignments</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY><FONT face="Times New Roman,Times" size=2>
<TABLE cellSpacing=1 cellPadding=3 border=2>
<CAPTION>
<H2>Volume Assignments</H2></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><FONT face="Times New Roman,Times" size=2>Volume</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Location</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>LSS</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Volume Type</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Size</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Storage Type</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Host Port</FONT></TH>
<TH><FONT face="Times New Roman,Times" size=2>Host Nicknames</FONT></TH></TR>
<TR vAlign=top>
<TD><FONT face="Times New Roman,Times" size=2>02A-25015</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>Device Adapter Pair 1</FONT>
<BR><FONT face="Times New Roman,Times" size=2>Cluster 1, Loop A</FONT>
<BR><FONT face="Times New Roman,Times" size=2>Array 2, Vol 042</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>0x10</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>Open System</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>000.9 GB</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>RAID-5 Array</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>Fibre Channel</FONT>
<BR><FONT face="Times New Roman,Times" size=2>ID 00, LUN 502A</FONT></TD>
<TD><FONT face="Times New Roman,Times" size=2>R1L01_0,</FONT> <BR><FONT
face="Times New Roman,Times" size=2>R1L01_1,</FONT> <BR><FONT
face="Times New Roman,Times" size=2>R2L08_1,</FONT> <BR><FONT
face="Times New Roman,Times" size=2>R2L08_0,</FONT> <BR><FONT
face="Times New Roman,Times" size=2>S3L06_0, S3L06_</FONT> <BR><FONT
face="Times New Roman,Times" size=2>1, S4L06_0,</FONT> <BR><FONT
face="Times New Roman,Times" size=2>S4L06_1</FONT></TD></TR>
<TR vAlign=top>i wrote the programme for 2 stepper motor as attachment file below. they are run. but when the "start" button is ON then the "emergency stop" is not effects.
for "emergency stop" functions, i used 4 limit contactors. if one of them is "on" then the programme will be stop.
but in fact, when the system is running, i can not stop if one of the limit contacor is on.
cuold you please help me to do with this problem.
thanks
Attachments:
EMERGENCY STOP.vi 435 KB
toolpaths-ut.vi 64 KB
parallel program motor 1,2.vi 96 KB -
Extraction of data from ECC to 3rd Party systems
Hi All,
I want to know all the options available for extracting data from ECC to a 3rd party system (custom datawarehouse like Teradata, hyperion etc). Also, I want know if there is a best practice documentation available for extraction of data from ECC to any 3rd party system?
Thanks,
SB.Hi SB,
Check the following link
http://expertisesapbi.blogspot.com/2010/06/how-to-transfer-data-from-sap-system-to.html
Ranganath. -
Example on extracting time data from clusters
Hi Experts,
Please send me a sample code for time data extraction from clusters. or steps to extract time data from clusters.
Thank you.
Regards,
Admir.
Points will be rewarded.Hi
see the sample report for time data fetching
But ime data is not fetched from Clusters, only payroll data is fetched from clusters
Time related infotypes are 2000 to 2999.
REPORT zh_absence_quota
NO STANDARD PAGE HEADING
MESSAGE-ID zh_msg
LINE-SIZE 169
LINE-COUNT 60(1).
T A B L E S D E C L A R A T I O N S
TABLES: pernr, " Logical PNP
t001p, " Personnel Subarea
t529u, " Employment Status
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
t549a, " Payroll Area
t554s, " Absence Type
t554t, " Absence Type Texts
t556a, " Quota Type
t527x, " Orgn. Unit
t556b, " Quota Type Text
pa0003. " Payroll Status
INFOTYPES:
0000, " Actions
0001, " Organizational Assignment
2006, " Absence Quota
2001. " Absences
T Y P E S D E C L A R A T I O N S
Employee Absence Structure
TYPES: BEGIN OF s_2001,
pernr TYPE persno, " Personal Number
awart TYPE awart, " Absence Type
subty TYPE subty, " Sub Type
endda TYPE endda, " End date
begda TYPE begda, " Begin date
abrtg TYPE abrtg, " Absence days
ename TYPE emnam, " employee Name
atext TYPE abwtxt, " Absence Type Text
END OF s_2001.
Employee Absence Quota Structure
TYPES: BEGIN OF s_2006,
pernr TYPE persno, " Personal Number
ktart TYPE abwko, " Absence Quota Type
year(4) TYPE n, " Year
subty TYPE subty, " Sub Type
endda TYPE endda, " End date
begda TYPE begda, " Begin date
anzhl TYPE ptm_quonum, " Absence Entitlement days
ename TYPE emnam, " employee Name
ktext TYPE kotxt, " Absence Type Text
kverb TYPE kverb, " Deduction Quota days
anzhb TYPE ptm_quonum, " Balance days
END OF s_2006.
Combined Employee Absence and Quota Structure
TYPES: BEGIN OF s_rep,
pernr TYPE persno, " Personal Number
ktart TYPE abwko, " Absence Quota Type
year(4) TYPE n, " Year
anzhl TYPE ptm_quonum, " Absence Entitlement days
kverb TYPE kverb, " Deduction Quota days
anzhb TYPE ptm_quonum, " Balance days
ktext TYPE kotxt, " Quota Type Text
awart TYPE awart, " Absence Type
abrtg TYPE abrtg, " Absence days
ename TYPE emnam, " employee Name
atext TYPE abwtxt, " Absence Type Text
endda TYPE endda, " End date
begda TYPE begda, " Begin date
END OF s_rep.
Declaration of Variables
DATA : gv_atext TYPE abwtxt, " Absence Type Text
gv_ktext TYPE kotxt, " Absence Type Text
gv_title1 TYPE sylisel, " Report title
gv_year(4) TYPE c, " Year
gv_mon(2) TYPE c, " Month
gv_hrs TYPE abwtg, " Hours
gv_date TYPE sydatum, " Date
gv_date1 TYPE sydatum, " Date
gv_dial. " Color flag
Declaration of Constants
CONSTANTS :
c_x TYPE c VALUE 'X', " Sign
c_1 TYPE persg VALUE '1', " Emp Group
c_pernr(8) TYPE n VALUE '00000000', " Pernr
c_moabw TYPE moabw VALUE '01', " Per SA Grouping
c_mozko TYPE mozko VALUE '01', " Per SA Grouping
c_mopgk TYPE mopgk VALUE '1', " Emp SGrp Grouping
c_endda TYPE sydatum VALUE '99991231', " End Date
c_val1(2) TYPE c VALUE '31', " Date Type
c_val2(2) TYPE c VALUE '12', " Date Type
c_val LIKE p0041-dar01 VALUE '01', " Date Type
c_date1 LIKE sy-datum VALUE '18000101'. " Date
I N T E R N A L T A B L E S D E C L A R A T I O N S
DATA: i_2001 TYPE STANDARD TABLE OF s_2001 WITH HEADER LINE,
i_2006 TYPE STANDARD TABLE OF s_2006 WITH HEADER LINE,
i_rep1 TYPE STANDARD TABLE OF s_2006 WITH HEADER LINE,
i_rep TYPE STANDARD TABLE OF s_rep WITH HEADER LINE.
S E L E C T I O N S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_ktart FOR t556a-ktart, " Absence Quota Type
s_awart FOR t554s-subty. " Absence Type
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) text-003. " Quota & Absence
PARAMETERS: p_qa RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) text-004. " Quota
PARAMETERS: p_q RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) text-005. " Absence
PARAMETERS: p_a RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN END OF BLOCK b2.
I N I T I A L I Z A T I O N *
INITIALIZATION.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN.
Validate the screen fields
PERFORM validate_screen.
S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Selection of Period
PERFORM get_period.
Get PERNR from LDB
GET pernr.
IF p0000-stat2 <> '0'.
Get the data from PA0001,PA2001, PA2006
PERFORM get_pers_data.
ENDIF.
T O P - O F - P A G E *
TOP-OF-PAGE.
Header of the List
PERFORM header.
E N D - O F - P A G E *
Footer
END-OF-PAGE.
IF p_qa = c_x.
Display both Absence and Quota Data
WRITE /1(188) sy-uline.
ELSEIF p_q = c_x.
Display only Quota Data
WRITE /1(114) sy-uline.
ELSEIF p_a = c_x.
Display only Absence Data
WRITE /1(125) sy-uline.
ENDIF.
E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
Combine the Absence and Quota Data
PERFORM append_data.
IF p_qa = c_x.
Display both Absence and Quota Data
PERFORM display_qa_data.
ELSEIF p_q = c_x.
Display only Quota Data
PERFORM display_q_data.
ELSEIF p_a = c_x.
Display only Absence Data
PERFORM display_a_data.
ENDIF.
*& Form validate_screen
Validation of Selection Screen fields
FORM validate_screen .
Validation of Personnel Number
CLEAR pa0003.
IF NOT pnppernr[] IS INITIAL.
SELECT pernr
FROM pa0003 UP TO 1 ROWS
INTO pa0003-pernr
WHERE pernr IN pnppernr.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Personnel Number'(006).
ENDIF.
ENDIF.
Validation of Employee Status
CLEAR t529u.
IF NOT pnpstat2[] IS INITIAL.
SELECT SINGLE statv
INTO t529u-statv
FROM t529u
WHERE statv IN pnpstat2 AND
statn = '2' AND
sprsl = sy-langu.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Invalid Employee Status'(007).
ENDIF.
ENDIF.
Validation of Personnel Area
CLEAR t500p.
IF NOT pnpwerks[] IS INITIAL.
SELECT persa
FROM t500p UP TO 1 ROWS
INTO t500p-persa
WHERE persa IN pnpwerks.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Personnel Area'(008).
ENDIF.
ENDIF.
Validation of Personnel Sub Area
CLEAR t001p.
IF NOT pnpbtrtl[] IS INITIAL.
SELECT btrtl
FROM t001p UP TO 1 ROWS
INTO t001p-btrtl
WHERE btrtl IN pnpbtrtl.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Personnel Sub Area'(009).
ENDIF.
ENDIF.
Validation of Employee Group
CLEAR t501.
IF NOT pnppersg[] IS INITIAL.
SELECT persg
FROM t501 UP TO 1 ROWS
INTO t501-persg
WHERE persg IN pnppersg.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Employee Group'(010).
ENDIF.
ENDIF.
Validation of Employee Sub Group
CLEAR t503k.
IF NOT pnppersk[] IS INITIAL.
SELECT persk
FROM t503k UP TO 1 ROWS
INTO t503k-persk
WHERE persk IN pnppersk.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Employee Sub Group'(011).
ENDIF.
ENDIF.
Validation of Payroll Area
CLEAR t549a.
IF NOT pnpabkrs[] IS INITIAL.
SELECT abkrs
FROM t549a UP TO 1 ROWS
INTO t549a-abkrs
WHERE abkrs IN pnpabkrs.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Employee Payroll Area'(026).
ENDIF.
ENDIF.
Validation of Absence Type
CLEAR t554s.
IF NOT s_awart[] IS INITIAL.
SELECT subty
FROM t554s UP TO 1 ROWS
INTO t554s-subty
WHERE subty IN s_awart AND
moabw EQ c_moabw AND
endda EQ c_endda.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Employee Absence Type'(012).
ENDIF.
ENDIF.
Validation of Absence Quota Type
CLEAR t556a.
IF NOT s_ktart[] IS INITIAL.
SELECT ktart
FROM t556a UP TO 1 ROWS
INTO t556a-ktart
WHERE ktart IN s_ktart AND
mopgk EQ c_mopgk AND
mozko EQ c_mozko AND
endda EQ c_endda.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Incorrect Employee Quota Type'(013).
ENDIF.
ENDIF.
ENDFORM. "validate_screen
*& Form get_period
Get the Correct Period based on Selection screen selection
FORM get_period.
CLEAR: gv_year,gv_mon, gv_date, gv_date1.
gv_year = sy-datum+0(4).
gv_mon = sy-datum+4(2).
IF pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
ELSEIF pnptimr2 = c_x. " Current Month
CONCATENATE gv_year gv_mon c_val INTO gv_date.
CONCATENATE gv_year gv_mon c_val1 INTO gv_date1.
pnpbegda = gv_date.
pnpendda = gv_date1.
ELSEIF pnptimr3 = c_x. " Current Year
CONCATENATE gv_year c_val c_val INTO gv_date.
CONCATENATE gv_year c_val2 c_val1 INTO gv_date1.
pnpbegda = gv_date.
pnpendda = gv_date1.
ELSEIF pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1.
pnpendda = sy-datum.
ELSEIF pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_endda.
ELSE.
IF ( pnpbegda IS INITIAL AND pnpendda IS INITIAL ).
pnpbegda = c_date1.
pnpendda = c_endda.
ELSEIF pnpbegda IS INITIAL AND NOT pnpendda IS INITIAL.
pnpbegda = c_date1.
pnpendda = pnpendda.
ELSEIF NOT ( pnpbegda IS INITIAL AND pnpendda IS INITIAL ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
ENDIF.
ENDIF.
ENDFORM. "get_period
*& Form get_pers_data
Get the Absence and Quota Data from PA0001,PA2001,PA2006
FORM get_pers_data.
DATA: lv_year1(4) TYPE n,
lv_year2(4) TYPE n,
lv_date1 TYPE sydatum,
lv_date2 TYPE sydatum,
lv_anzhb TYPE ptm_quonum. " Last Year Balance days
Get data from Respective Infotypes
rp_provide_from_last p0001 space pnpbegda pnpendda.
Absence Data
LOOP AT p2001 WHERE pernr = pernr-pernr AND
begda GE pnpbegda AND
endda LE pnpendda.
IF p2001-awart IN s_awart.
i_2001-pernr = pernr-pernr.
i_2001-subty = p2001-subty.
i_2001-awart = p2001-awart.
i_2001-abrtg = p2001-abrtg.
i_2001-begda = p2001-begda.
i_2001-endda = p2001-endda.
READ TABLE p0001 WITH KEY pernr = p2001-pernr.
i_2001-ename = p0001-ename.
Get the Absence Type Text
CLEAR gv_atext.
SELECT SINGLE atext INTO gv_atext FROM t554t
WHERE sprsl = sy-langu AND
moabw = c_moabw AND
awart = p2001-awart.
IF sy-subrc = 0.
i_2001-atext = gv_atext.
ENDIF.
APPEND i_2001.
CLEAR i_2001.
ENDIF.
ENDLOOP.
Quota Data
LOOP AT p2006 WHERE pernr = pernr-pernr AND
begda GE pnpbegda AND
endda LE pnpendda.
IF p2006-ktart IN s_ktart.
i_2006-pernr = pernr-pernr.
i_2006-subty = p2006-subty.
i_2006-begda = p2006-begda.
i_2006-endda = p2006-endda.
i_2006-year = p2006-endda+0(4).
i_2006-ktart = p2006-ktart.
i_2006-anzhl = p2006-anzhl.
i_2006-kverb = p2006-kverb.
i_2006-anzhb = p2006-anzhl - p2006-kverb.
READ TABLE p0001 WITH KEY pernr = p2001-pernr.
i_2006-ename = p0001-ename.
Get the Quota Type Text
CLEAR gv_ktext.
SELECT SINGLE ktext INTO gv_ktext FROM t556b
WHERE sprsl = sy-langu AND
mopgk = c_mopgk AND
mozko = c_mozko AND
ktart = p2006-ktart.
IF sy-subrc = 0.
i_2006-ktext = gv_ktext.
ENDIF.
APPEND i_2006.
CLEAR i_2006.
ENDIF.
ENDLOOP.
For Vacation Quota (80) get the Balance of the Last Year and
add to the Current Year Quota
LOOP AT i_2006.
IF i_2006-ktart = '80'.
lv_year1 = i_2006-endda+0(4).
lv_year2 = lv_year1 - 1.
CONCATENATE lv_year2 '01' '01' INTO lv_date1.
CONCATENATE lv_year2 '12' '31' INTO lv_date2.
LOOP AT p2006 WHERE pernr = i_2006-pernr AND
begda GE lv_date1 AND
endda LE lv_date2 AND
ktart = '80'.
lv_anzhb = p2006-anzhl - p2006-kverb.
i_rep1-pernr = i_2006-pernr.
i_rep1-ktext = i_2006-ktext.
i_rep1-anzhl = p2006-anzhl.
i_rep1-kverb = p2006-kverb.
i_rep1-ename = i_2006-ename.
i_rep1-begda = p2006-begda.
i_rep1-endda = p2006-endda.
i_rep1-anzhb = lv_anzhb.
i_rep1-ktart = '80'.
i_rep1-year = lv_year2.
APPEND i_rep1.
CLEAR: i_rep1.
ENDLOOP.
ENDIF.
CLEAR: lv_year1, lv_year2,
lv_date1, lv_date2,lv_anzhb.
ENDLOOP.
SORT i_rep1 BY pernr ktart.
ENDFORM. "get_pers_data
*& Form append_data
Put the Absence and Quota Data into one Report Int Table
FORM append_data.
CLEAR: i_rep.
REFRESH: i_rep.
SORT i_2001 BY pernr awart.
SORT i_2006 BY pernr ktart year.
Move I_REP1 data into i_2006
LOOP AT i_rep1.
MOVE-CORRESPONDING i_rep1 TO i_2006.
APPEND i_2006.
CLEAR i_2006.
ENDLOOP.
Move the Absence and Quota Data into a final Int Table
LOOP AT i_2006.
i_rep-pernr = i_2006-pernr.
i_rep-ename = i_2006-ename.
i_rep-ktart = i_2006-ktart.
i_rep-anzhl = i_2006-anzhl.
i_rep-kverb = i_2006-kverb.
i_rep-ktext = i_2006-ktext.
i_rep-anzhb = i_2006-anzhb.
i_rep-year = i_2006-year.
CLEAR i_2001.
CASE i_2006-ktart.
WHEN '81'.
PERFORM get_2001 USING i_2006-pernr '1000' i_2006-year.
WHEN '50'.
PERFORM get_2001 USING i_2006-pernr '1002' i_2006-year.
WHEN '80'.
PERFORM get_2001 USING i_2006-pernr '1001' i_2006-year.
WHEN '56'.
PERFORM get_2001 USING i_2006-pernr '1003' i_2006-year.
WHEN '51'.
PERFORM get_2001 USING i_2006-pernr '1004' i_2006-year.
WHEN '52'.
PERFORM get_2001 USING i_2006-pernr '1005' i_2006-year.
WHEN '54'.
PERFORM get_2001 USING i_2006-pernr '1006' i_2006-year.
WHEN '53'.
PERFORM get_2001 USING i_2006-pernr '1007' i_2006-year.
WHEN '55'.
PERFORM get_2001 USING i_2006-pernr '1008' i_2006-year.
WHEN '57'.
PERFORM get_2001 USING i_2006-pernr '1009' i_2006-year.
WHEN '90'.
PERFORM get_2001 USING i_2006-pernr '2000' i_2006-year.
WHEN '58'.
PERFORM get_2001 USING i_2006-pernr '2001' i_2006-year.
WHEN '59'.
PERFORM get_2001 USING i_2006-pernr '2002' i_2006-year.
WHEN '91'.
PERFORM get_2001 USING i_2006-pernr '2003' i_2006-year.
ENDCASE.
IF sy-subrc <> 0.
APPEND i_rep.
ENDIF.
CLEAR i_rep.
ENDLOOP.
SORT i_rep BY pernr ktart year.
DELETE i_rep WHERE pernr = ' '.
ENDFORM. " append_data
*& Form display_qa_data
Display the Absence and Quota Data
FORM display_qa_data.
DATA: lv_flag, " New Flag
lv_tot2 TYPE ptm_quonum. " Absence Balance days
IF i_rep[] IS INITIAL.
MESSAGE i000 WITH 'No Data found'(014).
ELSE.
LOOP AT i_rep.
toggle color
PERFORM toggle_color.
IF lv_flag <> space.
NEW-LINE.
ENDIF.
AT NEW pernr.
READ TABLE i_rep INDEX sy-tabix.
WRITE:/1 sy-vline,2(8) i_rep-pernr,
10 sy-vline,11(40) i_rep-ename.
ENDAT.
AT NEW ktart.
READ TABLE i_rep INDEX sy-tabix.
WRITE: 1 sy-vline, 10 sy-vline,
51 sy-vline,52(25) i_rep-ktext.
ENDAT.
AT NEW year.
READ TABLE i_rep INDEX sy-tabix.
WRITE: 1 sy-vline, 10 sy-vline,
51 sy-vline,
77 sy-vline, 78(4) i_rep-year,
82 sy-vline, 83(11) i_rep-anzhl,
94 sy-vline, 95(25) i_rep-atext,
120 sy-vline,133 sy-vline,
144 sy-vline,
155 sy-vline,156(13) i_rep-anzhb,
169 sy-vline.
lv_tot2 = lv_tot2 + i_rep-anzhb.
ENDAT.
WRITE: 1 sy-vline, 10 sy-vline,
51 sy-vline, 77 sy-vline,
82 sy-vline, 94 sy-vline,
120 sy-vline,121(12) i_rep-abrtg NO-ZERO,
133 sy-vline,134(10) i_rep-begda NO-ZERO,
144 sy-vline,145(10) i_rep-endda NO-ZERO,
155 sy-vline,169 sy-vline.
NEW-LINE.
AT END OF pernr.
WRITE : /1(169) sy-uline.
SUM.
FORMAT COLOR 3.
WRITE:/1 sy-vline, 10 sy-vline,
51 sy-vline, 77 sy-vline,
82 sy-vline, 94 sy-vline,
120 sy-vline,121(12) i_rep-abrtg,
133 sy-vline,144 sy-vline,
155 sy-vline, 156(13) lv_tot2,
169 sy-vline.
FORMAT COLOR OFF.
WRITE : /1(169) sy-uline.
CLEAR lv_tot2.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " display_qa_data
*& Form display_q_data
Display only the Quota Data
FORM display_q_data.
DATA: lv_flag. " New Flag
SORT i_2006 BY pernr ktart year.
IF i_2006[] IS INITIAL.
MESSAGE i000 WITH 'No Data found'(014).
ELSE.
LOOP AT i_2006.
Toggle Color
PERFORM toggle_color.
IF lv_flag <> space.
NEW-LINE.
ENDIF.
AT NEW pernr.
READ TABLE i_2006 INDEX sy-tabix.
WRITE: /1 sy-vline, 2(8) i_2006-pernr,
10 sy-vline,11(40) i_2006-ename.
ENDAT.
AT NEW ktart.
READ TABLE i_2006 INDEX sy-tabix.
WRITE: 1 sy-vline,10 sy-vline,
51 sy-vline,52(25) i_2006-ktext.
ENDAT.
AT NEW year.
READ TABLE i_2006 INDEX sy-tabix.
WRITE: 1 sy-vline, 10 sy-vline,
51 sy-vline,
77 sy-vline,78(4) i_2006-year,
82 sy-vline,83(11) i_2006-anzhl,
94 sy-vline,95(13) i_2006-anzhb,
108 sy-vline.
NEW-LINE.
ENDAT.
AT END OF pernr.
WRITE : /1(108) sy-uline.
SUM.
FORMAT COLOR 3.
WRITE: /1 sy-vline, 10 sy-vline,
51 sy-vline,
77 sy-vline, 82 sy-vline,
94 sy-vline, 95(13) i_2006-anzhb,
108 sy-vline.
FORMAT COLOR OFF.
WRITE : /1(108) sy-uline.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " display_q_data
*& Form display_a_data
Display Only the Absence Quota
FORM display_a_data.
DATA: lv_flag. " New Flag
SORT i_2001 BY pernr awart.
IF i_2001[] IS INITIAL.
MESSAGE i000 WITH 'No Data found'(014).
ELSE.
LOOP AT i_2001.
Toggle Color
PERFORM toggle_color.
IF lv_flag <> space.
NEW-LINE.
ENDIF.
AT NEW pernr.
READ TABLE i_2001 INDEX sy-tabix.
WRITE: /1 sy-vline, 2(10) i_2001-pernr,
10 sy-vline,11(40) i_2001-ename.
ENDAT.
WRITE: 1 sy-vline, 10 sy-vline,
51 sy-vline,52(25) i_2001-atext,
77 sy-vline,78(12) i_2001-abrtg,
90 sy-vline,91(10) i_2001-begda,
101 sy-vline,102(10) i_2001-endda,
112 sy-vline.
NEW-LINE.
AT END OF pernr.
WRITE : /1(112) sy-uline.
SUM.
FORMAT COLOR 3.
WRITE: /1 sy-vline, 10 sy-vline,
51 sy-vline,
77 sy-vline,78(12) i_2001-abrtg,
90 sy-vline,101 sy-vline,
112 sy-vline.
FORMAT COLOR OFF.
WRITE : /1(112) sy-uline.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " display_a_data
*& Form header
Write the Report Header
FORM header .
data : lv_pers type pbtxt,
lv_orgn type orgtx.
gv_title1 = sy-title. " Set List Header
IF p_qa = c_x.
NEW-PAGE LINE-SIZE 193.
ELSEIF p_a = c_x.
NEW-PAGE LINE-SIZE 125.
ELSEIF p_q = c_x.
NEW-PAGE LINE-SIZE 119.
ENDIF.
Standard header
FORMAT RESET.
CALL FUNCTION 'Z_STANDARD_HEADER'
EXPORTING
title1 = gv_title1.
Get the Personal Area and Org.Unit Texts
clear : lv_pers,lv_orgn.
select single name1 into lv_pers
from t500p where persa = pnpwerks-low.
select single orgtx into lv_orgn
from t527x where sprsl = sy-langu and
orgeh = pnporgeh-low and
endda = c_endda.
if not lv_pers is initial.
write : /2 'Personal Area:'(017), 17(25) lv_pers color 7.
endif.
if not lv_orgn is initial.
write : /2 'Organization Unit:'(021), 20(25) lv_orgn color 3.
endif.
IF p_qa = c_x.
FORMAT COLOR COL_HEADING.
WRITE : /1(169) sy-uline.
WRITE:/1 sy-vline,2(8) 'Emp.No'(015) CENTERED,
10 sy-vline,11(40) 'Employee Name'(016) CENTERED,
51 sy-vline,52(25) 'Quota Description'(018) CENTERED,
77 sy-vline,78(4) 'Year'(027),
82 sy-vline,83(11) 'Entitlement'(019),
94 sy-vline,95(25) 'Absence Description'(022) CENTERED,
120 sy-vline,121(12) 'Absence days'(023),
133 sy-vline,134(10) 'From Date'(024),
144 sy-vline,145(10) 'To Date'(025),
155 sy-vline,156(13) 'Quota Balance'(020),
169 sy-vline.
WRITE : /1(169) sy-uline.
ELSEIF p_q = c_x.
FORMAT COLOR COL_HEADING.
WRITE : /1(108) sy-uline.
WRITE:/1 sy-vline,2(8) 'Emp.No'(015) CENTERED,
10 sy-vline,11(40) 'Employee Name'(016) CENTERED,
51 sy-vline,52(25) 'Quota Description'(018) CENTERED,
77 sy-vline,78(4) 'Year'(027),
82 sy-vline,83(11) 'Entitlement'(019),
94 sy-vline,95(13) 'Quota Balance'(020),
108 sy-vline.
WRITE : /1(108) sy-uline.
ELSEIF p_a = c_x.
FORMAT COLOR COL_HEADING.
WRITE : /1(112) sy-uline.
WRITE:/1 sy-vline,2(8) 'Emp.No'(015) CENTERED,
10 sy-vline,11(40) 'Employee Name'(016) CENTERED,
51 sy-vline,52(25) 'Absence Description'(022) CENTERED,
77 sy-vline,78(12) 'Absence days'(023),
90 sy-vline,91(10) 'From Date'(024),
101 sy-vline,102(10) 'To Date'(025),
112 sy-vline.
WRITE : /1(112) sy-uline.
ENDIF.
ENDFORM. " header
*& Form toggle_color
This routine alters the color of the records in the list
FORM toggle_color.
IF gv_dial = space.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
gv_dial = c_x.
ELSE.
FORMAT COLOR 1 INTENSIFIED OFF.
CLEAR gv_dial.
ENDIF.
ENDFORM. " toggle_color
*& Form get_2001
Get the ABsence type for each Quota type
FORM get_2001 USING p_pernr TYPE persno
p_value TYPE awart
p_year.
LOOP AT i_2001 WHERE pernr = p_pernr AND
awart = p_value AND
endda+0(4) = p_year.
i_rep-awart = i_2001-awart.
i_rep-abrtg = i_2001-abrtg.
i_rep-atext = i_2001-atext.
i_rep-begda = i_2001-begda.
i_rep-endda = i_2001-endda.
APPEND i_rep.
ENDLOOP.
ENDFORM. " get_2001
<b>Reward points for useful Answers</b>
Regards
Anji -
Pass data to JSP from HTML?
I can pass the data in a HTML form without problem if the form is in the same jsp file. I have no problem to pass data from one jsp file to another one. But when the jsp file has to take the data passed from calling HTML file and has to receive the data from the same jsp file, then the data from other HTML file will be null the first time runing the code, then second time will be passed right. If I shut down computer run the code again, same problem until the second time. Please tell me why if any of you know!
yes. The first part is HTML file which use the form to pass v_progname, the second part is a jsp file, it suppose to get the data in v_prgname, but the first time to run this code always get null, then the second time get the right data?
<html> <head> <title>CTI</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> </head>
<body bgcolor="#FFFFFF"> <form name="theForm" enctype="text/html" method="post"
action="http://titan.ssd.loral.com:7778/ifs/jsp-bin/ifs-cts/jsps/uploadfilehome.jsp">
<table border="1" cellspacing="0" cellpadding="4">
<tr> <td bgcolor="#FFFFEE"><font face="Arial, Helvetica,sans-serif" size="2"> Communication racking Item </font></td> <td colspan="5"><font face="Arial, Helvetica, sans-serif"size="2">SATMEX-6-2 </td>
<input type="hidden" name="v_sidname"value="/expctl/dev//comm_tracking.edit_document">
<input type="hidden" name="v_schema"value="migra2">
<input type="hidden" name="v_cti_number"value="SATMEX-6-2">
<input type="hidden" name="v_progname"value="satmex-8">
<input type="hidden" name="v_doc_id"value="5131"> </tr> </table><br>
<input type="submit" value="Upload Document">
<input type="reset" value="Reset"></form></body></html>
uploadfilehome.jsp as following:
<html><head>
<%
String v_program=request.getParameter("v_progname");//this is the parameter passed from html file, //with a problem?
WebUILogin login = WebUILogin.getWebUILogin( request );
String step = WebUIUtils.getUTF8Parameter(request,"step");
//String path=WebUIUtils.getUTF8Parameter(request,"path");
String path="/home/scott/satmex-6";
String windowID=WebUIUtils.getNewWindowID();
%>
<SCRIPT LANGUAGE="JavaScript1.2">
var path="<%=path%>";
var jsWindowID="<%=windowID%>";
</script>
<%
if ( null == step )
step = "get";
%>
<SCRIPT LANGUAGE="JavaScript">
function AutoLogin() {
document.loginform.userName.value == "scott";
document.loginform.passWord.value == "tiger";
document.loginform.submit();
function PkeyPress(event)
if (document.layers)
if (event.which==13)
document.loginform.submit();
else {
if (window.event.keyCode==13)
document.loginform.submit();
</SCRIPT>
<%
if ( step.equals("try") )
login.processRequest(request);
%>
<SCRIPT LANGUAGE="JavaScript1.2">
window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
</script>
<%
// check to see if we have already logged in before...
if ( null != login.getSession() )
%>
<SCRIPT LANGUAGE="JavaScript1.2">
window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
</script>
<%
else
%>
<title><%=login.getJspResourceString(JspResourcesID.LOGIN_TITLE)%></title>
</head>
<body bgcolor="#FFFFFF" onLoad="AutoLogin();" onResize="return false;">
<form METHOD=POST NAME="loginform" ACTION="uploadfilehome.jsp">
<INPUT TYPE="hidden" NAME="userName" VALUE="scott">
<INPUT TYPE="hidden" NAME="passWord" VALUE="tiger" onKeyPress="PkeyPress(event);">
<INPUT TYPE="hidden" NAME="step" VALUE="try">
<INPUT TYPE="hidden" NAME="action" VALUE="Login">
</form>
</body>
</html>
<%
%> -
Extract Created-Property from Office Documents
Hello,
i want to show the created-property of Office Documents in the search result list.
KM only extracts Title, modified, modifiedby.
So i followed the document "How to extract DC metadata from office documents for indexing and searching.pdf". But here only the following metadata are extracted:
title, personalname, description, subject, keyword.
How can i extract "created"?
thanks in advance!
Kind regards
SvenHi Sven,
I'm confused. The Properties "title","modified" and "modified" by you see in the KM-Explorer are normally the KM-properties (who uploaded the file and when), not internal MSOffice information.
To extend the list of properties displayed,
go to SyAdm->SysConf->KM->CM->UI->Settings->LayoutSet look for your LayoutSet (probably its AdminExplorer). Select the CollectionListRenderer and edit the String in "Displayed Properties:". Add ",created" at the end for example.
Is this what you need?
When it comes to read MSOffice metadata from the binary, I have no idea, sorry.
Jan -
Extraction Key Frames from a video
Hi all,
I would like to know what is the best way to extract keyframe from a video.
My Status (butr I can cahnge it)
I'm Marco and I'm using JMF; I need for an help because I don't know how to extract keyframes from AVI and MPG files.
I'm using the code posted in this forum for extracting all frame in a video with the adding of an if expression that in the accessFrame method that I report below:
void accessFrame(Buffer frame) {
BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
Image stopImage = stopBuffer.createImage(frame);
try {
BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
Graphics og = outImage.getGraphics();
og.drawImage(stopImage, 0, 0, size.width, size.height, null);
Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
ImageWriter writer = (ImageWriter) writers.next();
File f = new File(frame.getSequenceNumber() + ".jpg");
if ((frame.getFlags() & Buffer.FLAG_KEY_FRAME) != 0){{color}
{color:#ff9900}
ImageOutputStream ios = ImageIO.createImageOutputStream(f);
writer.setOutput(ios);
{color:#ff9900}
writer.write(outImage);
ios.close();}
} catch (IOException e) {{color}
System.out.println("Error :" + e);
So, I'm able to extract some keyframe, but i'm not sure it is the correct way and my dubt grows out of the fact that without the if expression highlighted in red, it seems that I have more keyframes (those ones with flag ==1040). Another problem is that it works only with AVI because MPG instead of 1040, they have alternate sequence of 32 and 1056.
Cheers and thank u
Marco>
With the code yoodleyee posted, frames can be extracted and converted from the raw decoded format into images, but no guarantee that the frame extracted is a key frame, isnt it?Actually, there is such a guarantee...because the FrameGrabbingControl isn't implemented in any video format that uses keyframes. So, if it works, then every frame of the video is a keyframe, and it won't work otherwise.
How can key frames be detected with JMF and then extracted with the code provided? Any tutorial or sample code about that?They can't be. You can write a custom codec that will give you access to every frame, regardless of the format, if you're wanting to get all of the frames.
Example: [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/FrameAccess.html]
But JMF doesn't have any way of dealing with key frames directly, at least that I am aware of.
Maybe you are looking for
-
Hi , I have installed Oracle9i and setup a database and everything is working fine in the English version, but when I install the same French version (oracle 9.0.1) alot of the features are in English. For those of you familiar with the help section
-
Greetings, Have a pair of Netra T2000's (8 cores, 8GB RAM) running Solaris 10 5/09 and the latest LDOM's software. Both servers have been upgraded to the latest firmware in attempt to resolve these problems (didn't help) Problem 1 - host msclab35 I u
-
PR (ME51n) enhancement for F4 help on Tracking no (BEDNR)
Hi all, I need to do an enhancement on PR ME51n to incorporate F4 help on Tracking number (BEDNR) in the Item Table. I think i have to change the fieldcatalog for the ALV. I cannot figure out how to do that. Any help would be greatly appreciated. Tha
-
I'm running v1 of TCS on a Dell Optiplex 755 w/4GB RAM. When I run RoboHelp Packager for AIR on any output, repeat "any output," after I review the output and exit the packager, I get a BSoD. This is dependable and replicable...10 times so far today
-
Property Inspector missing sprites tab. (Dir 11.5, OSX 10.8)
Property Inspector showing only Behaviors tab in Dir 11.5 and OSX 10.8.2. PI had tabs for Sprite, Behavior, Filter, Member etc in OSX 10.6.8 (and B4). How do I get those tabs back?