net.sf.okapi.common.filterwriter.ext
Class XLIFFWriter

java.lang.Object
  extended by net.sf.okapi.common.filterwriter.ext.XLIFFWriter
All Implemented Interfaces:
net.sf.okapi.common.filterwriter.IFilterWriter

public class XLIFFWriter
extends java.lang.Object
implements net.sf.okapi.common.filterwriter.IFilterWriter

Writer for creating XLIFF document.


Field Summary
static java.lang.String OKP_ENGINE
          Name of the Okapi XLIFF extension engine.
static java.lang.String OKP_MATCHTYPE
          Name of the Okapi XLIFF extension matchType.
 
Constructor Summary
XLIFFWriter()
          Creates an XLIFF writer object.
 
Method Summary
 void cancel()
           
 void close()
          Writes the end of this the document and close it.
 void create(java.lang.String xliffPath, java.lang.String skeletonPath, net.sf.okapi.common.LocaleId srcLoc, net.sf.okapi.common.LocaleId trgLoc, java.lang.String dataType, java.lang.String original, java.lang.String message)
          Creates a new XLIFF document.
 net.sf.okapi.common.encoder.EncoderManager getEncoderManager()
           
 java.lang.String getName()
           
 net.sf.okapi.common.IParameters getParameters()
           
 net.sf.okapi.common.skeleton.ISkeletonWriter getSkeletonWriter()
           
 net.sf.okapi.common.Event handleEvent(net.sf.okapi.common.Event event)
           
 void setOptions(net.sf.okapi.common.LocaleId locale, java.lang.String defaultEncoding)
           
 void setOutput(java.io.OutputStream output)
           
 void setOutput(java.lang.String path)
           
 void setParameters(net.sf.okapi.common.IParameters params)
           
 void writeEndFile()
          Writes the end of a <file> element.
 void writeEndGroup()
          Writes the end of a <group> element.
 void writeStartFile(java.lang.String original, java.lang.String dataType, java.lang.String skeletonPath)
          Writes the start of a <file> element.
 void writeStartFile(java.lang.String original, java.lang.String dataType, java.lang.String skeletonPath, java.lang.String extraForHeader)
          Writes the start of a <file> element.
 void writeStartGroup(java.lang.String id, java.lang.String resName, java.lang.String resType)
          Writes the start of a <group> element.
 void writeTextUnit(net.sf.okapi.common.resource.ITextUnit tu)
          Writes a text unit as a <trans-unit> element.
 void writeTextUnit(net.sf.okapi.common.resource.ITextUnit tu, java.lang.String phaseName)
          Writes a text unit as a <trans-unit> element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OKP_MATCHTYPE

public static final java.lang.String OKP_MATCHTYPE
Name of the Okapi XLIFF extension matchType.

See Also:
Constant Field Values

OKP_ENGINE

public static final java.lang.String OKP_ENGINE
Name of the Okapi XLIFF extension engine.

See Also:
Constant Field Values
Constructor Detail

XLIFFWriter

public XLIFFWriter()
Creates an XLIFF writer object.

Method Detail

create

public void create(java.lang.String xliffPath,
                   java.lang.String skeletonPath,
                   net.sf.okapi.common.LocaleId srcLoc,
                   net.sf.okapi.common.LocaleId trgLoc,
                   java.lang.String dataType,
                   java.lang.String original,
                   java.lang.String message)
Creates a new XLIFF document.

Parameters:
xliffPath - the full path of the document to create.
skeletonPath - the path for the skeleton, or null for no skeleton.
srcLoc - the source locale.
trgLoc - the target locale, or null for no target.
dataType - the value for the datatype attribute.
original - the value for the original attribute.
message - optional comment to put at the top of the document (can be null).

close

public void close()
Writes the end of this the document and close it. If a <file> element is currently opened, it is closed automatically.

Specified by:
close in interface net.sf.okapi.common.filterwriter.IFilterWriter

