Package org.apache.xml.utils
Class StylesheetPIHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.xml.utils.StylesheetPIHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
Search for the xml-stylesheet processing instructions in an XML document.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStylesheetPIHandler
(String baseID, String media, String title, String charset) Construct a StylesheetPIHandler instance that will search for xml-stylesheet PIs based on the given criteria. -
Method Summary
Modifier and TypeMethodDescriptionReturn the last stylesheet found that match the constraints.Get the object that will be used to resolve URIs in href in xml-stylesheet processing instruction.void
processingInstruction
(String target, String data) Handle the xml-stylesheet processing instruction.void
Added additional getter and setter methods for the Base Id to fix bugzilla bug 24187void
setURIResolver
(URIResolver resolver) Get the object that will be used to resolve URIs in href in xml-stylesheet processing instruction.void
startElement
(String namespaceURI, String localName, String qName, Attributes atts) The spec notes that "The xml-stylesheet processing instruction is allowed only in the prolog of an XML document.", so, at least for right now, I'm going to go ahead an throw a TransformerException in order to stop the parse.Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
StylesheetPIHandler
Construct a StylesheetPIHandler instance that will search for xml-stylesheet PIs based on the given criteria.- Parameters:
baseID
- The base ID of the XML document, needed to resolve relative IDs.media
- The desired media criteria.title
- The desired title criteria.charset
- The desired character set criteria.
-
-
Method Details
-
setURIResolver
Get the object that will be used to resolve URIs in href in xml-stylesheet processing instruction.- Parameters:
resolver
- An object that implements the URIResolver interface, or null.
-
getURIResolver
Get the object that will be used to resolve URIs in href in xml-stylesheet processing instruction.- Returns:
- The URIResolver that was set with setURIResolver.
-
getAssociatedStylesheet
Return the last stylesheet found that match the constraints.- Returns:
- Source object that references the last stylesheet reference that matches the constraints.
-
processingInstruction
Handle the xml-stylesheet processing instruction.- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classDefaultHandler
- Parameters:
target
- The processing instruction target.data
- The processing instruction data, or null if none is supplied.- Throws:
SAXException
- Any SAX exception, possibly wrapping another exception.- See Also:
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException The spec notes that "The xml-stylesheet processing instruction is allowed only in the prolog of an XML document.", so, at least for right now, I'm going to go ahead an throw a TransformerException in order to stop the parse.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
namespaceURI
- The Namespace URI, or an empty string.localName
- The local name (without prefix), or empty string if not namespace processing.qName
- The qualified name (with prefix).atts
- The specified or defaulted attributes.- Throws:
StopParseException
- since there can be no valid xml-stylesheet processing instructions past the first element.SAXException
-
setBaseId
Added additional getter and setter methods for the Base Id to fix bugzilla bug 24187 -
getBaseId
-