xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Re: Java and parsing XHTML (luca)
- From: luca <passani AT eunet.no>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Re: Java and parsing XHTML (luca)
- Date: Sat, 11 Sep 2004 18:29:21 +0200
this:
public Nodes finishMakingElement(Element element) {
if (element.getLocalName().equals("img")) {
System.out.println(element.toXML());
if (element.getAttributeValue("src") != null) {
urls.add(element.getAttributeValue("src"));
}
}
if (element.getParent() instanceof Document) {
return new Nodes(element);
}
else return empty;
}
gives me this:
C:\projects\jspfilters\tests>java -classpath .;xom-1.0a5.jar; FindImgs2
http://
localhost:8080/multipart/test.xml
<img />
<img />
which tells me that I should modify this:
public Nodes makeAttribute(String name, String URI,
String value, Attribute.Type type) {
if (name.equals("src") ) {
?????????????????????????????
}
return empty;
}
do you know how?
Actually, I had the bright idea of taking a look at some
version of the XOM sourcecode on my PC
and (after a few volleys with javac) figured the following out:
public Nodes makeAttribute(String name, String URI,
String value, Attribute.Type type) {
if (name.equals("src") ) {
return new Nodes(new Attribute(name, URI, value, type));
}
return empty;
}
posting anyway to validate with you and for the archive.
thanks a lot for your help
Luca
Elliotte Harold wrote:
luca wrote:
OK, I am almonst there. Just a bit perplexed here. I get the node, how
do I retrieve the src attribute?
public Element startMakingElement(String name, String namespace) {
if (name.equals("img") ) {
urls.add(????????);
}
return new Element(name, namespace);
}
Do it in finishMakingElement instead of startMakingElement. There you'll be presented with a complete element with all attributes and children in place.
-
[XOM-interest] Re: Java and parsing XHTML (luca),
Hallvard Trætteberg, 09/09/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
Elliotte Harold, 09/09/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
- Re: [XOM-interest] Re: Java and parsing XHTML (luca), John Cowan, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
Elliotte Harold, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
- Re: [XOM-interest] Re: Java and parsing XHTML (luca), Elliotte Harold, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
Elliotte Harold, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
- Re: [XOM-interest] Re: Java and parsing XHTML (luca), Elliotte Rusty Harold, 09/14/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
Elliotte Harold, 09/11/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
luca, 09/11/2004
- <Possible follow-up(s)>
- [XOM-interest] Re: Java and parsing XHTML (luca), Wolfgang Hoschek, 09/10/2004
-
Re: [XOM-interest] Re: Java and parsing XHTML (luca),
Elliotte Harold, 09/09/2004
Archive powered by MHonArc 2.6.24.