Exception in thread "main"java.net.UnknownHostException:file at Java.net.AbstractPlainSocketImpl.connect (Abstractplainsocketimpl.java: 178) at Java.net.PlainSocketImpl.connect (Plainsocketimpl.java:172) at Java.net.Socket.connect (Socket.java:579) at Java.net.Socket.connect (Socket.java:528) at Sun.net.ftp.impl.FtpClient.doConnect (Ftpclient.java:958) at Sun.net.ftp.impl.FtpClient.tryConnect (Ftpclient.java:918) at Sun.net.ftp.impl.FtpClient.connect (Ftpclient.java:1013) at Sun.net.ftp.impl.FtpClient.connect (Ftpclient.java:999) at Sun.net.www.protocol.ftp.FtpURLConnection.connect (Ftpurlconnection.java:294) at Sun.net.www.protocol.ftp.FtpURLConnection.getInputStream (Ftpurlconnection.java:393) at Com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity (Xmlentitymanager.java:613) at Com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion (Xmlversiondetector.java: 189) at Com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (Xml11configuration.java:812) at Com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (Xml11configuration.java:777) at Com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (Xmlparser.java:141) at Com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (Abstractsaxparser.java:1213) at Com.sun.org.apache.xerces.internal.jaxp.saxparserimpl$jaxpsaxparser.parse (Saxparserimpl.java:34]At Nu.xom.Builder.build (Unknown source) at Nu.xom.Builder.build (Unknown source) at XML2. Xom.main (Xom.java:26)
PackageXML2;ImportJavax.xml.parsers.SAXParser;Importjavax.xml.parsers.SAXParserFactory;ImportNu.xom.Builder;ImportOrg.xml.sax.XMLReader; Public classXOM { Public Static voidMain (string[] args)throwsException {saxparserfactory Factory=saxparserfactory.newinstance (); Factory.setvalidating (false); Factory.setnamespaceaware (true); SAXParser Parser=Factory.newsaxparser (); XMLReader Reader=Parser.getxmlreader (); Reader.seterrorhandler (NewSimpleerrorhandler ()); Builder Builder=NewBuilder (reader); Builder.build ("Contacts.xml"); }}
Why do you report this error? I'm using a xom-1.2.10.jar.
PackageXML2;ImportJavax.xml.parsers.SAXParser;Importjavax.xml.parsers.SAXParserFactory;ImportNu.xom.Builder;ImportOrg.xml.sax.XMLReader; Public classXOM { Public Static voidMain (string[] args)throwsException {saxparserfactory Factory=saxparserfactory.newinstance (); Factory.setvalidating (false); Factory.setnamespaceaware (true); SAXParser Parser=Factory.newsaxparser (); XMLReader Reader=Parser.getxmlreader (); Reader.seterrorhandler (NewSimpleerrorhandler ()); Builder Builder=NewBuilder (reader); Builder.build ("File:\\h:\\mycodes\\java\\jbpm\\xml2\\contacts.xml"); }}
It's inconvenient to start using the file protocol from Xom-1.2.10.jar.
XOM error Exception in thread "main" Java.net.UnknownHostException:file