Class XLIFFReader

    • Field Detail

      • VALIDATION_MINIMAL

        public static final int VALIDATION_MINIMAL
        Performs as little validation as possible.
        See Also:
        Constant Field Values
      • VALIDATION_MAXIMAL

        public static final int VALIDATION_MAXIMAL
        Performs as much validation as possible with the reader (which may not be a full validation for the modules, depending on the modules supported).
        See Also:
        Constant Field Values
      • VALIDATION_INCLUDE_SCHEMAS

        public static final int VALIDATION_INCLUDE_SCHEMAS
        Includes schemas-based validation.
        See Also:
        Constant Field Values
      • VALIDATION_INCLUDE_FRAGIDPREFIX

        public static final int VALIDATION_INCLUDE_FRAGIDPREFIX
        Includes validation of the fragment identification values.
        See Also:
        Constant Field Values
    • Constructor Detail

      • XLIFFReader

        public XLIFFReader()
        Creates a new XLIFFReader object with full validation.
      • XLIFFReader

        public XLIFFReader​(int validation)
        Creates a new XLIFFReader object. You can choose the type of validation to perform.
        Parameters:
        validation - one of the VALIDATION_* constants or a ORed combination.
      • XLIFFReader

        public XLIFFReader​(int validation,
                           URIParser uriParserToUse)
        Creates a new XLIFFReader object.
        Parameters:
        validation - one of the VALIDATION_* constants or a ORed combination.
        uriParserToUse - URI parser to use when processing references (e.g. value of ref in an <mrk> element). If it is set to null, a URIParser object that handles default prefixes will be used.
    • Method Detail

      • validate

        public static void validate​(File file)
        Validates an XLIFF document passed as a File object.
        Parameters:
        file - the XLIFF document to validate.
      • validate

        public static void validate​(File file,
                                    URIParser uriParser)
        Validates an XLIFF document passed as a File object.
        Parameters:
        file - the XLIFF document to validate.
        uriParser - the URI parser to use when processing references (can be null).
      • validate

        public static void validate​(URI inputURI,
                                    URIParser uriParser)
        Validates an XLIFF document passed as a URI.
        Parameters:
        inputURI - the URI to process.
        uriParser - the URI parser to use when processing references (can be null).
      • validate

        public static void validate​(String input,
                                    URIParser uriParser)
        Validates an XLIFF document passed as a string.
        Parameters:
        input - the content to process.
        uriParser - the URI parser to use when processing references (can be null).
      • validate

        public static void validate​(InputStream inputStream,
                                    URIParser uriParser)
        Validates an XLIFF document passed as a stream.
        Parameters:
        inputStream - the stream to process.
        uriParser - the URI parser to use when processing references (can be null).
      • open

        public void open​(File file)
        Opens an XLIFF document by its File object.
        Parameters:
        file - the file to process.
      • open

        public void open​(URI inputURI)
        Opens an XLIFF document by its URI.
        Parameters:
        inputURI - the URI to process.
      • open

        public void open​(String input)
        Opens an XLIFF document passed as a string.
        Parameters:
        input - the string containing the document to process.
      • open

        public void open​(InputStream inputStream)
        Opens an XLIFF document by its stream. Note that if a schema validation is done, this call will create a temporary copy of the content. If you can use open(File), open(URI) or open(String).
        Parameters:
        inputStream - the input stream to process.
      • hasNext

        public boolean hasNext()
        Indicates if there is another event.
        Returns:
        true if there is another event, false otherwise.
      • next

        public Event next()
        Gets the next filter event.
        Returns:
        the next filter event.
      • setReportUnsingnificantParts

        public void setReportUnsingnificantParts​(boolean reportUnsingnificantParts)
        Sets the flag to report or not parts of the documents that are not significant. For example white space between structural elements.

        By default those parts are not reported.

        Parameters:
        reportUnsingnificantParts - true to report those parts, false to not report them.
      • setForceUniqueIds

        public void setForceUniqueIds​(boolean forceUniqueIds)
        If set, include the segment id in the tag id to enforce uniqueness.
      • setDiscardInvalidTargets

        public void setDiscardInvalidTargets​(boolean discardInvalidTargets)
        If set, discard invalid target data and report it as a warning, rather than an error.
      • setIgnoreTagTypeMatch

        public void setIgnoreTagTypeMatch​(boolean ignoreTagTypeMatch)
        If set, force tag types in the target to match their corresponding tag type in source.
      • getWarningCount

        public int getWarningCount()
        Gets the number of warnings.
        Returns:
        the number of warnings.