You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Matthew Oatham <ma...@hotmail.com> on 2003/08/11 12:24:10 UTC

DocumentBuilder.parse(file);

Hi,

I have a problem - when I try to parse an XML file using 
DocumentBuilder.parse(file) whilst NOT connected to the internet I get the 
following exception

java.net.UnknownHostException: java.sun.com
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
        at 
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2870)
        at 
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
        at 
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:197)
        at 
com.assethouse.tools.doclets.ejb.EJBDeploymentDescriptorDoclet.replaceNode(Unknown 
Source)

I guess the DocumentBuilder is trying to look up the DTD - I can solve this 
by referencing the DTD from the file system but this means users have to 
download the DTD - not very elligant. Is there a way to stop the 
DocumentBuilder form trying to look up the DTD or do the validation part. So 
I can avoid this exception id the user doesn't have an internet connection

Cheers.

Matt

_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you. 
http://www.msn.co.uk/internetaccess


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: DocumentBuilder.parse(file);

Posted by Vadim Gritsenko <va...@verizon.net>.
Matthew Oatham wrote:

> Hi,
>
> I have a problem - when I try to parse an XML file using 
> DocumentBuilder.parse(file) whilst NOT connected to the internet I get 
> the following exception
>
> java.net.UnknownHostException: java.sun.com
>        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
>        at 
> org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2870) 
>
>        at 
> org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
>        at 
> org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
>        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
>        at 
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
>        at 
> org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185) 
>
>        at 
> javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:197)
>        at 
> com.assethouse.tools.doclets.ejb.EJBDeploymentDescriptorDoclet.replaceNode(Unknown 
> Source)
>
> I guess the DocumentBuilder is trying to look up the DTD - I can solve 
> this by referencing the DTD from the file system but this means users 
> have to download the DTD - not very elligant. Is there a way to stop 
> the DocumentBuilder form trying to look up the DTD or do the 
> validation part. So I can avoid this exception id the user doesn't 
> have an internet connection 


What you are looking for is called entity resolution using catalogs. 
There is a page describing how to use entity resolver in Cocoon:
    http://cocoon.apache.org/2.1/userdocs/concepts/catalog.html

How to use entity resolver in whatever you are using (crimson?) -- you 
can get an answer on this if you email appropriate mailing list 
(xerces-users, I guess).


Regards,
Vadim



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org