Home | History | Annotate | Download | only in xml
      1 package org.testng.xml;
      2 
      3 import org.testng.TestNGException;
      4 import org.xml.sax.SAXException;
      5 
      6 import java.io.IOException;
      7 import java.io.InputStream;
      8 
      9 public class SuiteXmlParser extends XMLParser<XmlSuite> implements ISuiteParser {
     10 
     11   @Override
     12   public XmlSuite parse(String currentFile, InputStream inputStream, boolean loadClasses) {
     13     TestNGContentHandler contentHandler = new TestNGContentHandler(currentFile, loadClasses);
     14 
     15     try {
     16       parse(inputStream, contentHandler);
     17 
     18       return contentHandler.getSuite();
     19     } catch (SAXException | IOException e) {
     20       throw new TestNGException(e);
     21     }
     22   }
     23 
     24   @Override
     25   public boolean accept(String fileName) {
     26     return fileName.endsWith(".xml");
     27   }
     28 }
     29