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 void
characters(char[] ch, int start, int length)
void
endElement(String uri, String localName, String qName)
void
error(SAXParseException e)
XmlSuite
getSuite()
InputSource
resolveEntity(String systemId, String publicId)
void
startElement(String uri, String localName, String qName, Attributes attributes)
NOTE: I only invoke xml*methods (e.g.void
xmlClasses(boolean start, Attributes attributes)
Parsevoid
xmlGroup(boolean start, Attributes attributes)
Parsevoid
xmlGroups(boolean start, Attributes attributes)
Parsevoid
xmlListener(boolean start, Attributes attributes)
Parsevoid
xmlListeners(boolean start, Attributes attributes)
Parsevoid
xmlMethodSelector(boolean start, Attributes attributes)
Parsevoid
xmlMethodSelectors(boolean start, Attributes attributes)
Parsevoid
xmlPackages(boolean start, Attributes attributes)
Parsevoid
xmlRun(boolean start, Attributes attributes)
Parsevoid
xmlSelectorClass(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:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
- Throws:
IOException
SAXException
-
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 SAXException
Parse- Throws:
SAXException
-
xmlGroup
public void xmlGroup(boolean start, Attributes attributes) throws SAXException
Parse- Throws:
SAXException
-
xmlGroups
public void xmlGroups(boolean start, Attributes attributes) throws SAXException
Parse- 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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
error
public void error(SAXParseException e) throws SAXException
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length)
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
-
getSuite
public XmlSuite getSuite()
-
-