Package org.testng.xml
Class TestNGContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.testng.xml.TestNGContentHandler
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
public class TestNGContentHandler extends DefaultHandler
Suite definition parser utility.- Author:
- Cedric Beust, Alexandru Popescu
-
-
Constructor Summary
Constructors Constructor Description TestNGContentHandler(String fileName, boolean loadClasses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidendElement(String uri, String localName, String qName)voiderror(SAXParseException e)XmlSuitegetSuite()InputSourceresolveEntity(String systemId, String publicId)voidstartElement(String uri, String localName, String qName, Attributes attributes)NOTE: I only invoke xml*methods (e.g.voidxmlClasses(boolean start, Attributes attributes)ParsevoidxmlGroup(boolean start, Attributes attributes)ParsevoidxmlGroups(boolean start, Attributes attributes)ParsevoidxmlListener(boolean start, Attributes attributes)ParsevoidxmlListeners(boolean start, Attributes attributes)ParsevoidxmlMethodSelector(boolean start, Attributes attributes)ParsevoidxmlMethodSelectors(boolean start, Attributes attributes)ParsevoidxmlPackages(boolean start, Attributes attributes)ParsevoidxmlRun(boolean start, Attributes attributes)ParsevoidxmlSelectorClass(boolean start, Attributes attributes)Parse-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
TestNGContentHandler
public TestNGContentHandler(String fileName, boolean loadClasses)
-
-
Method Detail
-
resolveEntity
public InputSource resolveEntity(String systemId, String publicId) throws IOException, SAXException
- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler- Throws:
IOExceptionSAXException
-
xmlClasses
public void xmlClasses(boolean start, Attributes attributes)Parse
-
xmlListeners
public void xmlListeners(boolean start, Attributes attributes)Parse
-
xmlListener
public void xmlListener(boolean start, Attributes attributes)Parse
-
xmlPackages
public void xmlPackages(boolean start, Attributes attributes)Parse
-
xmlMethodSelectors
public void xmlMethodSelectors(boolean start, Attributes attributes)Parse
-
xmlSelectorClass
public void xmlSelectorClass(boolean start, Attributes attributes)Parse
-
xmlMethodSelector
public void xmlMethodSelector(boolean start, Attributes attributes)Parse
-
xmlRun
public void xmlRun(boolean start, Attributes attributes) throws SAXExceptionParse- Throws:
SAXException
-
xmlGroup
public void xmlGroup(boolean start, Attributes attributes) throws SAXExceptionParse- Throws:
SAXException
-
xmlGroups
public void xmlGroups(boolean start, Attributes attributes) throws SAXExceptionParse- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
NOTE: I only invoke xml*methods (e.g. xmlSuite()) if I am acting on both the start and the end of the tag. This way I can keep the treatment of this tag in one place. If I am only doing something when the tag opens, the code is inlined below in the startElement() method.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
error
public void error(SAXParseException e) throws SAXException
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length)- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
getSuite
public XmlSuite getSuite()
-
-