|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.g11ntoolkit.tokenizer.FileTokenizer
|
+--com.g11ntoolkit.tokenizer.TokXMLFile
Tokenize the specified buffer as an XML file.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See License Agreement.
| Field Summary | |
private static gnu.regexp.RE[] |
exprs
The set of regular expressions we will use for processing. |
private static java.lang.String |
localeString
The locale for the input file. |
private static java.util.logging.Logger |
log
The log used for all messages from this class. |
private static int |
nextStart
The next starting position for the tag match. |
private static java.lang.String[] |
patterns
The set of regular expression patterns we will use for processing. |
protected static java.lang.String |
theContextFileName
The context input file name saved for later use. |
protected static Token |
token
The Token object to use to generate tokens for each extracted string. |
protected static java.util.ResourceBundle |
xliffrb
Constants, messages, and variables used by the tools and classes for XLIFF processing. |
private static java.lang.String |
XMLPropFileName
The file name for the properties file that will contain the regular expressions describing the extracts for XML files. |
private static java.util.ResourceBundle |
xmlres
Contains the XML literals used for XML file extracts. |
private static java.lang.String |
xmlString
A work area for parsing the input file buffer to find the tags and replace the strings with tokens. |
protected static java.util.ResourceBundle |
xrb
XML Properties Resource Bundle. |
| Fields inherited from class com.g11ntoolkit.tokenizer.FileTokenizer |
context, encoding, inFileBuffer, jspVars, mrb, product, productVersion, revContext, targetLocale, tokContext, vrb |
| Constructor Summary | |
TokXMLFile()
This constructor is used to establish an instance of the class with no input information. |
|
TokXMLFile(java.lang.String anEncoding,
java.util.Locale aLocale,
Token aToken,
java.lang.String propFile)
This constructor is used to establish an instance of the class and save all the input information for use in processing the file. |
|
| Method Summary | |
private static java.lang.String |
getXMLPropFileName()
Returns the file name for the properties file that will contain regular expressions describing the XML file extracts. |
static boolean |
isToken(java.lang.String str,
Token tok)
Returns true if the string is a token. |
private static void |
loadPatterns()
Loads the regualr expression patterns from the PropertiesResourceBundle. |
static void |
main(java.lang.String[] args)
Allows this tool to be run from the command line. |
private static void |
setXMLPropFileName(java.lang.String fn)
Sets the file name for the properties file that will contain regular expressions describing the XML file extracts. |
static StrFile |
tokenize(java.lang.String inFileName,
java.lang.String contextFileName,
java.util.Locale targetLocale,
java.lang.String localeString)
This is the method that tokenizes the buffer and writes the two output files. |
| Methods inherited from class com.g11ntoolkit.tokenizer.FileTokenizer |
cleanConcats, getEncoding, getFileBuffer, getKey, getProductName, getProductVersion, getToken, keys, readFile, readFilePlain, setContext, setEncoding, setProductName, setProductVersion, setupTok, setupTok, tokens |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.util.logging.Logger log
protected static java.util.ResourceBundle xliffrb
private static java.util.ResourceBundle xmlres
protected static java.util.ResourceBundle xrb
The set of regular expressions used to find the translatable strings in an XML file. Refer to the TokXMLFile Regular Expressions Guide for information on what this file contains and how to code it.
private static java.lang.String xmlString
private static java.lang.String[] patterns
This will be set of strings that contain the regular expressions describing what to extract from the XML file.
private static gnu.regexp.RE[] exprs
This will be set of regular expressions describing what to extract from the XML file.
private static int nextStart
It is important to keep this up to date with each match because we don't want to return the same tag twice.
protected static Token token
private static java.lang.String XMLPropFileName
protected static java.lang.String theContextFileName
private static java.lang.String localeString
| Constructor Detail |
public TokXMLFile()
public TokXMLFile(java.lang.String anEncoding,
java.util.Locale aLocale,
Token aToken,
java.lang.String propFile)
throws FileTokenizerError
anEncoding - a String specifying the encoding for the output files.aLocale - a Locale objectaToken - a Token objectpropFile - a String specifying the properties resource bundle file name that contains the list of elements and attributes to extract values for in the XML file
FileTokenizerError - for any errors detected during processing| Method Detail |
public static void main(java.lang.String[] args)
throws FileTokRunError
Sets up the environment then uses the tokenize method to extract the strings.
args - a String array specifying the command line parameters. The order does not matter except that the arguments that are paired must be paired in order. The arguments are not case sensitive.
FileTokRunErrorprivate static void loadPatterns()
This table describes what will be extracted from an XML file.
public static StrFile tokenize(java.lang.String inFileName,
java.lang.String contextFileName,
java.util.Locale targetLocale,
java.lang.String localeString)
throws FileTokenizerError
It uses the super class setupTok method to do the common work of reading the file into a string buffer.
inFileName - a String specifying the input file namecontextFileName - a String specifying the input file name to use as the token id and contexttargetLocale - a Locale specifying the intended target locale
FileTokenizerError - if any errors occur during processing.
public static boolean isToken(java.lang.String str,
Token tok)
Looks for the string to begin and end with the token decoration.
str - a String specifying the stringtok - a Token specifying the token (used for finding the decoration)
private static void setXMLPropFileName(java.lang.String fn)
fn - a String specifying the name of the filegetXMLPropFileName()private static java.lang.String getXMLPropFileName()
setXMLPropFileName(java.lang.String)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||