public class XMLSaxProcessor
extends java.lang.Object
//Create a processor with XMLSaxToJUnitXMLHandler to convert 'SAFS XML Log' into JUnit xml report. String source = "C:\\temp\\safstest\\Datapool\\Logs\\TIDTest.SAFS.xml"; XMLSaxProcessor sxp = new XMLSaxProcessor(new FileReader(source), new XMLSaxToJUnitXMLHandler()); Object result = sxp.parse(); System.out.println(result); //Use the same processor to process another 'SAFS XML Log'. source = "C:\\SeleniumPlusProjects\\AUTOCOUNTABLETEST\\Logs\\VATest.xml"; sxp.setSource(new InputSource(new FileReader(source))); result = sxp.parse(); System.out.println(result); //Create a new processor with XMLSaxToRepositoryHandler to push 'SAFS XML Log' into 'safs data repository'. String safsdataServiceURL = "http://safsDataService"; source = "C:\\temp\\safstest\\Datapool\\Logs\\TIDTest.SAFS.xml"; sxp = new XMLSaxProcessor(new FileReader(source), new XMLSaxToRepositoryHandler(safsdataServiceURL)); Object result = sxp.parse(); System.out.println(result);
| Modifier and Type | Field and Description |
|---|---|
protected XMLSaxAbstractHandler |
handler |
protected org.xml.sax.InputSource |
inputSource |
protected javax.xml.parsers.SAXParser |
saxParser |
| Constructor and Description |
|---|
XMLSaxProcessor(org.xml.sax.InputSource inputSource,
XMLSaxAbstractHandler handler) |
XMLSaxProcessor(java.io.InputStream source,
XMLSaxAbstractHandler handler) |
XMLSaxProcessor(java.io.Reader source,
XMLSaxAbstractHandler handler) |
XMLSaxProcessor(java.lang.String source,
XMLSaxAbstractHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterParse() |
protected void |
beforeParse() |
static void |
main(java.lang.String[] args)
Convert the SAFS XML Log into JUnit XML report.
|
java.lang.Object |
parse() |
void |
setInputSource(org.xml.sax.InputSource inputSource) |
protected javax.xml.parsers.SAXParser saxParser
protected org.xml.sax.InputSource inputSource
protected XMLSaxAbstractHandler handler
public XMLSaxProcessor(java.io.Reader source,
XMLSaxAbstractHandler handler)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionpublic XMLSaxProcessor(java.lang.String source,
XMLSaxAbstractHandler handler)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionpublic XMLSaxProcessor(java.io.InputStream source,
XMLSaxAbstractHandler handler)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionpublic XMLSaxProcessor(org.xml.sax.InputSource inputSource,
XMLSaxAbstractHandler handler)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionpublic void setInputSource(org.xml.sax.InputSource inputSource)
protected void beforeParse()
throws SAFSException
SAFSExceptionprotected void afterParse()
throws SAFSException
SAFSExceptionpublic java.lang.Object parse()
throws SAFSException
SAFSExceptionpublic static void main(java.lang.String[] args)
java XMLSaxProcessor -source SAFSXMLLog.xml [-counterunit TESTCASE|TESTSTEP] [-out junitLog.xml] [-safsdata http://safsdataurl] java XMLSaxProcessor -s SAFSXMLLog.xml [-cu TESTCASE|TESTSTEP] [-o junitLog.xml] [-d http://safsdataurl]Examples:
java XMLSaxProcessor -source SAFSXMLLog.xml java XMLSaxProcessor -source SAFSXMLLog.xml -out junitLog.xml java XMLSaxProcessor -source SAFSXMLLog.xml -counterunit TESTSTEP -out junitLog.xml java XMLSaxProcessor -source SAFSXMLLog.xml -safsdata http://safsdataurl java XMLSaxProcessor -source SAFSXMLLog.xml -out junitLog.xml -safsdata http://safsdataurl
args - Copyright © SAS Institute. All Rights Reserved.