xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: luca <passani AT eunet.no>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: [XOM-interest] dtd problems
- Date: Sun, 19 Sep 2004 23:47:36 +0200
Elliotte,
any idea of why this thing that worked yesterday, failed to work
today?
try {
StreamingImgLister sil = new StreamingImgLister();
Builder builder = new Builder(sil);
Document doc = builder.build(mark_up,"");
:
}
catch (ParsingException ex) {
:
}
catch (IOException ex) {
System.out.println(ex);
}
I get this exception, which I wasn't getting yesterday.
java.net.UnknownHostException: www.wapforum.org
The mark_up string contains the following:
----------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Cool Portal</title>
<style>
table.coolmenu {width:100%}
td.coolmenu
{text-align:center;font-size:smaller;width:50%;vertical-align:top;}
img.coolmenu {vertical-align:top;}
</style>
</head>
<body>
<table class="coolmenu">
<tr><td class="coolmenu">
:
<a href="http://url1">More</a>
</td>
<td class="coolmenu"></td></tr></table>
</body>
</html>
-----------------------------------------------------------
here is the StreamingImgLister.java too:
-----------------------------------------------------------
import java.io.*;
import java.util.ArrayList;
import nu.xom.*;
public class StreamingImgLister extends NodeFactory {
int depth = 0;
Nodes empty = new Nodes();
ArrayList urls = new ArrayList(20);
// We don't need the comments.
public Nodes makeComment(String data) {
return empty;
}
// We don't need text nodes at all
public Nodes makeText(String data) {
return empty;
}
public Element startMakingElement(String name, String namespace) {
return new Element(name, namespace);
}
public Nodes finishMakingElement(Element element) {
//get picture url
if (element.getLocalName().equals("img")) {
if (element.getAttributeValue("src") != null) {
System.out.println(element.toXML());
urls.add(element.getAttributeValue("src"));
}
}
//get CSS url
if (element.getLocalName().equals("link")) {
if ("stylesheet".equals(element.getAttributeValue("rel")) &&
element.getAttributeValue("href") != null) {
System.out.println(element.toXML());
urls.add(element.getAttributeValue("href"));
}
}
if (element.getParent() instanceof Document) {
return new Nodes(element);
}
else return empty;
}
public Nodes makeAttribute(String name, String URI,
String value, Attribute.Type type) {
if (name.equals("src") || name.equals("href") || name.equals("rel") )
{
return new Nodes(new Attribute(name, URI, value, type));
}
return empty;
}
public Nodes makeDocType(String rootElementName,
String publicID, String systemID) {
return empty;
}
public Nodes makeProcessingInstruction(String target, String data) {
return empty;
}
/* export urls */
public ArrayList getUrls() {
return urls;
}
}
-----------------------------------------------------------
is there a way to force the Builder to ignore DTDs?
I already do this:
public Nodes makeDocType(String rootElementName,
String publicID, String systemID) {
return empty;
}
thanks
Luca
-
[XOM-interest] dtd problems,
luca, 09/19/2004
-
Re: [XOM-interest] dtd problems,
Elliotte Harold, 09/19/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
Elliotte Harold, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
- Re: [XOM-interest] dtd problems, Elliotte Harold, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
Elliotte Harold, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
- Re: [XOM-interest] dtd problems, Elliotte Harold, 09/20/2004
- Re: [XOM-interest] dtd problems, Elliotte Harold, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
luca, 09/20/2004
-
Re: [XOM-interest] dtd problems,
Elliotte Harold, 09/19/2004
Archive powered by MHonArc 2.6.24.