Package com.icl.saxon
Class PIGrabber
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- com.icl.saxon.PIGrabber
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class PIGrabber extends org.xml.sax.helpers.DefaultHandler
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 Constructor Description PIGrabber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.transform.sax.SAXSource[]
getAssociatedStylesheets()
Return list of stylesheets that matched, as an array of Source objectsjava.lang.String[]
getStylesheetURIs()
Get the stylesheet URIs as an array of Stringsvoid
processingInstruction(java.lang.String target, java.lang.String data)
Handle xml-stylesheet PIvoid
setBaseURI(java.lang.String uri)
Set the base URIvoid
setCriteria(java.lang.String media, java.lang.String title, java.lang.String charset)
void
setURIResolver(javax.xml.transform.URIResolver resolver)
Set the URI resolver to be used for the href attributevoid
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
Abort the parse when the first start element tag is found
-
-
-
Method Detail
-
setCriteria
public void setCriteria(java.lang.String media, java.lang.String title, java.lang.String charset)
-
setBaseURI
public void setBaseURI(java.lang.String uri)
Set the base URI
-
setURIResolver
public void setURIResolver(javax.xml.transform.URIResolver resolver)
Set the URI resolver to be used for the href attribute
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
Abort the parse when the first start element tag is found- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
Handle xml-stylesheet PI- Specified by:
processingInstruction
in interfaceorg.xml.sax.ContentHandler
- Overrides:
processingInstruction
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
getAssociatedStylesheets
public javax.xml.transform.sax.SAXSource[] getAssociatedStylesheets() throws javax.xml.transform.TransformerException
Return list of stylesheets that matched, as an array of Source objects- Returns:
- null if there were no matching stylesheets.
- Throws:
javax.xml.transform.TransformerException
- if a URI cannot be resolved
-
getStylesheetURIs
public java.lang.String[] getStylesheetURIs() throws org.xml.sax.SAXException
Get the stylesheet URIs as an array of Strings- Throws:
org.xml.sax.SAXException
-
-