Hi Andreas
I've CC'd the dom4j-user list in case others have this problem.
This error looks like its a DOM2 versus DOM1 exception. The DOMReader is
currently based on DOM2 to be namespace aware. It looks like the DOM
implementation in com.softwareag.tamino.api.dom.* is based on DOM1? Is this
the case?
If it is maybe we can make DOMReader capable of working from both DOM1 and
DOM2 implementations.
James
----- Original Message -----
From: "Roeder, Andreas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 3:35 PM
Subject: AbstractMethodError using DOMReader
> Hello,
>
> i tried the following code and got this message :
>
> Exception in thread "main" java.lang.AbstractMethodError
> at org.dom4j.io.DOMReader.readElement(DOMReader.java:181)
> at org.dom4j.io.DOMReader.readTree(DOMReader.java:106)
> at org.dom4j.io.DOMReader.read(DOMReader.java:88)
> at Dom4JTest.parse(Dom4JTest.java:20)
> at Dom4JTest.main(Dom4JTest.java:61)
>
> Do you now any solution for this problem ?
>
> kind regards
>
> Andreas
>
>
> import java.net.URL;
> import java.util.*;
>
> import org.dom4j.Document;
> import org.dom4j.Attribute;
> import org.dom4j.Element;
> import org.dom4j.DocumentException;
> import org.dom4j.io.*;
> import com.softwareag.tamino.api.dom.*;
>
> public class Dom4JTest {
>
> public org.dom4j.Document parse(URL url) throws DocumentException,
> TaminoError {
> TaminoClient tamino = new TaminoClient(url.toString());
> tamino.setPageSize(5);
> TaminoResult tr = tamino.query("/");
> org.w3c.dom.Document doc = tr.getDocument();
> System.out.println(tr.toXmlString());
> DOMReader reader = new DOMReader();
> Document document = reader.read(doc);
> return document;
> }
>
>
>
>
> public void bar(Document document) throws DocumentException {
>
> Element root = document.getRootElement();
>
> // iterate through child elements of root
> for ( Iterator i = root.elementIterator(); i.hasNext(); ) {
> Element element = (Element) i.next();
> // do something
> System.out.println(element.getName());
> }
>
> // iterate through child elements of root with element name "foo"
> /*for ( Iterator i = root.elementIterator( "foo" ); i.hasNext(); )
{
> Element foo = (Element) i.next();
> // do something
> }*/
>
> // iterate through attributes of root
> for ( Iterator i = root.attributeIterator(); i.hasNext(); ) {
> Attribute attribute = (Attribute) i.next();
> System.out.println(attribute);
> // do something
> }
> }
>
> public static void main(String[] args) throws
> java.net.MalformedURLException,
>
> org.dom4j.DocumentException,
> TaminoError {
>
> Dom4JTest test = new Dom4JTest();
> if(args.length == 0) {
> System.out.println("Usage: java Dom4JTest <url>");
> System.exit(0);
> }
> test.bar(test.parse(new URL(args[0])));
>
> }
>
> }
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user