writeStartFile

public void writeStartFile(java.lang.String original,
                           java.lang.String dataType,
                           java.lang.String skeletonPath)
Writes the start of a <file> element.

each call to this method must have a corresponding call to writeEndFile().

Parameters:
original - the value for the original attribute. If null: "unknown" is used.
dataType - the value for the datatype attribute. If null: "x-undefined" is used.
skeletonPath - optional external skeleton information, or null.
See Also:
writeEndFile()

writeStartFile

public void writeStartFile(java.lang.String original,
                           java.lang.String dataType,
                           java.lang.String skeletonPath,
                           java.lang.String extraForHeader)
Writes the start of a <file> element.

each call to this method must have a corresponding call to writeEndFile().

Parameters:
original - the value for the original attribute. If null: "unknown" is used.
dataType - the value for the datatype attribute. If null: "x-undefined" is used.
skeletonPath - optional external skeleton information, or null.
extraForHeader - optional extra raw valid XLIFF to place in the header, or null.
See Also:
writeEndFile()

writeEndFile

public void writeEndFile()
Writes the end of a <file> element. This method should be called for each call to writeStartFile(String, String, String).

See Also:
writeStartFile(String, String, String)

writeStartGroup

public void writeStartGroup(java.lang.String id,
                            java.lang.String resName,
                            java.lang.String resType)
Writes the start of a <group> element.

Parameters:
id - the value for the id attribute of the group (must not be null).
resName - the value for the resname attribute of the group (can be null).
resType - the value for the restype attribute of the group (can be null).
See Also:
writeEndGroup()

writeEndGroup

public void writeEndGroup()
Writes the end of a <group> element.

See Also:
writeStartGroup(String, String, String).

writeTextUnit

public void writeTextUnit(net.sf.okapi.common.resource.ITextUnit tu)
Writes a text unit as a <trans-unit> element.

Parameters:
tu - the text unit to output.

writeTextUnit

public void writeTextUnit(net.sf.okapi.common.resource.ITextUnit tu,
                          java.lang.String phaseName)
Writes a text unit as a <trans-unit> element.

Parameters:
tu - the text unit to output.

cancel

public void cancel()
Specified by:
cancel in interface net.sf.okapi.common.filterwriter.IFilterWriter

getEncoderManager

public net.sf.okapi.common.encoder.EncoderManager getEncoderManager()
Specified by:
getEncoderManager in interface net.sf.okapi.common.filterwriter.IFilterWriter

getSkeletonWriter

public net.sf.okapi.common.skeleton.ISkeletonWriter getSkeletonWriter()
Specified by:
getSkeletonWriter in interface net.sf.okapi.common.filterwriter.IFilterWriter

getName

public java.lang.String getName()
Specified by:
getName in interface net.sf.okapi.common.filterwriter.IFilterWriter

getParameters

public net.sf.okapi.common.IParameters getParameters()
Specified by:
getParameters in interface net.sf.okapi.common.filterwriter.IFilterWriter

handleEvent

public net.sf.okapi.common.Event handleEvent(net.sf.okapi.common.Event event)
Specified by:
handleEvent in interface net.sf.okapi.common.filterwriter.IFilterWriter

setOptions

public void setOptions(net.sf.okapi.common.LocaleId locale,
                       java.lang.String defaultEncoding)
Specified by:
setOptions in interface net.sf.okapi.common.filterwriter.IFilterWriter

setOutput

public void setOutput(java.lang.String path)
Specified by:
setOutput in interface net.sf.okapi.common.filterwriter.IFilterWriter

setOutput

public void setOutput(java.io.OutputStream output)
Specified by:
setOutput in interface net.sf.okapi.common.filterwriter.IFilterWriter

setParameters

public void setParameters(net.sf.okapi.common.IParameters params)
Specified by:
setParameters in interface net.sf.okapi.common.filterwriter.IFilterWriter