문제

I'm trying to parse an xhml file using SAXParser in Java, but gets an exception:

"java.net.MalformedURLException: unknown protocol: g"

The line made that exception was:

SAXBuilder.build(Destination)

While Destination is the full path to the xhml file. The beginning of the xhml file is as followed:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="../article.css" type="text/css"?>
<div id="article" xmlns="http://www.w3.org/1999/xhtml">

While div is the root element.

I tried to look for documentation over the web about protocol g or MalformedURLException, i tried to play with the namespaces as well, but couldn't get this work.

Does anyone have any idea what can i do to make this work?

Thanks

도움이 되었습니까?

해결책

(Based on discussion in the comments) SAXBuilder is treating "Destination" as a URL and not a local file. Call "build" with a File object instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top