public class XFormParser extends Object implements IXFormParserFunctions
| Modifier and Type | Class and Description |
|---|---|
static interface |
XFormParser.BindAttributeProcessor |
static interface |
XFormParser.ErrorCallback |
static interface |
XFormParser.FormDefProcessor |
static class |
XFormParser.MissingModelAttributeException |
static interface |
XFormParser.ModelAttributeProcessor |
static class |
XFormParser.ParseException |
static interface |
XFormParser.Processor |
static interface |
XFormParser.QuestionProcessor |
static interface |
XFormParser.WarningCallback |
static interface |
XFormParser.XPathProcessor |
| Modifier and Type | Field and Description |
|---|---|
static String |
EVENT_ATTR |
static String |
ITEXT_CLOSE |
static String |
ITEXT_OPEN |
static String |
NAMESPACE_JAVAROSA |
static String |
NAMESPACE_ODK |
static List<XFormParser.XPathProcessor> |
tempXPathProcessors |
| Constructor and Description |
|---|
XFormParser(org.kxml2.kdom.Document doc) |
XFormParser(org.kxml2.kdom.Document form,
org.kxml2.kdom.Document instance) |
XFormParser(Reader reader) |
XFormParser(Reader form,
Reader instance) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBindAttributeProcessor(XFormParser.BindAttributeProcessor bindAttributeProcessor) |
void |
addFormDefProcessor(XFormParser.FormDefProcessor formDefProcessor) |
void |
addModelAttributeProcessor(XFormParser.ModelAttributeProcessor modelAttributeProcessor) |
void |
addProcessor(XFormParser.Processor processor) |
static TreeElement |
buildInstanceStructure(org.kxml2.kdom.Element node,
TreeElement parent,
Map<String,String> namespacePrefixesByUri,
Integer multiplicityFromGroup) |
static TreeElement |
buildInstanceStructure(org.kxml2.kdom.Element node,
TreeElement parent,
String instanceName,
String docnamespace,
Map<String,String> namespacePrefixesByUri,
Integer multiplicityFromGroup)
Parses instance hierarchy and turns into a skeleton model; ignoring data content,
but respecting repeated nodes and 'template' flags
|
IDataReference |
getAbsRef(IDataReference ref,
IFormElement parent) |
static IAnswerResolver |
getAnswerResolver() |
static String |
getVagueLocation(org.kxml2.kdom.Element e) |
static List<String> |
getValidEventNames(String eventsString) |
static org.kxml2.kdom.Document |
getXMLDocument(Reader reader) |
static org.kxml2.kdom.Document |
getXMLDocument(Reader reader,
CacheTable<String> stringCache)
Deprecated.
The InterningKXmlParser is not used.
|
static String |
getXMLText(org.kxml2.kdom.Node n,
boolean trim) |
static String |
getXMLText(org.kxml2.kdom.Node node,
int i,
boolean trim)
reads all subsequent text nodes and returns the combined string
needed because escape sequences are parsed into consecutive text nodes
e.g.
|
static QuestionDef |
ghettoGetQuestionDef(int dataType,
FormDef f,
TreeReference ref)
Finds a questiondef that binds to ref, if the data type is a 'select' question type
|
void |
onError(XFormParser.ErrorCallback callback) |
void |
onWarning(XFormParser.WarningCallback callback) |
FormDef |
parse() |
FormDef |
parse(String lastSavedSrc) |
FormDef |
parse(String formXmlSrc,
String lastSavedSrc) |
void |
parseSetValueAction(ActionController source,
org.kxml2.kdom.Element e) |
protected QuestionDef |
parseUpload(IFormElement parent,
org.kxml2.kdom.Element e,
int controlUpload) |
static void |
recordInstanceFunctionCall(String instanceId)
Records that the given instance ID was used as the argument to an instance() function call.
|
static void |
registerActionHandler(String name,
IElementHandler specificHandler)
Let the parser know how to handle a given action -- All actions are first parsed by the
generic parseAction() method, which is passed another handler to invoke after the generic
handler is done
|
void |
registerActionTarget(TreeReference target)
Notify parser about a node that will later be relevant to an action.
|
static FormInstance |
restoreDataModel(byte[] data,
Class restorableType) |
static FormInstance |
restoreDataModel(org.kxml2.kdom.Document doc,
Class restorableType) |
static FormInstance |
restoreDataModel(InputStream input,
Class restorableType) |
static void |
setAnswerResolver(IAnswerResolver answerResolver) |
public static final String NAMESPACE_JAVAROSA
public static final String NAMESPACE_ODK
public static final String ITEXT_CLOSE
public static final String ITEXT_OPEN
public static final String EVENT_ATTR
public static final List<XFormParser.XPathProcessor> tempXPathProcessors
public XFormParser(Reader reader)
public XFormParser(org.kxml2.kdom.Document doc)
public XFormParser(org.kxml2.kdom.Document form,
org.kxml2.kdom.Document instance)
public static IAnswerResolver getAnswerResolver()
public static void setAnswerResolver(IAnswerResolver answerResolver)
public FormDef parse(String lastSavedSrc) throws XFormParser.ParseException
XFormParser.ParseExceptionpublic FormDef parse() throws XFormParser.ParseException
XFormParser.ParseExceptionpublic FormDef parse(String formXmlSrc, String lastSavedSrc) throws XFormParser.ParseException
formXmlSrc - The path of the form definition.lastSavedSrc - The src of the last-saved instance of this form (for auto-filling). If null,
no data will be loaded and the instance will be blank.XFormParser.ParseExceptionpublic void addProcessor(XFormParser.Processor processor)
public void addBindAttributeProcessor(XFormParser.BindAttributeProcessor bindAttributeProcessor)
public void addFormDefProcessor(XFormParser.FormDefProcessor formDefProcessor)
public void addModelAttributeProcessor(XFormParser.ModelAttributeProcessor modelAttributeProcessor)
public static org.kxml2.kdom.Document getXMLDocument(Reader reader) throws IOException
IOException@Deprecated public static org.kxml2.kdom.Document getXMLDocument(Reader reader, CacheTable<String> stringCache) throws IOException
reader - the XML content providerstringCache - an optional string cache, whose presence will cause the use of
InterningKXmlParser rather than KXmlParser.IOExceptionpublic static void recordInstanceFunctionCall(String instanceId)
public void parseSetValueAction(ActionController source, org.kxml2.kdom.Element e)
protected QuestionDef parseUpload(IFormElement parent, org.kxml2.kdom.Element e, int controlUpload) throws XFormParser.ParseException
XFormParser.ParseExceptionpublic IDataReference getAbsRef(IDataReference ref, IFormElement parent)
getAbsRef in interface IXFormParserFunctionspublic static TreeElement buildInstanceStructure(org.kxml2.kdom.Element node, TreeElement parent, Map<String,String> namespacePrefixesByUri, Integer multiplicityFromGroup)
public static TreeElement buildInstanceStructure(org.kxml2.kdom.Element node, TreeElement parent, String instanceName, String docnamespace, Map<String,String> namespacePrefixesByUri, Integer multiplicityFromGroup)
node - the input nodeparent - the parentinstanceName - the name of the instancedocnamespace - namespacePrefixesByUri - namespace prefixes, by URImultiplicityFromGroup - if not null, the multiplicity to use. If present, a potentially
expensive search can be avoided.public static QuestionDef ghettoGetQuestionDef(int dataType, FormDef f, TreeReference ref)
public static void registerActionHandler(String name, IElementHandler specificHandler)
specificHandler - the handler for the specific action indicated by name, which
is passed to and invoked by the generic parseAction() handlerpublic void registerActionTarget(TreeReference target)
public static String getXMLText(org.kxml2.kdom.Node n, boolean trim)
public static String getXMLText(org.kxml2.kdom.Node node, int i, boolean trim)
public static FormInstance restoreDataModel(InputStream input, Class restorableType) throws IOException
IOExceptionpublic static FormInstance restoreDataModel(org.kxml2.kdom.Document doc, Class restorableType)
public static FormInstance restoreDataModel(byte[] data, Class restorableType)
public static String getVagueLocation(org.kxml2.kdom.Element e)
public void onWarning(XFormParser.WarningCallback callback)
public void onError(XFormParser.ErrorCallback callback)
Copyright © 2024. All rights reserved.