Package org.smooks.engine.delivery.dom
Class DOMParser
- java.lang.Object
-
- org.smooks.engine.delivery.AbstractParser
-
- org.smooks.engine.delivery.dom.DOMParser
-
public class DOMParser extends AbstractParser
Smooks DOM data stream parser. This parser can be configured to use a SAX Parser targeted at a specific data stream type. This lets you parse a stream of any type, convert it to a stream of SAX event and so treat the stream as an XML data stream, even when the stream is non-XML. If the configured parser implements theSmooksXMLReader, the configuration will be passed to the parser viaInjectannotations on config properties defined on the implementation..cdrl Configuration
<smooks-resource selector="org.xml.sax.driver" path="org.smooks.protocolx.XParser" > <!-- Optional list of driver parameters forSmooksXMLReaderimplementations. SeeResourceConfigfor how to add configuration parameters. --> </smooks-resource>- Author:
- tfennelly
-
-
Field Summary
-
Fields inherited from class org.smooks.engine.delivery.AbstractParser
FEATURE_OFF, FEATURE_ON, ORG_XML_SAX_DRIVER
-
-
Constructor Summary
Constructors Constructor Description DOMParser(ExecutionContext executionContext)Public constructor.DOMParser(ExecutionContext executionContext, ResourceConfig saxDriverConfig)Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(Source source, Element appendElement)Append the content, behind the supplied input stream, to suplied document element.Documentparse(Source source)Document parser.-
Methods inherited from class org.smooks.engine.delivery.AbstractParser
attachNamespaceDeclarationStack, attachXMLReader, configureReader, createInputSource, createXMLReader, detachXMLReader, getExecutionContext, getReaders, getSaxDriverConfig, getSAXParserConfiguration, getXMLReader, isFeatureOff, isFeatureOn, setReaders
-
-
-
-
Constructor Detail
-
DOMParser
public DOMParser(ExecutionContext executionContext)
Public constructor. This constructor attempts to lookup a SAX Parser config under the "org.xml.sax.driver" selector string. See .cdrl Configuration.- Parameters:
executionContext- The execution context that the parser is being instantiated on behalf of.
-
DOMParser
public DOMParser(ExecutionContext executionContext, ResourceConfig saxDriverConfig)
Public constructor.- Parameters:
executionContext- The Smooks Container Request that the parser is being instantiated on behalf of.saxDriverConfig- SAX Parser configuration. See .cdrl Configuration.
-
-
Method Detail
-
parse
public Document parse(Source source) throws IOException, SAXException
Document parser.- Parameters:
source- Source content stream to be parsed.- Returns:
- W3C ownerDocument.
- Throws:
SAXException- Unable to parse the content.IOException- Unable to read the input stream.
-
append
public void append(Source source, Element appendElement) throws IOException, SAXException
Append the content, behind the supplied input stream, to suplied document element. Used to merge document fragments into a document.- Parameters:
source- Source content stream to be parsed.appendElement- DOM element to which the content fragment is to be added.- Throws:
SAXException- Unable to parse the content.IOException- Unable to read the input stream.
-
-