title: PySpark XML processing - Ignoring bad records
body: <p>I am processing a large XML file using the Spark XML Library (HyukjinKwon:spark-xml:0.1.1-s_2.11). The XML processing fails with an analysis exception for a couple of records. I would like to keep processing the file ignoring these records. </p>
  
  <p>I have the below code for processing the xml and I tried the option of 'DROPMALFORMED' but didn't help.</p>
  
  <pre><code>df = (spark.read.format("xml")
        .option("rootTag","Articles")
        .option("rowTag", "Article")
        .option("inferSchema", "true")
        .option("mode", "DROPMALFORMED")
        .load("/mnt/RawAdl2/problemfile.xml"))
  
  AnalysisException: "cannot resolve '['Affiliation']' due to data type mismatch: argument 2 requires integral type, however, ''Affiliation'' is of string type.;
  </code></pre>
  
  <p>I would like to drop the malformed records and continue with the processing of the file. Is there any other option I could try? Appreciate the inputs!</p>
  
  <p>EDIT: Looking at the source code <a href="https://github.com/databricks/spark-xml/pull/22/files/3cab3933319bdbee9bd9c314d7a2c70071ffc439#diff-d85018a30b75475a6008ee92c967036b" rel="nofollow noreferrer">link</a> the Malformed option is supported by the library. As I am not well versed with Scala, I am not really sure whether I am using the correct syntax for this option. Please advise. </p>
  
  <p>After going through the source code, I tried this below code but no luck</p>
  
  <pre><code>.option("mode", "DROP_MALFORMED_MODE")
  </code></pre>