/** * This method gets formObject from submitted Application * * @param submittedXml GrantApplicationDocument object of the submitted form. * @param info form mapping information of the form. * @return XmlObject form object corresponding to the GrantApplicationDocument and FormMappingInfo * objects. * @throws S2SException */ protected XmlObject getFormObject(GrantApplicationDocument submittedXml, FormMappingInfo info) { XmlObject formObject = null; Forms forms = submittedXml.getGrantApplication().getForms(); return forms.newCursor().getObject(); // if (forms != null) { // XmlCursor formCursor = forms.newCursor(); // formCursor.toNextToken(); // do { // if (formCursor.getName().getNamespaceURI().equals( // info.getNameSpace())) { // formObject = formCursor.getObject(); // break; // } // } while (formCursor.toNextSibling()); // } // return formObject; }
protected void setFormObject(Forms forms, XmlObject formObject) { // Create a cursor from the grants.gov form XmlCursor formCursor = formObject.newCursor(); formCursor.toStartDoc(); formCursor.toNextToken(); // Create a cursor from the Forms object XmlCursor metaGrantCursor = forms.newCursor(); metaGrantCursor.toNextToken(); // Add the form to the Forms object. formCursor.moveXml(metaGrantCursor); }