When I run this program
I get the following error
How can I resolve the following error?
Code:
import au.id.jericho.lib.html.*;
import java.util.*;
import java.io.*;
import java.net.*;
public class DisplayAllElements {
public static void main(String[] args) throws Exception {
String sourceUrlString="data/test.html";
if (args.length==0)
System.err.println("Using default argument of \""+sourceUrlString+'"');
else
sourceUrlString=args[0];
if (sourceUrlString.indexOf(':')==-1) sourceUrlString="file:"+sourceUrlString;
PHPTagTypes.register();
PHPTagTypes.PHP_SHORT.deregister(); // remove PHP short tags for this example otherwise they override processing instructions
MasonTagTypes.register();
Source source=new Source(new URL(sourceUrlString));
List elementList=source.findAllElements();
for (Iterator i=elementList.iterator(); i.hasNext();) {
Element element=(Element)i.next();
System.out.println("-------------------------------------------------------------------------------");
System.out.println(element.getDebugInfo());
if (element.getAttributes()!=null) System.out.println("XHTML StartTag:\n"+element.getStartTag().tidy(true));
System.out.println("Source text with content:\n"+element);
}
System.out.println(source.getCacheDebugInfo());
}
}
Code:
Using default argument of "E:/project/jericho-html-2.5/samples/console/data/test.html" Exception in thread "main" java.net.MalformedURLException: unknown protocol: e at java.net.URL.<init>(Unknown Source) at java.net.URL.<init>(Unknown Source) at java.net.URL.<init>(Unknown Source) at DisplayAllElements.main(DisplayAllElements.java:17)
Comment