Results 1 to 7 of 7
  1. #1
    newbieal is offline Member
    Join Date
    Oct 2008
    Posts
    19
    Rep Power
    0

    Default java: xml/html file with doctype trying to connect to site

    I've html/xml files that contain the following:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    The Java program that I create parses this file however it won't compile b/c it's trying to visit the w3 site for the DTD info. Any idea if this function can be turned of in Java/Eclipse?

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    it won't compile
    Do you get compiler errors? Or are they runtime errors?
    Copy and paste full text of the error messages here.

  3. #3
    newbieal is offline Member
    Join Date
    Oct 2008
    Posts
    19
    Rep Power
    0

    Default connection timed out: connect

    java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:182)
    at java.net.Socket.connect(Socket.java:516)
    at java.net.Socket.connect(Socket.java:466)
    at sun.net.NetworkClient.doConnect(NetworkClient.java :157)
    at sun.net.http.HttpClient.openServer(HttpClient.java :365)
    at sun.net.http.HttpClient.openServer(HttpClient.java :477)
    at sun.net.http.HttpClient.<init>(HttpClient.java:214 )
    at sun.net.http.HttpClient.New(HttpClient.java:287)
    at sun.net.http.HttpClient.New(HttpClient.java:299)
    at sun.net.protocol.http.HttpURLConnection.getNewHttp Client(HttpURLConnection.java:796)
    at sun.net.protocol.http.HttpURLConnection.plainConne ct(HttpURLConnection.java:748)
    at sun.net.protocol.http.HttpURLConnection.connect(Ht tpURLConnection.java:673)
    at sun.net.protocol.http.HttpURLConnection.getInputSt ream(HttpURLConnection.java:917)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityM anager.setupCurrentEntity(XMLEntityManager.java:97 3)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityM anager.startEntity(XMLEntityManager.java:905)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityM anager.startDTDEntity(XMLEntityManager.java:872)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScan nerImpl.setInputSource(XMLDTDScannerImpl.java:282)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl$DTDDispatcher.dispatch(XMLDocumentSca nnerImpl.java:1021)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(DOMParser.java:250)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(DocumentBuilderImpl.java:292)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBu ilder.java:172)
    at testingWriteToHTML.main(testingWriteToHTML.java:33 )[/CODE]

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    Ok that's called an execution error. Compile errors come from the javac command.
    How are you executing the program?

    What happens if you load that URL into your browser? Are you able to read anything from it?

  5. #5
    newbieal is offline Member
    Join Date
    Oct 2008
    Posts
    19
    Rep Power
    0

    Default

    I do a 'run as' java app in Eclipse.

    When I try the link in the browser it downloads a dtd file. I do not want it to connect nor download info. I just want it to ignore the doctype line and this url in particular.

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    That's interesting. I get the following error:
    Forbidden due to abuse
    With: http://w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

  7. #7
    newbieal is offline Member
    Join Date
    Oct 2008
    Posts
    19
    Rep Power
    0

    Default

    I am not permitted to post a full web link to this post as I'm getting the message that says I have to have a post count of 20 or greater to do that but anyway the link should be prefaced with three w's after the first two forward slashes, then, at least in firefox, it works.

Similar Threads

  1. How to print a HTML file in browser look using JAVA
    By ammameiya in forum Advanced Java
    Replies: 5
    Last Post: 06-25-2010, 02:36 AM
  2. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  3. Include Java file in HTML Page
    By kathyc in forum New To Java
    Replies: 2
    Last Post: 03-07-2008, 03:51 AM
  4. Code to connect to a web site
    By suji in forum Networking
    Replies: 1
    Last Post: 02-15-2008, 04:05 PM
  5. How can I get a RealMedia file from a web site?
    By emesol0 in forum Networking
    Replies: 0
    Last Post: 01-24-2008, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •