Class PIGrabber
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.icl.saxon.PIGrabber
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
The PIGrabber class is a SAX ContentHandler that looks for xml-stylesheet processing
instructions and tests whether they match specified criteria; for those that do, it creates
an InputSource object referring to the relevant stylesheet
- Author:
- Michael H. Kay
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn list of stylesheets that matched, as an array of Source objectsString[]Get the stylesheet URIs as an array of StringsvoidprocessingInstruction(String target, String data) Handle xml-stylesheet PIvoidsetBaseURI(String uri) Set the base URIvoidsetCriteria(String media, String title, String charset) voidsetURIResolver(URIResolver resolver) Set the URI resolver to be used for the href attributevoidstartElement(String uri, String localName, String qName, Attributes attributes) Abort the parse when the first start element tag is foundMethods inherited from class DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Constructor Details
-
PIGrabber
public PIGrabber()
-
-
Method Details
-
setCriteria
-
setBaseURI
Set the base URI -
setURIResolver
Set the URI resolver to be used for the href attribute -
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Abort the parse when the first start element tag is found- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
processingInstruction
Handle xml-stylesheet PI- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
getAssociatedStylesheets
Return list of stylesheets that matched, as an array of Source objects- Returns:
- null if there were no matching stylesheets.
- Throws:
TransformerException- if a URI cannot be resolved
-
getStylesheetURIs
Get the stylesheet URIs as an array of Strings- Throws:
SAXException
-