context.getRootExpression().resetState();
	public Sequence eval(Sequence args[],		Sequence contextSequence)		throws XPathException {		JavaObjectValue obj =			(JavaObjectValue) args[0].itemAt(0);		String docName = args[1].getLength() == 0 ? null : args[1].getStringValue();		if(docName != null && docName.length() == 0)			docName = null;		Item item =			args[2].itemAt(0);		if (!(obj.getObject() instanceof Collection))			throw new XPathException("Argument 1 should be an instance of org.xmldb.api.base.Collection");		Collection collection = (Collection) obj.getObject();		try {			XMLResource resource =				(XMLResource) collection.createResource(docName, "XMLResource");			if(Type.subTypeOf(item.getType(), Type.STRING)) {				resource.setContent(item.getStringValue());			} else if(Type.subTypeOf(item.getType(), Type.NODE)) {				ContentHandler handler = resource.setContentAsSAX();				handler.startDocument();				item.toSAX(context.getBroker(), handler);				handler.endDocument();			} else				throw new XPathException("Data should be either a node or a string");			collection.storeResource(resource);		} catch (XMLDBException e) {			throw new XPathException(				"XMLDB reported an exception while storing document",				e);		} catch (SAXException e) {			throw new XPathException(				"SAX reported an exception while storing document",				e);		}		return Sequence.EMPTY_SEQUENCE;	}