
org.javarosa.xform.parse.SubmissionParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opendatakit-javarosa Show documentation
Show all versions of opendatakit-javarosa Show documentation
A Java library for rendering forms that are compliant with ODK XForms spec
The newest version!
/**
*
*/
package org.javarosa.xform.parse;
import org.javarosa.core.model.IDataReference;
import org.javarosa.core.model.SubmissionProfile;
import org.kxml2.kdom.Element;
import java.util.HashMap;
/**
* A Submission Profile
*
* @author ctsims
*
*/
public class SubmissionParser {
public SubmissionProfile parseSubmission(String method, String action, IDataReference ref, Element element) {
String mediatype = element.getAttributeValue(null,"mediatype");
HashMap attributeMap = new HashMap();
int nAttr = element.getAttributeCount();
for ( int i = 0 ; i < nAttr ; ++i ) {
String name = element.getAttributeName(i);
if ( name.equals("ref")) continue;
if ( name.equals("bind")) continue;
if ( name.equals("method")) continue;
if ( name.equals("action")) continue;
String value = element.getAttributeValue(i);
attributeMap.put(name, value);
}
return new SubmissionProfile(ref, method, action, mediatype, attributeMap);
}
public boolean matchesCustomMethod(String method) {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy