Getting links and its names from a html file
Hi everyone
My problem about the a getting links with name from a html file. For example
İn a web page in this site ?SUN? when use click SUN the browser open http://java.sun.com
İ want both of them, so the links and name. I can succeeded the get link but i don t know how to get the link name.
For example :
<B>setRightComponent(Component)</B>
İn this code segment i want to get B tag. But how i don t know. To get A tag i used this code
List result = new ArrayList();
try {
// Create a reader on the HTML content
URL url = new URI(uriStr).toURL();
URLConnection conn = url.openConnection();
Reader rd = new InputStreamReader(conn.getInputStream());
// Parse the HTML
EditorKit kit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument)kit.createDefaultDocument();
kit.read(rd, doc, 0);
// Find all the A elements in the HTML document
HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
while (it.isValid()) {
SimpleAttributeSet s = (SimpleAttributeSet)it.getAttributes();
String link = (String)s.getAttribute(HTML.Attribute.HREF);
if (link != null) {
result.add(link);
it.next();
İ can use B tag but i don t know hot to get its value because it has no prefix such as HREF....
i am sorry if i use a bad explanation style or incorrect word.
import java.io.*;
import java.net.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
class GetLinks
public static void main(String[] args)
throws Exception
// Create a reader on the HTML content
Reader reader = getReader( args[0] );
// Parse the HTML
EditorKit kit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument)kit.createDefaultDocument();
doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
kit.read(reader, doc, 0);
// Find all the A elements in the HTML document
HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
while (it.isValid())
SimpleAttributeSet s = (SimpleAttributeSet)it.getAttributes();
String href = (String)s.getAttribute(HTML.Attribute.HREF);
int start = it.getStartOffset();
int end = it.getEndOffset();
String text = doc.getText(start, end - start);
System.out.println( href + " : " + text );
it.next();
// If 'uri' begins with "http:" treat as a URL,
// otherwise, treat as a local file.
static Reader getReader(String uri)
throws IOException
// Retrieve from Internet.
if (uri.startsWith("http:"))
URLConnection conn = new URL(uri).openConnection();
return new InputStreamReader(conn.getInputStream());
// Retrieve from file.
else
return new FileReader(uri);
}
Similar Messages
-
How to get nodes and its attributes of an XML file usiong DOM parsing?
how to get nodes and its attributes of an XML file usiong DOM parsing?
i am new to XML parsing.......
Thanking you........import org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException; ...
//Setup the document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
//get elemets by name
String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
//This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data. -
How to find the tablespace name and schema name from a dump file
Good day to all,
I recived a dump file from a client with oracle 11g, and I need do get the tablespace and schema name from the dump file. How can I do that?
Thanks.
Flávio Melo
Edited by: 933141 on 09/05/2012 07:41user12038066 wrote:
Use imp utility, it generates DDL for both tables and indexes. So you will get tablespace info for both.
Use impdp utility, it generates DDL for indexes only. So you will miss tablesapce info for tables.
Haven't found a workaround for impdp utility. Anyone knows?Are you sure you are using the impdp utility correctly? Because if you do, then sqlfile should have all gory details. -
Open in same window and clean cache from swf + html file generate with InDesign CS5
Hi,
1)
I have a Indesign web file exported to swf + html.
In my document I have a button that point to url (this url is html file of a second Indesign swf + html).
When I click on button, the url was find an open in another window.
Is it possible to open this second url in the same window?
If yes How.
I think this information is in the swf file and not in html.(How modify the swf code?)
2)
How to clean the cache when you reload the url? (in the html generate file)
I'will very please if somebody of you could help me. it's Important for me.
Regards
PhilippeOkay, I found the code but I can't get it to work locally. If you have a web server maybe you can upload the files (swf and html) after you Publish them:
import flash.net.URLRequest;
import flash.events.MouseEvent;
var myURL:URLRequest = new URLRequest ("http://www.google.com");
testlink.addEventListener(MouseEvent.CLICK, clickText);
function clickText(myevent:MouseEvent):void {
navigateToURL(myURL, "_self");
you have to have on the stage a link element called "testlink" (see the code above) which would be a Movie Clip with the label testlink. It can be anything from InDesign: a button, a rectangle, a circle, a graphic, you get the idea. Just select that object in Flash and label it testlink or anything you choose but if you change the name from testlink also change the name in the code snippet where the line "addEventListener" is. -
How to get the actual font name from a font file?
Hi
I have only the font Path I have to get the font name from that path. Any idea how to get the actual font name?
Thanks,I would ask you these questions:
Why do you need to do this? What are you ultimately trying to accomplish?
Are you really asking about the InDesign SDK?
Do you really need to get the "name" of a font from an arbitrary file? Or do you want information about a font installed on the system? If so, what OS?
Do you need to be able to handle any font format?
Which font "name" do you mean?
What language do you want the name in?
(1) It's not clear what you're trying to accomplish. A bit more information about your ultimate goal would be helpful.
(2) This question is not at all specific to the InDesign SDK. Are you really trying to do something in the context of an InDesign plug-in? If so, you probably want to look at IID_IFONTFAMILY and the IFontFamily::GetFamilyName function.
(3) If you are asking more generally, Windows and Mac both have system API calls to get this information, although those tend to deal with installed system fonts, not with arbitrary font files per se.
Also, you can parse the name table from a True Type or Open Type font without using any system APIs; as True Type and Open Type are well-documented standards. I would start by reading these:
The Naming Table
Font Names Table
(4) Although there are other standards, such as Type 1 (PostScript) fonts, and True Type Collection files and other formats, especially on Mac.
(5) Also, when you start down this road, you will quickly realize that your seemingly simple question is actually ambiguous, and that the answer is kind of complicated, because a font can have many names (a family name, a full font name, a style name, a PostScript name, etc.).
(6) And not only does a font have multiple names, it can have each of those names in multiple languages and encodings.
Any clarification would make this a better question. -
How to get Driver and url names from a connection pool
Hi,
How to get the DriverName and URL from an existing pool, If I know the name of
connection pool ? Is it possible to know the name of related pool , if I know
the name of datasource?
Thx
Manishhi
there are 2 ways:
url must be: jdbc:weblogic:pool[:connectionPoolID]
or
jdbc:weblogic:jts[:connectionPoolID] (if you want to use jts with your JDBC connection.)
see http://e-docs.bea.com/wls/docs60//javadocs/weblogic/jdbc/pool/Driver.html
However, I think it is safer to configure and use DataSource to get connection.
Nicolas
"kumar" <[email protected]> wrote:
>
Hi,
How to get the DriverName and URL from an existing pool, If I know the name
of
connection pool ? Is it possible to know the name of related pool , if I
know
the name of datasource?
Thx
Manish -
I'm creating a SSRS report using SSAS cube as a source.
When creating a dataset for the report, I'm having trouble with MDX to select a specific dimension member and its descendants from parent child dimension where dimension member names can be same in dimension hierarchy.
Lets say for example that I have an account dimension where,
In level 02 I have company ID:s 101, 102, 103 and so on...
In level 03 I have Balance sheet
In level 04 I have some account groups, Assets, Liabilities and so on... and In level 05 I have individual accounts
How can I select for example company 102:s Assets from level 04 and its descendants?
Normally in adventure works I would do this if I've wanted Current Assets and its descendants:
SELECT NON EMPTY { [Measures].[Amount] } ON COLUMNS, NON EMPTY
{ (DESCENDANTS([Account].[Accounts].[Account Level 03].[Current Assets]) ) } ON ROWS
FROM [Adventure Works]
But in my Account dimension at level 04 I have Assets member as many times as I have companies in level 02.
TuomoHi Tuomo Helminen,
To this requirement of yours, I would recommend you use Cascading Parameters in Reporting services, you can refer to this FAQ How do I create cascading parameters when using cube database in Reporting Services at this link
http://blogs.msdn.com/b/sqlforum/archive/2011/04/11/forum-faq-how-do-i-create-cascading-parameters-when-using-cube-database-in-reporting-services.aspx
Thanks,
Challen Fu
TechNet
Subscriber Supportinforum
If you have any feedback on our support, please [email protected]
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4.
jatpri1730 wrote:
I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4.
Unfortunately, AT&T does not provide unlocking.
Stedman -
SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007
Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!
Refer
http://gallery.technet.microsoft.com/projectserver/Server-20072010-SQL-Get-a99d4bc6
SELECT
dbo.MSP_EpmAssignment_UserView.ProjectUID,
dbo.MSP_EpmAssignment_UserView.TaskUID,
dbo.MSP_EpmProject_UserView.ProjectName,
dbo.MSP_EpmTask_UserView.TaskName,
dbo.MSP_EpmAssignment_UserView.ResourceUID,
dbo.MSP_EpmResource_UserView.ResourceName,
dbo.MSP_EpmResource_UserView.ResourceInitials
INTO #TempTable
FROM dbo.MSP_EpmAssignment_UserView INNER JOIN
dbo.MSP_EpmProject_UserView ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID INNER JOIN
dbo.MSP_EpmTask_UserView ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID INNER JOIN
dbo.MSP_EpmResource_UserView ON dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID
SELECT
ProjectUID,
TaskUID,
ProjectName,
TaskName,
STUFF((
SELECT ', ' + ResourceInitials
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceInitialsCombined,
STUFF((
SELECT ', ' + ResourceName
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceNameCombined
FROM #TempTable Results
GROUP BY TaskUID,ProjectUID,ProjectName,TaskName
DROP TABLE #TempTable
-Prashanth -
Get jms queue and topic names from JNDI
Hello all,
How do I get all possible queue and Topic names from JNDI (in my app) so I can store them in a HashMap?
ThanksI'm guessing you know where in the JNDI you put your queue and topic names. Then you can do:
context.listBindings("myJNDIContext");
and go through the NamingEnumeration that this returns. -
How to get the Portal Page name from PLSQL?
Can anyone tell me how to get the portal page name from my dynamic page using plsql?
Apparently you can get the page id and work it out from there, but my calls to get the page id are not returning any values anyway.
My code for attempting to get the page id is below.
<oracle>
declare
v_pageid varchar2(30);
begin
v_pageid := wwpro_api_parameters.get_value('_pageid', '/pls/portal30');
htp.print('Page is '|| v_pageid);
end;
</oracle>
Ideally I'd actually just like to get the page name. Is there a straightforward way to do this?
Thanks in advance!
SarahFew clarifications -
1. wwpro_api_parameters cannot be used to get default portal
page parameters such as '_pageid', '_dad', '_schema' etc.,
2. Page information can be obtained through any components which
are available in that particular page. For example, in case of
dynamic page, we need to publish it as a portlet and add it to the
page. This process creates necessary packages in the DB, but we
will not have access to the portlet methods.
So, I would prefer creating a simple DB provider & portlet and access
page title from its show method as follows -
//Declare local variable l_page_id, l_page_title as varchar2
select page_id into l_page_id from wwpob_portlet_instance$ where
portlet_id = p_portlet_record.portlet_id and
provider_id = p_portlet_record.provider_id;
select name into l_page_title from wwpob_page$ where id=l_page_id;
More information on DB provider can be found at
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/understanding.database.providers.html
Secondly, usage of wwpro_api_parameters.get_value method is
incorrect. This method expects two arguments -
<ul>
<li><b>p_name : </b> The name of the parameter to be returned.</li>
<li><b>p_reference_path : </b> An unique identifier for a portlet instance on the current page.</li>
</ul>
p_reference_path would be something like 99_SNOOP_PORTLET_76535103 and not some type of path as its name suggests.
The following code fragment fetches all parameters available
for a portlet.
Note : Copy this code into 'show' method of your portlet.
//Declare l_names, l_values as owa.vc_arr
* Retreive all of the names of parameters for this portlet
l_names := wwpro_api_parameters.get_names(
p_reference_path=>p_portlet_record.reference_path);
* Retreive all of the values of parameters for this portlet
l_values := wwpro_api_parameters.get_values(p_names=>l_names,
p_reference_path=>p_portlet_record.reference_path);
//Loop through these arrays to get parameter information
htp.p('<center><table BORDER COLS=2 WIDTH="90%" >');
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.tableData(wwui_api_portlet.portlet_heading('Name',1));
htp.tableData(wwui_api_portlet.portlet_heading('Value',1));
htp.tableRowClose;
if l_names.count = 0 then
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.p('<td COLSPAN="2">'
||wwui_api_portlet.portlet_text(
'No portlet parameters were passed on the URL.',1)
||'</td>');
htp.tableRowClose;
else
for i in 1..l_names.count loop
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.tableData(l_names(i));
htp.tableData(l_values(i));
htp.tableRowClose;
end loop;
end if;
htp.p('</table></center>');
Hope it helps...
-aMJAD. -
Hello Experts,
I follow the flightbooking tutorial to create a Material application to get material list. I can start the agentry server but when I connect to SAP server and get data, I face below issue
Error in getting the BAPIWrapper name from the ini file or SAP mobile configuration. Please check the ini file or the mobile configuration for the bapi key (com.syclo.sap.material.bapi.materialbapi) either in sections BAPI_WRAPPER or REQUIRED_BAPI_WRAPPER
I check the parameters name in SAP Agentry Config panel, all are correct. Why cannt it get the data. Do I have to add anything in javaBE.ini? Please help me. Thank you very much.
My javaBE
[HOST]
server=be1.vdc.csc.com
APPNAME=ZCH_MATERIALLIST
[CLIENT_NUM]
CLIENT=800
[SYSTEM_NUM]
SYSNUM=01
[LOGON_METHOD]
; USER_AUTH if standard UID/Password authentication is used
; USER_AUTH_GLOBAL if pooled connections using single UID/Password is used
; USER_AUTH_GROUP if UID/Password authentication with SAP Message Server
; (load balancing) is used
LOGON_METHOD=USER_AUTH
[GLOBAL_LOGON]
; referenced when LOGON_METHOD=USER_AUTH_GLOBAL
; uses a pool of connections to the SAP backend all utilizing a single
; UID/password
UID=
UPASSWORD=
SHAREDCONNECTION=0
GET_PERSONNEL_INFO=
[SERVICE_LOGON]
ENABLED=true
UID=hngu3
UPASSWORD=xxxxxxx
UPASSWORDENCODED=false
[GROUP_LOGON]
; referenced when LOGON_METHOD=USER_AUTH_GROUP
; individual user authentication using an SAP Message Server which distributes
; client connections among a "group" of SAP application servers based on load
; balancing criteria
; host name or IP address of SAP Message Server
MESSAGE_SERVER=
GROUP_NAME=
SYSTEM_ID=
CLIENT=
[LANGUAGE]
LANG=EN
[LOGGING]
Level=4
[REQUIRED_BAPI_WRAPPER]
com.syclo.sap.bapi.LoginCheckBAPI=/SYCLO/CORE_SUSR_LOGIN_CHECK
com.syclo.sap.bapi.RemoteUserCreateBAPI=/SYCLO/CORE_MDW_SESSION1_CRT
com.syclo.sap.bapi.RemoteParameterGetBAPI=/SYCLO/CORE_MDW_PARAMETER_GET
com.syclo.sap.bapi.SystemInfoBAPI=/SYCLO/CORE_SYSTINFO_GET
com.syclo.sap.bapi.ChangePasswordBAPI=/SYCLO/CORE_SUSR_CHANGE_PASSWD
com.syclo.sap.bapi.CTConfirmationBAPI=/SYCLO/CORE_OUTB_MSG_STAT_UPD
com.syclo.sap.bapi.DTBAPI=/SYCLO/CORE_DT_GET
com.syclo.sap.bapi.GetEmployeeDataBAPI=/SYCLO/HR_EMPLOYEE_DATA_GET
com.syclo.sap.bapi.GetUserDetailBAPI=/SYCLO/CORE_USER_GET_DETAIL
com.syclo.sap.bapi.GetUserProfileDataBAPI=/SYCLO/CORE_USER_PROFILE_GET
com.syclo.sap.bapi.PushStatusUpdateBAPI=/SYCLO/CORE_PUSH_STAT_UPD
com.syclo.sap.bapi.RemoteObjectCreateBAPI=/SYCLO/CORE_MDW_USR_OBJ_CRT
com.syclo.sap.bapi.RemoteObjectDeleteBAPI=/SYCLO/CORE_MDW_USR_OBJ_DEL
com.syclo.sap.bapi.RemoteObjectGetBAPI=/SYCLO/CORE_MDW_SESSION_GET
com.syclo.sap.bapi.RemoteObjectUpdateBAPI=/SYCLO/CORE_MDW_SESSION_UPD
com.syclo.sap.bapi.RemoteReferenceCreateBAPI=/SYCLO/CORE_MDW_USR_KEYMAP_CRT
com.syclo.sap.bapi.RemoteReferenceDeleteBAPI=/SYCLO/CORE_MDW_USR_KEYMAP_DEL
com.syclo.sap.bapi.RemoteReferenceGetBAPI=/SYCLO/CORE_MDW_SESSION_GET
com.syclo.sap.bapi.RemoteReferenceUpdateBAPI=/SYCLO/CORE_MDW_SESSION_UPD
com.syclo.sap.bapi.RemoteSessionDeleteBAPI=/SYCLO/CORE_MDW_SESSION1_DEL
com.syclo.sap.bapi.RemoteUserDeleteBAPI=/SYCLO/CORE_MDW_SESSION1_DEL
com.syclo.sap.bapi.RemoteUserUpdateBAPI=/SYCLO/CORE_MDW_SESSION_UPD
com.syclo.sap.bapi.TransactionCommitBAPI=WFD_TRANSACTION_COMMIT
com.syclo.sap.bapi.SignatureCaptureBAPI=/SYCLO/CS_DOBDSDOCUMENT_CRTHi Tahir, please help me check the log below
Agentry Runtime Worker Thread###throwExceptionToClient::begin |
Agentry Runtime Worker Thread###throwExceptionToClient::com.syclo.sap.material.steplet.MaterialSteplet::throwExceptionToClient::397::MaterialSteplet - Error in getting the BAPIWrapper name from the ini file or SAP mobile configuration. Please check the ini file or the mobile configuration for the bapi key (com.syclo.sap.material.bapi.materialbapi) either in sections BAPI_WRAPPER or REQUIRED_BAPI_WRAPPER |
Agentry Runtime Worker Thread###Exception: 17:15:35 06/17/2014 : 20 (Agentry3), Java Business Logic Error (com.syclo.agentry.BusinessLogicException: MaterialSteplet - Error in getting the BAPIWrapper name from the ini file or SAP mobile configuration. Please check the ini file or the mobile configuration for the bapi key (com.syclo.sap.material.bapi.materialbapi) either in sections BAPI_WRAPPER or REQUIRED_BAPI_WRAPPER), |
Agentry Runtime Worker Thread###loggedOut::begin |
Agentry Runtime Worker Thread###HNGU3: SESSION END |
Agentry Runtime Worker Thread###BAPI::begin |
Agentry Runtime Worker Thread###create::nulled repository::created new repository |
Agentry Runtime Worker Thread###create::/SYCLO/CORE_MDW_SESSION1_DEL Connection ID: com.sap.mw.jco.JCO$Client@2656ed99 |
Agentry Runtime Worker Thread###create::Function /SYCLO/CORE_MDW_SESSION1_DEL created | -
I have Iphone 4 and its lock from at
I have Iphone 4 and its lock from at&t, but my contract is getting over in short time. And no longer i want to use this service. So after contract gets over its my right to get factory unlock my iphone 4.
" So after contract gets over its my right to get factory unlock my iphone 4."
It is not a right at all.
As provided, AT&T does not unlock iphones at all. -
How Adobe gets DATE and its format?
Hello,
I am getting current (todays) date by using below JS in some flds, and by using below FormCalc for some flds into my_form,
JS:
var currentTime = new Date()
Form Calc:
$.rawValue = num2date(date(), DateFmt(MM/DD/YYYY))
But, i dont have much idea that how adobe is getting this date? For my company this is the very first form, hence they are asking me how adobe gets date and its format whether,
1) From local IP/Interner provider address's date, format?
2) or user PC/laptop's LOCAL settings date, format? if so, for example, if Germany user (Laptop settings) has a DD.MM.YYYY configured, if this user comes to US on a busines trip and if that user opens the form, then how the date looks like for this user? as per user laptop settings DD.MM.YYYY or local internat provider date format MM//DD//YYYY?
Thank youHi,
the date() function returns the number of days since 01.01.1900 for the local date of the current system (related to the system clock of the OS).
If you travel from Germany to the US but don't update your date/time settings, then it returns the same date in the US as in Germany.
You can check the behavior by changing your local date/time setting or the timezones. -
Want to get the Client Machine name from Oracle Forms
Hi,
I want to get the Client machine name from the Oracle Forms.
I have attached web_util.pll.
I use user_name := webutil_clientinfo.get_host_name;
but i am getting following error - WebUtil Error:WUC-015: Your form must contain the following Bean for this function to be available: oracle.forms.webutil.clientinfo.GetClientInfo.
Can any one help me in this!
Thanks & Regards,
Avinash Bhamare.
Pune.Hi,
I have written the code on when-button-pressed trigger of a push button -
DECLARE
user_name VARCHAR2(50);
BEGIN
user_name := client_win_api_environment.get_computer_name;
message('user_name is :'||user_name);
message('user_name is :'||user_name);
END;
And on clicking on this button i am getting error -
frm-40734:Internal Error:PL/SQL error occurred
Can any one help in this asap please!
Thanks & Regards,
Avinash.
Maybe you are looking for
-
Is it possible to use a campaign font when authoring an iBook rather than the standard font menu?
-
Just puchased the Zen V MP3 player. Can you bookmark audio books? If you can, how? Please give detail procedure. Thanks
-
Unlocked phone doesn't work overseas
Our iphone 3 is unlocked. However it won't work in Russia. Is there something else that needs unlocked so it will work overseas?
-
Satellite L300-1AP will not boot even in safe mode
After trying to boot in safe mode I get (after 10 minutes or so) the following..... Windows failed to start. A recent hardware or software change might be the cause. To fix the problem: 1. Insert your Window installation disk and restart your compute
-
HOME button: possible response solution?
I don't know if this helps anyone else, but I turned OFF the "Double-clicking the Home Button" goes to "iPod Controls" feature under the General Settings. My Home button seems more responsive with this option turned off. I used to press it several ti