Help with getting links from HTML page

Hello all. I found the sun tutorial for getting HREF values from a tags in an HTML document at <http://java.sun.com/developer/TechTips/1999/tt0923.html>. My question now is how would a person add the ability to get the text of the link to this code?
For example:
Provided the HTML code:<a href="link.html">example</a>Returned is: href=link.html text=example

I think the TechTip you've linked too is quite old (1999). I would write a simple SAXParser that uses TagSoup (http://www.ccil.org/~cowan/XML/tagsoup/) as its input source. In your handler, simply set a flag and reset a StringBuffer to collect the contents of any <a>...</a> element. Simplified:
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        if ("a".equals(localName)) {
            currentHref = attributes.getValue("href");
            if (currentHref != null && currentHref.length() > 0) {
                inLink = true;
                //reset the string buffer
                buffer.setLength(0);
    public void characters(char[] ch, int start, int length) throws SAXException {
        if (inLink) buf.append(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {
        if ("a".equals(localName) && inLink) {
            inLink = false;
            //add link to the stack
            links.add(new Link(currentHref, buffer.toString()));
    }Completely untested, of course... .Good luck...

Similar Messages

  • Problem with return link from html page back to css page

    Here is the site..almost ready for publication
    http://www.matriley.com/glensite/index.html
    1) Go to properties for sale
    2)Choose a suberb
    3)click on a property with a video
    4) watch the crazy video if you like
    5) Click go back to properties
    ^) Yes the page is there but the property page is now
    inactive...why?
    8)The whole thing works fine on Firefox but we do have this
    Glitch on IE
    PLEAASSE Can someone help
    Regards Matthew [email protected]
    Everything works well but for the problem return link to the
    properties page after you have gone to the video.The property page
    becomes inactive

    Your page is a monster -
    Empty Cache
    10.6K 1 HTML/Text
    1.5K 1 Stylesheet File
    985.4K 25 Images
    997.7K Total size
    27 HTTP requests
    25 images with aggregate weight of ~1MB is much too large,
    you know?
    Anyhow, I cannot reproduce your problem in IE7. Are you
    referring to IE6,
    instead?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "fredbillmatt" <[email protected]> wrote in
    message
    news:fv0m9k$a7a$[email protected]..
    > Here is the site..almost ready for publication
    >
    http://www.matriley.com/glensite/index.html
    >
    > 1) Go to properties for sale
    > 2)Choose a suberb
    > 3)click on a property with a video
    > 4) watch the crazy video if you like
    > 5) Click go back to properties
    > ^) Yes the page is there but the property page is now
    inactive...why?
    > 8)The whole thing works fine on Firefox but we do have
    this Glitch on IE
    > PLEAASSE Can someone help
    > Regards Matthew [email protected]
    > Everything works well but for the problem return link to
    the properties
    > page
    > after you have gone to the video.The property page
    becomes inactive
    >

  • How link from html page to a specific frame in flash cs5 as3

    Hi!
    I'm kinda new around here. I am interested in knowing how to link from a specific html page to a specific frame in flash cs5 as3.
    I have a website that I originally began to design in flash but later started developing new pages for it in html. The flash part of it has several pages on different frames and I have created links from the flash part to the other html pages, but, I can only link the html pages back to the main flash home page, and not the other pages in the flash part of the website.
    I have read that in cs3 it was possible using the flashvars skip variable, but I don't know how to do it. I have not yet seen any working examples and I could not find any instructions / tutorials online for cs5.
    Can someone help here?

    add a query string, to the swf's embedding html, with variable/value indicating the frame you want to display in your swf.  add a javascript function to return the query string (or entire url), call the javascript function from flash using the externalinterface class.  and finally add code to your swf to parse the returned url or query string, parse it and then direct your timeline to the appropriate frame.

  • Get parameters from html page from java application standalone ...

    Hi all,
    I work in one solution that i have values in Html Page and i want get the parameters values from html and cath they in java application standalone.
    The Html page is in same host than de java application.
    I want know if this is possible. I wnat know if without HttpServlet i can get the parameters from Html Page pure.
    Thanks in Advance for the ideas,
    Antonio.

    Hi Abdul,
    The problem is my client want one solution where i have one page simple page Html and one application java standalone. This application runs in one machine, but we don't have web server. So the question is: Is possible without web server i can get the parameters values that is inside the html page from java application. I remember you that the application java is one .jar that run's with one command line from crontab "java -jar teste.jar".

  • Problem with retiriving links froma web page

    hi friends,
    ca n anyone help me out.i am trying to retrieve all the links from a web page .but all the linkjs are not being retrieved.can anyone tell me why.
    here i am submitting the code of it.
    private static ArrayList retrieveLinks(URL pageUrl, String pageContents, HashSet crawledList,boolean limitHost)
    // Compile link matching pattern.
    Pattern p = Pattern.compile("<a\\s+href\\s*=\\s*\"?(.*?)[\"|>]", Pattern.CASE_INSENSITIVE );
    Matcher m = p.matcher(pageContents);
    // Create list of link matches.
    ArrayList linkList = new ArrayList();
    while (m.find()) {
    String link = m.group(1).trim();
    // Skip empty links.
    if (link.length() < 1) {
    continue;
    // Skip links that are just page anchors.
    if (link.charAt(0) == '#') {
    continue;
    // Skip mailto links.
    if (link.indexOf("mailto:") != -1) {
    continue;
    // Skip JavaScript links.
    if (link.toLowerCase().indexOf("javascript") != -1) {
    continue;
    // Prefix absolute and relative URLs if necessary.
    if (link.indexOf("://") == -1) {
    // Handle absolute URLs.
    if (link.charAt(0) == '/') {
    link = "http://" + pageUrl.getHost() + link;
    // Handle relative URLs.
    } else {
    String file = pageUrl.getFile();
    if (file.indexOf('/') == -1) {
    link = "http://" + pageUrl.getHost() + "/" + link;
    } else {
    String path =
    file.substring(0, file.lastIndexOf('/') + 1);
    link = "http://" + pageUrl.getHost() + path + link;
    // Remove anchors from link.
    int index = link.indexOf('#');
    if (index != -1) {
    link = link.substring(0, index);
    // Remove leading "www" from URL's host if present.
    link = removeWwwFromUrl(link);
    // Verify link and skip if invalid.
    URL verifiedLink = verifyUrl(link);
    if (verifiedLink == null) {
    continue;
    /* If specified, limit links to those
    having the same host as the start URL. */
    if (limitHost && !pageUrl.getHost().toLowerCase().equals(verifiedLink.getHost().toLowerCase()))
    System.out.println("the given link does not exist");
    continue;
    // Skip link if it has already been crawled.
    if (crawledList.contains(link)) {
    continue;
    // Add link to list.
    linkList.add(link);
    return (linkList);
    Hope some one can help me outr of this .i susupect some problem with the regular expression used.
    it is unable to parse links like
    http://www.cricinfo.com/ci/engine/current/match/scores/live.html
    http://www.cricinfo.com/nzvind2009/content/current/series/366616.html

    kathiksagar wrote:
    i dont have much idea about html parser
    can u tell me how to do itHere are a couple of free parser written in Java:
    [http://java-source.net/open-source/html-parsers]
    I'm sure many of them have a manual, and/or have example code on their website on how to use it.
    Good luck.

  • Help with text link on master pages CS2

    I'm having trouble doing the following.
    I want to create a template document, which will eventually be for the chapters in a book. I want a small text box on my lead spread to be linked for text flow, to the larger text boxes on all of the other pages.
    Easy enough to create masters that look right, and links between text frames on the same master spread, but I don't understand how the different master spreads can have text links between them.
    I want to enter each chapters text, in the first text frame (on the chapter lead spread) and have this auto flow through and auto create the remaining text pages needed.
    Thank You

    The only way to get text to flow from a page based on one master to a page based on another is if the second master is based on the first, and the pages are already in place in the file.
    Most people use some variation of this technique: make a chapter opener master and a regular master, then make two pages, to start a chapter. Apply the opener master to the first, and the other master to the second. Place the text on the first page (don't overrride the frame first, if you've got a master frame) and don't autoflow -- you want the rest of the story to be overset. Pick up the overset and move to the second page, hold the shift key and autoflow (again, do not override any master frame first).
    You don't actually need master frames for most book type work. ID makes frames on the fly based on the page margins and column guides, so if you set the margins where you want the bounds of the frame you don't need the master frame.
    The first frame in a thread will start with it's top at the y-coordiante where you click the mouse and extend to the bottom margin. It will fill the column width. Subsequent frames on autoflow will fill from the top margin to the bottom. If the only difference between the chapter opener and the other pages is a dropped frame you wouldn't even need a separate master. Just put a horizontal guide on the master for reference where you want the top of that first frame and make sure you click on it on the opening page, holding shift to autoflow.

  • Help with getting values from request. Very Strange!!

    Hello,
    My very strange problem is the following.
    I have created three dynamic list boxes. When the user select
    the first list box, the second becomes populated with stuff
    from a database. The third becomes populated when the second
    is selected. Now, I have used hidden values in order for
    me to get the selected value from the first listbox. The
    following code is my first listbox:
    <SELECT NAME="resources" onChange="document.hiddenform.hiddenObject.value = this.option [this.selectedIndex].value; document.hiddenform.submit();">
    <OPTION VALUE =""> Resource</OPTION>
    <OPTION VALUE ="soil"> Soil </OPTION>
    <OPTION VALUE ="water"> Water </OPTION>
    <OPTION VALUE ="air"> Air </OPTION>
    <OPTION VALUE ="plants"> Plants </OPTION>
    <OPTION VALUE ="animals"> Animals </OPTION>
    </SELECT>
    I use the getRequest method to get the value of hiddenObject.
    At this time I am able to get the value of hiddenObject to populate
    the second list box.
    But, when the user selects an item from the second list box
    and the second form is also submitted,
    I lose the value of hiddenObject. Why is this??
    The code to populate my second listbox is the following:
    <SELECT NAME ="res_categories" onChange="document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value; document.hiddenform2.submit(); ">
    <OPTION VALUE ="" SELECTED> Category</OPTION>
    Here I access a result set to populate the list box.
    Please help!!

    Form parameters are request-scoped, hence the request.getParameter("hiddenObject"); call after the submission of the second form returns a null value because the hiddenObject parameter does not exist within the second request.
    A solution would be to add a hiddenObject field to your second form and alter the onChange event for res_categories to read
    document.hiddenform2.hiddenObject.value=document.1stvisibleformname.resources.option[document.1stvisibleformname.resources.selectedIndex].value;
    document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value;
    document.hiddenform2.submit();You will then come across a similar problem with your third drop-down if indeed you need to resubmit the form...
    A far better approach would be to create a session scoped bean, and a servlet to handle these requests. Then when the servlet is called, it would set the value of the bean property, thus making it available for this request, and all subsequent requests within the current session. This approach would eliminate the need for the clunky javascript, making your application far more stable.

  • Need help with getting variable from static

    Hello,
    What I am building is an application that prompts for username/password before it shows the main screen. Once they have successfully logged in, I need to assign the username that they used, in order to use it for a button event if the make any updates.
    Here is the code that I have tried to use.
    public String username;
    ///This set's the public variable username
    public void setUserName(String UserName){
    username = UserName;
    /////////////////Here is where they login, and assign the name to setUsername
    public static void main(String args[]) throws SQLException {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    JFrame frame = new JFrame();
    JTextField userName = new JTextField();
    JTextField passWord = new JTextField();
    Object[] options = {"OK","CANCEL"};
    Object[] msg = {"UserName:", userName, "Password:", passWord};
    final JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){};
    JDialog dialog = op.createDialog(frame, "Please Login");
    dialog.show();
    int result = JOptionPane.OK_OPTION;
    try {
    result = ((Integer)op.getValue()).intValue();
    }catch(Exception uninitializedValue){}
    if(result == JOptionPane.OK_OPTION) {
    String userID = userName.getText();
    String passID = passWord.getText();
    Main myMain = new Main();
    myMain.setUserName(userID);
    if(!userID.equals("") && !passID.equals("")) {
    new Main().setVisible(true);
    }else {
    // user cancelled
    ////here is the button event that also will need the username
    private void selButtonActionPerformed(java.awt.event.ActionEvent evt) {
    Connection conn = null;
    Statement stmt3 = null;
    Statement stmt4 = null;
    ResultSet rset3 = null;
    ResultSet rset4 = null;
    String usernum = null;
    String xemu = null;
    String loc = null;
    String ustat = null;
    String manager = null;
    String dept = null;
    String Add = "Add";
    String Update = "Update";
    String groupID = "9999";
    Vector columnNames = new Vector();
    Vector data = new Vector();
    String Manager_info[] = {"managerindex", "managers", "managername"};
    String Account_info[] = {"acctypeindex", "acctype", "acctypedesc"};
    String Group_info[] = {"groupnum", "groups", "groupcode"};
    String System_info[] = {"systemindex", "systems", "systemname"};
    String Dept_info[] = {"departindex", "departments", "departname"};
    String Xemu_info[] = {"xemuindex", "xemulator", "xemudesc"};
    String Location_info[] = {"locindex", "location", "locdesc"};
    String Ustatus_info[] = {"ustatusindex", "userstatus", "ustatusdesc"};
    Date myDate = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
    String today = formatter.format(myDate);
    System.out.println(username);
    I am trying to set the public username variable to what the person enters, however since I am creating a seperate instance of it, I don't believe it will work. Any help would be very much appreciated.
    Thanks.
    Josh

    I am developing in Netbeans. If I try to remove the static keyword from main(), netbeans canno't find a main to run. I have created the User class.
    Here is the main again to show what I have done.
    public static void main(String args[]) throws SQLException {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    User user = new User();
    JFrame frame = new JFrame();
    JTextField userName = new JTextField();
    JTextField passWord = new JTextField();
    Object[] options = {"OK","CANCEL"};
    Object[] msg = {"UserName:", userName, "Password:", passWord};
    final JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){};
    JDialog dialog = op.createDialog(frame, "Please Login");
    dialog.show();
    int result = JOptionPane.OK_OPTION;
    try {
    result = ((Integer)op.getValue()).intValue();
    }catch(Exception uninitializedValue){}
    if(result == JOptionPane.OK_OPTION) {
    String userID = userName.getText();
    String passID = passWord.getText();
    user.setName(userID);
    user.setPassword(passID);
    if(!userID.equals("") && !passID.equals("")) {
    //Auth.setUserName(userID);
    //Auth.setPassword(passID);
    new Main().setVisible(true);
    }else {
    // user cancelled
    This set's the variables
    Here is the beginning of the evt that I am using to try and get the data.
    private void selButtonActionPerformed(java.awt.event.ActionEvent evt) {                                         
    Connection conn = null;
    Statement stmt3 = null;
    Statement stmt4 = null;
    ResultSet rset3 = null;
    ResultSet rset4 = null;
    String usernum = null;
    String xemu = null;
    String loc = null;
    String ustat = null;
    String manager = null;
    String dept = null;
    String Add = "Add";
    String Update = "Update";
    String groupID = "9999";
    Vector columnNames = new Vector();
    Vector data = new Vector();
    User user = new User();
    String User = user.getName();
    System.out.println(User);
    String Manager_info[] = {"managerindex", "managers", "managername"};
    String Account_info[] = {"acctypeindex", "acctype", "acctypedesc"};
    String Group_info[] = {"groupnum", "groups", "groupcode"};
    String System_info[] = {"systemindex", "systems", "systemname"};
    String Dept_info[] = {"departindex", "departments", "departname"};
    String Xemu_info[] = {"xemuindex", "xemulator", "xemudesc"};
    String Location_info[] = {"locindex", "location", "locdesc"};
    String Ustatus_info[] = {"ustatusindex", "userstatus", "ustatusdesc"};
    Date myDate = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
    String today = formatter.format(myDate);
    String [] str = {
    "EmpID", "Account", "System", "Type", "Status", "UserID", "Group"
    This gives me a null on the println, how can I get the data that was entered in main()?
    Thanks,
    Josh

  • Help with getting input from the console

    Hey Experts , wish you are good ? .... i have a problem and wish you figure it out for me , well tell me how can store the input values in a text file and pass the file from the command line ? , i have compiled the program so well , but i could not using text file , thats the code :
    import java.util.Scanner ;
    class TestScanner {
    public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter an interger : ");
    int intValue = scanner.nextInt();
    System.out.println(" You entered an interger " + intValue);
    System.out.print("Enter a double value : ");
    double doubleValue = scanner.nextDouble();
    System.out.println("You entered a double value " + doubleValue);
    System.out.print("Enter a string without space: ");
    String string = scanner.next();
    System.out.println("You entered the string " + string);
    }and i created a file with value like that :
    file name is input
    5
    23.55
    Java
    true
    i just want to know the correct order to compile it .
    thanks in advance

    The Java Tutorials: [_Basic I/O_|http://java.sun.com/docs/books/tutorial/essential/io/index.html]
    db

  • A little help with getting varaibles from another class

    hey,
    so i have these two classes and they both are GUI's. the first main class is called GUI (very original) and he second is called adder. so when i click a button on GUI it creates and shows the adder GUI wich gets user input, when the user clicks the done button on the adder gui it does this this:
          * method to dispose of the gui without deleting the object
         public void close()
             addWindow.dispose();
          * method for when the done button is clicked
         private void buttonClicked()
         personName = ename.getText();
            personPin = epin.getText();
            personAddress = address.getText();
            close();
        }then we go to the GUI class and do this:
    public void addPart2()
            lm.addElement(adder.personName + "-" + adder.personID + "-" + adder.personAddress + "-" + adder.personPin );
        }(all varibless are public by the way), so when i go and have a method directly call adderPart2 right after the adder gui is closed it comes up with all variables bieng null, but if i go in and manualy call the method without doing anything else it works, can anyone explainthis and/or hellp me?

    so does anyone have a solution for this problem or at least know what is happening?
    Thanks a-bundle,
    Mike M

  • Get content from html page

    Hey guys, Im looking at accessing a webpage, downloading the content then stripping out the parts i want.
    http://sunsolve.sun.com/search/document.do?assetkey=1-34-9-1
    For example, I would like to be left with just the patches and their information, not the heading and intro. Where should i start?

    here is some class that can read an URL:import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.OutputStream;
    import java.net.URLEncoder;
    public class test {
         public static void main(String args[]) {
              if(args.length!=0){
                   new test(args);
              new test();
         public test() {
              this.openURL("http://www.google.com",null);
         public test(String[] args){
              int i = 0;
              while(i<args.length){
                   // do something with the encoding, I am assuing utf-8
                   // but the openURL method can check the header for you
                   try{
                        System.out.println(new String(this.openURL(args,null),"UTF-8"));
                   }catch(Exception e){
                        e.printStackTrace();
                   i++;
         public byte[] openURL(String urlpath,URL u) {
              // it is VERRY importaint to read the entire response
              // if you want to connect to the same server again
              // this is because closing the inputstream does not close the socket
              // and response data from a previous request could be mixed up with the current
              InputStream is;
              OutputStream os;
              byte[] buf = new byte[1024];
              URLConnection urlc = null;
              try {
                   URL a = null;
                   if(u!=null){
                        a = u;
                   }else{
                        a = new URL(urlpath);
                   urlc = a.openConnection();
                   urlc.setDoOutput(false);
              // either setDoOutput to false or Post some info
    //               os = urlc.getOutputStream();
    //               String name = "key="+URLEncoder.encode("value", "UTF-8");
    //               os.write(name.getBytes("UTF-8"));
    //               os.close();
                   is = urlc.getInputStream();
                   int len = 0;
                   ByteArrayOutputStream bos = new ByteArrayOutputStream();
                   while ((len = is.read(buf)) > 0) {
                        bos.write(buf, 0, len);
                   // close the inputstream
                   is.close();
                   return bos.toByteArray();
              } catch (Exception e) {
                   e.printStackTrace();
                   try {
                        // now failing to read the inputstream does not mean the server did not send
                        // any data, here is how you can read that data, this is needed for the same
                        // reason mentioned above.
                        ((HttpURLConnection) urlc).getResponseCode();
                        InputStream es = ((HttpURLConnection) urlc).getErrorStream();
                        int ret = 0;
                        // read the response body
                        while ((ret = es.read(buf)) > 0) {
                        // close the errorstream
                        es.close();
                   } catch (IOException ex) {
                        ex.printStackTrace();
                        // deal with the exception
              return new byte[0];
    Here is some code to set a proxy// IF YOUR PROXY NEEDS AUTHENTICATION
    //The base64encoder is part of the w3c tools
    //download jigsaw and look for the base64,,, file
    //http://www.google.nl/search?hl=nl&q=site%3Aw3c.org+jigsaw&lr=
    //compiled it and put it in [jre home]/lib/ext
    //put this jar file in the classpath when you compile
    String proxyUrl = "myproxy";
    String user = "myUser";
    String password = "myPassword";
                   URLConnection conn = url.openConnection();
                   if(proxyUrl!=null){
                        System.getProperties().put( "proxySet", "true" );
                        System.getProperties().put( "proxyHost", proxyUrl );
                        System.getProperties().put( "proxyPort", "80" );
                        pwd = user + ":" + password;
                        Base64Encoder enc  = new Base64Encoder(password);
                        encodedPassword = enc.processString() ;
                        // optional
                        conn.setRequestProperty( "Proxy-Authorization", encodedPassword );
                   // start opening output or inputstream on the connection

  • Hi guys. i have some problem with a link from a pdf on-line,when i click on it,the page adds a "%" at the and of the link and says "page not found" because of it

    Hi guys. i have some problem with a link from a pdf on-line,when i click on it,the page adds a "%" at the and of the link and says "page not found" because of it.
    This happens only when a load my pdf file on my server, because if i click on the link when the file is on my iPad, the page opens without problem.
    Any help please?
    thanx

    the % sign is often used when there's a space in a name. HTML doesn't like spaces so it fills them with % or %20
    try, on the end of that link, see if there's a space built into the page or the link when the page was made
    On the web address you may be able to 'backspace' at the end and erase that space to get the address, but whomever made the page possibly put a mistake in the link

  • 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);

  • Can a menu link to .html pages?

    I want to make a DVD that will start with a video introduction, and upon finishing the brief minute or so intro, it will display a menu screen.
    1.) I would like the menu buttons to link to .html pages saved on the DVD. So after clicking on a link from the menu, it will open up a full-screen .html page.
    2.) Each .html page will link to other .html pages and have embedded images, and short quitcktime video clip links that will open up in small windows when links are clicked.
    3.) I need to have a link on each .html page that links back to the main dvd menu.
    Can this be done? Any issues with doing something like this?
    Thanks in advance for any advice!!!!

    Mark - you need to read up on DVD@ccess if you intend doing this through DVDSP. Yes, it is all possible, but you haven't quite got the way it works correct.
    What happens is you embed a URL into a menu. When the menu is accessed (typically by a button from a previous menu) the link is activated and the resource is launched. This opens in a window in front of the DVD playback window. The DVD player continues to run in the background - so you need to allow for that when returning. The viewer will simply close the web browser window and be back at the DVD window - by then you should have made the @ccess menu 'time-out' and return to the previous menu.
    You set up the HTML file (or whatever file you are using) in a folder on your Mac, and place it all within a parent folder. From within DVDSP you then use the property Inspector for the disc itself (click not he disc icon in the outline view) to specify a ROM folder. You browse for the parent folder you just created. Everything inside that will get added to the root level of the DVD, which is why you place your HTML inside a folder within that parent folder (unless of course, you don't mind your HTML file/s being scattered all over the root of the DVD).
    You set the URL for the @ccess link by using the following path format:
    file:///DVDname/ParentFolderName/filename.extension
    So if your html file is called 'index' and it is in a folder called 'ROM' on your DVD called 'Project' then the URL you set in the menu would be:
    file:///Project/ROM/index.html
    This should then get activated (as long as you have enabled DVD@ccess links in your DVD Player software).
    However, there are some caveats.
    Whilst this will work quite well on a Mac, a PC user will have a wildly varied experience - for some the links will work. For some the links won't work, and for some, all links will launch the moment the first link is encountered... ALL PC users will need to install the DVD@ccess software (which will be on the built DVD by default (DVDSP includes it there for you), unless they have already done so previously (unlikely).
    In order to maximise the experience for PC users and Mac users you should consider using Sonic's 'eDVD' to add the hyperlinks. This makes use of the Interactual player which has a far higher installed base in PCs, but will need installing in Macs. Again, this gets included on the disc when you use eDVD.
    eDVD is a PC only app - you'll need to build your project and transfer the VIDEO_TS folder to a PC, add the links and then burn it to disc or use software such as Gear Pro to create a DLT. Hopefully Jim (WTS) will see this and give more advice on how to use eDVD.
    Getting DVD@ccess working on a PC is a tricky thing to do - a lot depends on the PC software spec, and since you can't govern the user's choice in this, you are walking a tightrope of compatibility.
    Of course, you could simply set some text into your menu to say that there is additional content on the disc, and let the user browse to it at their leisure instead of relying on embedded links...

  • Values not getting displayed from first page of the report.

    Values in the report is getting displayed from second page.
    First page in the report only displaying the report title and column names.
    Secone page onwards, data and column names are generated.
    Can any one please help me, with the cause of the problem.

    what reporting tool?
    Interactive Reporting
    Financial Reporting

Maybe you are looking for

  • How to connect Mysql to J2EE server exactly?

    Hi,there I would like thank you for offering me your precious opinion in advance. I got a problem with installing Mysql database into J2EE server. All I have done is: 1.Install Mysql and put the Mysql driver,mm.mysql-2.0.4-bin.jar into the directory

  • LSMW for garnishments(194,195)

    hi frenz... i am doing LSMW for 195(garnishment order). while recording it is not allowing me to enter in to 195 unless i enter in 194. i dont want to do for 194.. i want to do directly for 195. plzz help me.

  • Whast is order related billing and delivery related billing?

    Explain about order related billing and delivery related billing thanks

  • Help me plz about this iPhone

    Suddenly closed the iPhone 4 even though he is charged full, and got me more than once, please help

  • How do I create a slide/push interaction/animation?

    There's an interaction/animation I want to create, but I don't know how (or if FC currently supports it). For example, let's say I have a custom component that consists of a rectangle with some text in it. Below it are a "back" and a "next" button. W