I'm using jre 1.4.1. I have an xsp which captures a fragment of xml, and passes it to a class:
<capture:fragment-variable name="frag"> <foo><bar/></foo> </capture:fragment-variable> <xsp:logic> MyClass.doSomething(frag); </xsp:logic> This passes an XMLFragment which I convert to a node: public class MyClass { public static void doSomething(XMLFragment frag){ Node node = frag2Node(frag); ... } public Node frag2Node(XMLFragment frag){ Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDo cument(); Node dummy = doc.createElement("dummy"); doc.appendChild(dummy); frag.toDOM(dummy); return dummy.getFirstChild(); } When Cocoon runs, I get an exception in the call to frag.toDOM(dummy) It is a null pointer exception java.lang.NullPointerException at org.apache.xalan.transformer.TransformerIdentityImpl.flushStartDoc(T ransformerIdentityImpl.java:885) at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tr ansformerIdentityImpl.java:1016) at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.j ava:130) at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.j ava:130) at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLB yteStreamInterpreter.java:126) at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserializ e(XMLByteStreamInterpreter.java:102) at org.apache.cocoon.components.sax.XMLByteStreamFragment.toSAX(XMLByte StreamFragment.java:100) at org.apache.cocoon.xml.AbstractSAXFragment.toDOM(AbstractSAXFragment. java:76) Can anyone see what the problem is - I've searched in vain! Alternatively, is there a more elegant way of converting the XMLFragment passed by Cocoon as a parameter into a DOM node?! Robert Onslow ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>