Skip to content

getXMLForFileName

Description

Retrieves a raw XML string and parsed object array for the first XML file with the given name.

Syntax

VabletNativeInterface.callNativeMethod('getXMLForFileName', {fileName: 'XMLFile'}, (res)=>{...})

Options

Key Type Description
fileName string fileName of the XML file to be parsed. Will return the first file found matching the name.

Response

Key Type Description
success boolean Returns true on success and false for any errors.
error string Error message, provided there is one.
xmlString string A string containing the raw XML data.
parsedXML object A parsed object from the XML data. Uses the first row for key names.

Example

VabletNativeInterface.callNativeMethod(
  'getXMLForFileName',
  {fileName: 'XMLFile'},
  (res)=>{
    if (res.success) {
      // Success! Extract values from response
      const {xmlString, parsedXML} = res;

      // Do something!
      alert("Raw XML Data", xmlString);
      alert("Parsed XML Object", parsedXML);
    } else {
      // Uh oh, let's alert the error!
      alert(res.error)
    }
  }
);