FormXml

public class FormXml

This class represents an XML of a Commcare form, that is sent to the Commcare server via Commcare submission API.

Methods

addFormField

public void addFormField(FormValueElement field)

Adds a new form field to this form XML representation.

Parameters:
  • field – the field to add

getElementByPath

public FormValueElement getElementByPath(String... path)

Gets element by the provided path. If any of the elements on the path does not exist, it is created.

Parameters:
  • path – an array of element names, starting with the most outer one
Returns:

the element from the xml representation, specified by the path and created, if it didn’t exist

getElementByPath

public FormValueElement getElementByPath(List<String> path)

Gets element by the provided path. If any of the elements on the path does not exist, it is created.

Parameters:
  • path – a list of element names, starting with the most outer one
Returns:

the element from the xml representation, specified by the path and created, if it didn’t exist

getFormFields

public List<FormValueElement> getFormFields()

getMetadata

public Map<String, MetadataValue> getMetadata()

getName

public String getName()

getUiversion

public String getUiversion()

getVersion

public String getVersion()

getXmlns

public String getXmlns()

setFormFields

public void setFormFields(List<FormValueElement> formFields)

setMetadata

public void setMetadata(Map<String, MetadataValue> metadata)

setName

public void setName(String name)

setUiversion

public void setUiversion(String uiversion)

setVersion

public void setVersion(String version)

setXmlns

public void setXmlns(String xmlns)