public class XLIFFDocument
extends java.lang.Object
| Constructor and Description |
|---|
XLIFFDocument() |
XLIFFDocument(StartXliffData sxd) |
XLIFFDocument(java.lang.String sourceLang,
java.lang.String version)
Creates a new
XLIFFDocument() with given source and version. |
| Modifier and Type | Method and Description |
|---|---|
FileNode |
addFileNode(java.lang.String id)
Adds a
FileNode object to this document. |
java.util.Iterator<Event> |
createEventIterator()
Creates an iterator for the events of this document.
|
java.lang.Object |
fetchReference(URIParser up)
Retrieves the object corresponding to a given URI fragment.
|
java.io.File |
getFile()
Gets the File object associated with this document.
|
FileNode |
getFileNode(java.lang.String id)
Gets the
FileNode from a given file id. |
java.util.List<java.lang.String> |
getFileNodeIds()
Gets the IDs of all
FileNode in this XLIFF document. |
GroupNode |
getGroupNode(java.lang.String fileId,
java.lang.String groupId)
Gets the
GroupNode from a given file id and a given group id. |
StartXliffData |
getStartXliffData()
Gets the document-level data for this document.
|
UnitNode |
getUnitNode(java.lang.String fileId,
java.lang.String unitId)
Gets the
UnitNode from a given file id and a given unit id. |
java.util.List<Unit> |
getUnits()
Gets a list of all the units in this document.
|
void |
load(java.io.File file)
Loads a document from a given file, with maximum validation.
|
void |
load(java.io.File file,
int validation)
Loads a document from a given File.
|
void |
load(java.lang.String input,
int validation)
Loads a document from a string.
|
void |
load(java.net.URI inputURI,
int validation)
Loads a document from a given URI.
|
void |
save()
Saves this document to the current file.
|
void |
save(java.io.Writer outputWriter)
Saves this document to a writer.
|
void |
saveAs(java.io.File outputFile)
Saves this document to a specified file.
|
void |
setLineBreak(java.lang.String lineBreak)
Sets the line break to use when writing out this document.
|
public XLIFFDocument()
public XLIFFDocument(StartXliffData sxd)
public XLIFFDocument(java.lang.String sourceLang,
java.lang.String version)
XLIFFDocument() with given source and version.sourceLang - the source language.version - version of the XLIFF document (use null for the default).public void load(java.io.File file)
file - the file to load.public void load(java.io.File file,
int validation)
file - the file to load.validation - one of the VALIDATION_* constants or a ORed combination.public void load(java.net.URI inputURI,
int validation)
inputURI - the URI to load from.validation - one of the VALIDATION_* constants or a ORed combination.public void load(java.lang.String input,
int validation)
input - the content of the document to load.validation - one of the VALIDATION_* constants or a ORed combination.public void saveAs(java.io.File outputFile)
outputFile - the output file.save()public void save()
load(File), load(File, int)
or saveAs(File) before.saveAs(File)public void save(java.io.Writer outputWriter)
outputWriter - the output writer.public StartXliffData getStartXliffData()
public FileNode getFileNode(java.lang.String id)
FileNode from a given file id.id - the id of the file to lookup.FileNode object or null if not found.public java.util.List<java.lang.String> getFileNodeIds()
FileNode in this XLIFF document.
The order of IDs is the insertion order of files.public GroupNode getGroupNode(java.lang.String fileId, java.lang.String groupId)
GroupNode from a given file id and a given group id.fileId - the id of the file where the group is.groupId - the id of the group to lookup.GroupNode or null if not found.public UnitNode getUnitNode(java.lang.String fileId, java.lang.String unitId)
UnitNode from a given file id and a given unit id.fileId - the id of the file where the unit is.unitId - the id of the unit to lookup.UnitNode or null if not found.public java.util.Iterator<Event> createEventIterator()
public java.lang.Object fetchReference(URIParser up)
up - the URIParser representing the fragment to resolve.public java.util.List<Unit> getUnits()
public java.io.File getFile()
load(File), load(File, int)
and saveAs(File).public FileNode addFileNode(java.lang.String id)
FileNode object to this document.id - the ID of the file to add.FileNode object.public void setLineBreak(java.lang.String lineBreak)
lineBreak - the line break to use for this document.