Dear All!
I'm writing a business method of an entity bean which is supposed to read some informations from an XML file. I use the following code:
To get the parser and the document:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse( xmlFile );
NodeList nl = doc.getElementsByTagName( tagName ); int elemCount = nl.getLength(); for( int i = 0; i < elemCount; i++ ) { Element element = ( Element )nl.item( i ); String test = element.getTextContent(); (...) }
org.jboss.tm.JBossTransactionRolledbackException: Unexpected Error java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String; at levia.messages.ejb.MessageTypeBean.requiredInformations(MessageTypeBean.java:345) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
Text tester = (Text) elem.getFirstChild(); String blalba = tester.getNodeValue();