I've found it...
selectPath( instructionXpath ); returns void! ________________________________ From: Chris Snow [mailto:[EMAIL PROTECTED] Sent: 19 March 2008 10:02 To: user@xmlbeans.apache.org Subject: java.lang.IllegalStateException: Cursor has been disposed I have a message that is throwing java.lang.IllegalStateException: Cursor has been disposed I can't see what I am doing wrong. Any help would be most appreciated. Thanks in advance ... public Instruction fromMessage(Message msg) throws MessageConversionException { TextMessage textMessage = (TextMessage)msg; Instruction instruction = null; MainInstructionWrapperDocument instructionDocument = null; try { System.out.println( "InstructionRequestConverterImpl: fromMessage()" ); //System.out.println( textMessage.getText() ); XmlOptions options = new XmlOptions(); options.setSaveOuter(); ArrayList validationErrors = new ArrayList(); XmlOptions validationOptions = new XmlOptions(); validationOptions.setErrorListener(validationErrors); instructionDocument = MainInstructionWrapperDocument.Factory.parse( textMessage.getText() ); boolean isValid = instructionDocument.validate(validationOptions); if (!isValid) { Iterator iter = validationErrors.iterator(); while (iter.hasNext()) { System.out.println(">> " + iter.next() + "\n"); } } // The next line throws: // java.lang.IllegalStateException: Cursor has been disposed Instruction[] instructionArray = (Instruction[])instructionDocument.getMainInstructionWrapper().selectPat h( instructionXpath ); instruction = instructionArray[0]; // only one child instruction per wrapper } catch (Exception e) { // TODO: log e.printStackTrace(); throw new MessageConversionException(e.getMessage()); } return instruction; }