lib/index.js
function parseXmlFromFile(fileName) {
  try {
    var xmlFile = fs.readFileSync(fileName, "utf8");
    var xmlDoc = new xmldoc.XmlDocument(xmlFile);

    // Single testsuite, not wrapped in a testsuites
    if (xmlDoc.name === "testsuite") {
      module.exports.testsuites = xmlDoc;
      module.exports.testsuiteCount = 1;
    } else {
      // Multiple testsuites, wrapped in a parent
      module.exports.testsuites = xmlDoc.childrenNamed("testsuite");
      module.exports.testsuiteCount = module.exports.testsuites.length;
    }

    return xmlDoc;
  } catch (e) {
    if (e.code === "ENOENT") {
      // Bad directory
      return "File not found";
    }
    // Unknown error
    return e;
  }
}
function parseXmlFromFile(fileName) {
  try {
    var xmlFile = fs.readFileSync(fileName, "utf8");
    var xmlDoc = new xmldoc.XmlDocument(xmlFile);

    // Single testsuite, not wrapped in a testsuites
    if (xmlDoc.name === "testsuite") {
      module.exports.testsuites = xmlDoc;
      module.exports.testsuiteCount = 1;
    } else {
      // Multiple testsuites, wrapped in a parent
      module.exports.testsuites = xmlDoc.childrenNamed("testsuite");
      module.exports.testsuiteCount = module.exports.testsuites.length;
    }

    return xmlDoc;
  } catch (e) {
    if (e.code === "ENOENT") {
      // Bad directory
      return "File not found";
    }
    // Unknown error
    return e;
  }
}
function parseXmlFromFile ( fileName ) { try { var xmlFile = fs . readFileSync ( fileName , "utf8" ) ; var xmlDoc = new xmldoc . XmlDocument ( xmlFile ) ; // Single testsuite, not wrapped in a testsuites if ( xmlDoc . name === "testsuite" ) { module . exports . testsuites = xmlDoc ; module . exports . testsuiteCount = 1 ; } else { // Multiple testsuites, wrapped in a parent module . exports . testsuites = xmlDoc . childrenNamed ( "testsuite" ) ; module . exports . testsuiteCount = module . exports . testsuites . length ; } return xmlDoc ; } catch ( e ) { if ( e . code === "ENOENT" ) { // Bad directory return "File not found" ; } // Unknown error return e ; } }
Read XML from file
@param {string} fileName
Read XML from file