getNextSibling() error

somehow get an exception error while accessing the next sibling()?? anyone can help?

java.lang.ClassCastException: com.docuverse.dom.BasicText
at QConstruction.showResult(QConstruction.java:97)
at QConstruction.doPost(QConstruction.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:911)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:824)
at org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Ajp13Interceptor.java:167)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:505)
at java.lang.Thread.run(Thread.java:484)
__
i am using w3cdom1.jar but i dont know whey it keep referencing to com.docuverse.dom.BasicText ??

TaminoResult tr = tamino.query(“/Construction”);
Element rootNode = (Element)tr.getElement();
out.println(“NodeName = " + rootNode.getNodeName()+rootNode.getNodeValue()+”
“);

Element construction = (Element) rootNode.getFirstChild();
out.println(”NodeName = " + construction.getNodeName()+construction.getNodeValue()+“
”);
construction1 = (Element)construction.getNextSibling(); // this is the problem statement

anyone can help pls?

thanks

cheers !

typo : construction1 = construction

The servlet is able to compile but unable to execute in tomcat und apache.
hmm the funny thing is if i declare a Node type

regards

cheers !

Unfortunately the next sibling may not be an Element. The best thing to do is check the type of the next sibling before doing the cast. You may find that it is a BasicText if there is white space between the Elements. The reason you have BasicElement + BasicText is because the API uses the docuverse DOM to do its parsing. However the BasicElement class implements the DOM Element class as expected.

thanks … came to find that one out too.
As long as there is a carriage return in between
tags well there will be a text node an I will have to check for that.

well thanks alot :slight_smile:

regards

cheers !