Class XMLFilter

    • Constructor Detail

      • XMLFilter

        public XMLFilter​(XMLDialect dialect)
        Creates a new instance of XMLFilter
    • Method Detail

      • getDialect

        public XMLDialect getDialect()
        Gives the dialect
      • createReader

        public java.io.BufferedReader createReader​(java.io.File inFile,
                                                   java.lang.String inEncoding)
                                            throws java.io.UnsupportedEncodingException,
                                                   java.io.IOException
        Creates a special XML-encoding-aware reader of an input file.
        Parameters:
        inFile - The source file.
        Returns:
        The reader of the source file.
        Throws:
        java.io.UnsupportedEncodingException - Thrown if JVM doesn't support the specified inEncoding.
        java.io.IOException - If any I/O Error occurs upon reader creation.
      • createWriter

        public java.io.BufferedWriter createWriter​(java.io.File outFile,
                                                   java.lang.String outEncoding)
                                            throws java.io.UnsupportedEncodingException,
                                                   java.io.IOException
        Creates a writer of the translated file. Accepts null output file -- returns a writer to /dev/null in this case ;-)
        Parameters:
        outFile - The target file.
        outEncoding - Encoding of the target file, if the filter supports it. Otherwise null.
        Returns:
        The writer for the target file.
        Throws:
        java.io.UnsupportedEncodingException - Thrown if JVM doesn't support the specified outEncoding
        java.io.IOException - If any I/O Error occurs upon writer creation
      • getTargetLanguage

        public Language getTargetLanguage()
        Returns:
        The target language of the project
      • getSourceLanguage

        public Language getSourceLanguage()
        Returns:
        The source language of the project
      • isSourceEncodingVariable

        public boolean isSourceEncodingVariable()
        Whether source encoding can be varied by the user. If XML file has no encoding declaration, UTF-8 will be used, hence returns false by default.
        Specified by:
        isSourceEncodingVariable in interface IFilter
        Specified by:
        isSourceEncodingVariable in class AbstractFilter
        Returns:
        false
      • translate

        public java.lang.String translate​(java.lang.String entry,
                                          java.util.List<ProtectedPart> protectedParts)
        The method the Handler would call to pass translatable content to OmegaT core and receive translation.
      • isFileSupported

        public boolean isFileSupported​(java.io.BufferedReader reader)
        Returns whether the XML file is supported by the filter.
        Reads OConsts.READ_AHEAD_LIMIT and tries to detect constrained text and match constraints defined in XMLDialect against them.
      • tagStart

        public void tagStart​(java.lang.String path,
                             org.xml.sax.Attributes atts)
      • tagEnd

        public void tagEnd​(java.lang.String path)
      • comment

        public void comment​(java.lang.String comment)
      • text

        public void text​(java.lang.String text)
      • isInIgnored

        public boolean isInIgnored()