public class StylesheetPIHandler extends DefaultHandler
Constructor and Description |
---|
StylesheetPIHandler(String baseID,
String media,
String title,
String charset)
Construct a StylesheetPIHandler instance that will search
for xml-stylesheet PIs based on the given criteria.
|
Modifier and Type | Method and Description |
---|---|
Source |
getAssociatedStylesheet()
Return the last stylesheet found that match the constraints.
|
String |
getBaseId() |
URIResolver |
getURIResolver()
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 |
setBaseId(String baseId)
Added additional getter and setter methods for the Base Id
to fix bugzilla bug 24187
|
void |
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.
|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public StylesheetPIHandler(String baseID, String media, String title, String charset)
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.public void setURIResolver(URIResolver resolver)
resolver
- An object that implements the URIResolver interface,
or null.public URIResolver getURIResolver()
public Source getAssociatedStylesheet()
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class DefaultHandler
target
- The processing instruction target.data
- The processing instruction data, or null if
none is supplied.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
,
Associating Style Sheets with XML documents, Version 1.0public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
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.StopParseException
- since there can be no valid xml-stylesheet processing
instructions past the first element.SAXException
public void setBaseId(String baseId)
public String getBaseId()
Copyright © 2017 JBoss by Red Hat. All rights reserved.