Package de.wwu.scdh.annotation.selection
Class RewriterConfig
java.lang.Object
de.wwu.scdh.annotation.selection.RewriterConfig
A record for configuration parameters of a
Rewriter.
The parameters are documented in the constructor.-
Constructor Summary
ConstructorsConstructorDescriptionRewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces) Make a newRewriterConfig.RewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces, Map<Class<? extends Point>, Class<? extends Point>> pointClassMap, boolean writeBackErrorMessages) Make a newRewriterConfig. -
Method Summary
Modifier and TypeMethodDescriptionReturns mapping of point classes suitable for forwarding XML to plain text selectors.Returns mapping of point classes suitable for forwarding XML to plain text selectors.booleangetMode()Gets the mapping of given point types to requested point types in the output.getPointClassMapForXslt(ResourceBuilder.OutputMethod method, Rewriter.Direction direction) Returns a mapping of point classes for an XSLT output method and a pointer rewriting direction.getXPath()booleanbooleanstatic RewriterConfigwithMode(RewriterConfig config, Mode mode) Clone theRewriterConfig, but set a newMode.booleanWhether error messages should be written back to the model when a rewriting error occurs.
-
Constructor Details
-
RewriterConfig
public RewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces) Make a newRewriterConfig.- Parameters:
mode- aModeused to cope with referential ambiguityescaped- whether the output has to be escaped for XMLxpath- an XPath expression which will be evaluated on the context node for normalizationrewritesTraceLeaf- - whether aQ{http://wwu.de/scdh/selection-engine/node-tracing}textsegment has to be rewritten withtext()removeEmptyNamespaces- - whether aQ{}in a path expression (XPath segment) is to be removed.
-
RewriterConfig
public RewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces, Map<Class<? extends Point>, Class<? extends Point>> pointClassMap, boolean writeBackErrorMessages) Make a newRewriterConfig.- Parameters:
mode- aModeused to cope with referential ambiguityescaped- whether the output has to be escaped for XMLxpath- an XPath expression which will be evaluated on the context node for normalizationrewritesTraceLeaf- - whether aQ{http://wwu.de/scdh/selection-engine/node-tracing}textsegment has to be rewritten withtext()removeEmptyNamespaces- - whether aQ{}in a path expression (XPath segment) is to be removed.pointClassMap- - a mapping of point classes for requesting replacement of point classes (key) in the output by different point classes (value). See static methods ofRewriterConfigfor conveniently getting such mappings.
-
-
Method Details
-
withMode
Clone theRewriterConfig, but set a newMode. -
getMode
-
getEscaped
public boolean getEscaped() -
getXPath
-
rewritesTraceLeaf
public boolean rewritesTraceLeaf() -
removeEmptyNamespaces
public boolean removeEmptyNamespaces() -
getPointClassMap
Gets the mapping of given point types to requested point types in the output. -
forwardDOMToTextPointClassMap
Returns mapping of point classes suitable for forwarding XML to plain text selectors.- Returns:
- a mapping of point classes.
-
backwardDOMToTextPointClassMap
Returns mapping of point classes suitable for forwarding XML to plain text selectors.- Returns:
- a mapping of point classes.
-
getPointClassMapForXslt
public static Map<Class<? extends Point>,Class<? extends Point>> getPointClassMapForXslt(ResourceBuilder.OutputMethod method, Rewriter.Direction direction) Returns a mapping of point classes for an XSLT output method and a pointer rewriting direction.- Parameters:
method- - a valid method string as defined inOutputKeys.METHOD.direction- - either "forward" or "backward"- Returns:
- a mapping of point classes
-
writesBackErrorMessages
public boolean writesBackErrorMessages()Whether error messages should be written back to the model when a rewriting error occurs.
-