| RegExFilePreTweaker Class |
Namespace: Sdl.FileTypeSupport.Framework.Core.Utilities.NativeApi
The RegExFilePreTweaker type exposes the following members.
| Name | Description | |
|---|---|---|
| RegExFilePreTweaker |
Default constructor. If the object is created with this constructor, then ReplaceInfo
should be set.
| |
| RegExFilePreTweaker(ListString, ListString) |
Constructor that takes two ordered lists of strings that contain the match and replace values to apply to the file.
The first item in the list of matches will be replace by the first item in the list of replacements, and so on.
| |
| RegExFilePreTweaker(String, String) |
Simple constructor that can be used when there is only a single match/replace to be performed
on the native file.
|
| Name | Description | |
|---|---|---|
| Enabled |
Controls whether the tweaker is run during parsing. Default is true.
(Inherited from AbstractFilePreTweaker.) | |
| MessageReporter |
The default implementation stores the message reporter in a field.
(Inherited from AbstractFilePreTweaker.) | |
| Name |
The property contains a name for the file tweaker that can be overridden in derived classes. This name is used in error messages.
(Inherited from AbstractFilePreTweaker.) | |
| ReplaceInfo |
The list of RegEx match and replace values. These values will be used
during either the Tweak or UnTweak processes depending on whether the FileTweaker is added to the
Extractor or to the Generator
| |
| RequireValidEncoding |
This property governs whether the File Tweaker requires encoding information before it will tweak a file. This may be needed
to ensure that the file the tweaker uses the correct encoding.
(Inherited from AbstractFilePreTweaker.) |
| Name | Description | |
|---|---|---|
| Tweak |
The implementation of the Tweak method from the AbstractFilePreTweaker
base class.
(Overrides AbstractFilePreTweakerTweak(IPersistentFileConversionProperties).) | |
| TweakFilePreParsing |
Default implementation of the INativeFileTweaker.TweakFilePreParsing method that will check to see if
the file will be tweaked (see WillFileBeTweaked), and whether the encoding has been
detected during sniffing if RequireValidEncoding is true and then call Tweak. Derived classes
should normally override the Tweak method instead.
(Inherited from AbstractFilePreTweaker.) | |
| WillFileBeTweaked |
The implementation of the WillFileBeTweaked method from the AbstractFilePreTweaker
base class.
(Overrides AbstractFilePreTweakerWillFileBeTweaked(String).) |
public class XmlFilePreTweaker : RegExFilePreTweaker { public XmlFilePreTweaker() { List<Pair<string, string>> replaceInfo = new List<Pair<string, string>>(); replaceInfo.Add(new Pair<string, string>("<", "<SDL:lt />")); replaceInfo.Add(new Pair<string, string>(">", "<SDL:gt />")); replaceInfo.Add(new Pair<string, string>(""", "<SDL:quot />")); replaceInfo.Add(new Pair<string, string>("'", "<SDL:apos />")); replaceInfo.Add(new Pair<string, string>("&", "<SDL:amp />")); base.ReplaceInfo = replaceInfo; } }