de.folt.models.documentmodel.tmx
Class TmxDocument

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.models.documentmodel.document.XmlDocument
          extended by de.folt.models.documentmodel.tmx.TmxDocument
All Implemented Interfaces:
java.io.Serializable

public class TmxDocument
extends XmlDocument

Interface defines the methods for accessing, reading and writing an TMX Document.
For details of TMX - Translation Memory eXchange (TMX): TMX

Author:
klemens
See Also:
Serialized Form

Constructor Summary
TmxDocument()
           
 
Method Summary
 LinguisticProperties createLinguisticProperties(org.jdom.Element element)
          create LinguisticProperties Method returns the attributes of the element as LinguisticProperties
 java.lang.String getCreationid(org.jdom.Element element)
          getCreationid
 org.jdom.Document getDocument()
           
 org.jdom.Element getSeg(org.jdom.Element tuv)
          getSegList returns the seg (segment) of a TUV Element
 java.lang.String getSegAsString(org.jdom.Element tuv)
          getSegAsString
 java.lang.String getSrclang()
           
 org.jdom.Element getTmxBody()
           
 org.jdom.Element getTmxHeader()
          getTmxHeader
 java.util.List<org.jdom.Element> getTmxHeaderNoteList()
           
 java.util.List<org.jdom.Element> getTmxHeaderPropList()
           
 java.util.List<org.jdom.Element> getTmxHeaderUdeList()
           
 java.lang.String getTmxVersion()
          getTmxversion get the TMX version of the tmx document
 java.util.List<org.jdom.Element> getTuList()
           
 java.lang.String getTuvLang(org.jdom.Element element)
          getTUVLang returns the language of an element
 java.util.List<org.jdom.Element> getTuvList(org.jdom.Element tuv)
           
 java.util.List<org.jdom.Element> getTuvList(org.jdom.Element tu, java.lang.String language)
          getTuvList
 org.jdom.Document loadXmlFile(java.io.File newFile)
          loadXmlFile loads an XML file
 org.jdom.Document loadXmlFile(java.lang.String filename)
          loadXmlFile loads an XML file as a document
static void main(java.lang.String[] args)
          main
 org.jdom.Element saveModifiedLinguisticProperties(MonoLingualObject monoLingualObject)
          saveModifiedLinguisticProperties save the properties back to the tuv of the MonoLingualObject.
 org.jdom.Element saveModifiedLinguisticProperties(MultiLingualObject multiLingualObject)
          saveModifiedLinguisticProperties
 java.lang.String segToString(org.jdom.Element seg)
          segToString returns the string representation of an element
 void setDocument(org.jdom.Document document)
           
 void setSrclang(java.lang.String srclang)
           
 java.lang.String toString(org.jdom.Element element)
          toString converts an (TMX) element to a string)
<seg>hallo<ph>xxx</ph> ist...
 MultiLingualObject tuToMultiLingualObject(org.jdom.Element tu)
          tuToMultiLingualObject converts a given tu element into a MultiLingualObject
 MonoLingualObject tuvToMonoLingualObject(org.jdom.Element tuv)
          tuvToMonoLingualObject converts a given tuv element into a MoonLingualObject
 
Methods inherited from class de.folt.models.documentmodel.document.XmlDocument
bIsXmlDocument, bIsXmLFile, buildElement, createDocument, elementContentToString, elementContentToString, elementToString, getCatalogueDirectory, getNamespace, getNamespacelist, getRoot, getRootElementName, getRootElementName, getsubElementFromElementAttributeNameValue, getsubElementFromElementAttributeNameValueRegExp, getXmlDocumentName, getXmlOutputter, getXmlURL, isBExpandExternalEntities, isValidElement, quoteXMLString, saveToXmlFile, saveToXmlFile, saveToXmlFile, setBExpandExternalEntities, setCatalogueDirectory, setNamespace, setNamespacelist, setXmlDocumentName, setXmlURL
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TmxDocument

public TmxDocument()
Method Detail

main

public static void main(java.lang.String[] args)
main

Parameters:
args -

createLinguisticProperties

public LinguisticProperties createLinguisticProperties(org.jdom.Element element)
create LinguisticProperties Method returns the attributes of the element as LinguisticProperties

Parameters:
element - the element to retrieve the attributes from
Returns:
the LinguisticProperties for the element

getCreationid

public java.lang.String getCreationid(org.jdom.Element element)
getCreationid

Parameters:
element -
Returns:

getDocument

public org.jdom.Document getDocument()
Overrides:
getDocument in class XmlDocument
Returns:
the document

getSeg

public org.jdom.Element getSeg(org.jdom.Element tuv)
getSegList returns the seg (segment) of a TUV Element

Parameters:
tuv - the tuv
Returns:
the seg element of the tuv

getSegAsString

public java.lang.String getSegAsString(org.jdom.Element tuv)
getSegAsString

Parameters:
tuv -
Returns:
null if el == null; otherwise the string representation of the seg element (de.folt.models.documentmodel.document.XmmDocument#elementToString)

getSrclang

public java.lang.String getSrclang()

getTmxBody

public org.jdom.Element getTmxBody()

getTmxHeader

public org.jdom.Element getTmxHeader()
getTmxHeader

Returns:
the header of the TMX document

getTmxHeaderNoteList

public java.util.List<org.jdom.Element> getTmxHeaderNoteList()

getTmxHeaderPropList

public java.util.List<org.jdom.Element> getTmxHeaderPropList()

getTmxHeaderUdeList

public java.util.List<org.jdom.Element> getTmxHeaderUdeList()

getTmxVersion

public java.lang.String getTmxVersion()
getTmxversion get the TMX version of the tmx document

Returns:
the TMX version of the document

getTuList

public java.util.List<org.jdom.Element> getTuList()

getTuvLang

public java.lang.String getTuvLang(org.jdom.Element element)
getTUVLang returns the language of an element

Parameters:
element - the element
Returns:
the language of an element (xml:lang or lang)

getTuvList

public java.util.List<org.jdom.Element> getTuvList(org.jdom.Element tuv)

getTuvList

public java.util.List<org.jdom.Element> getTuvList(org.jdom.Element tu,
                                                   java.lang.String language)
getTuvList

Parameters:
tu - the tu element
language - the language tuvs to retrieve
Returns:
a List with all tuvs of the given language

loadXmlFile

public org.jdom.Document loadXmlFile(java.io.File newFile)
Description copied from class: XmlDocument
loadXmlFile loads an XML file

Overrides:
loadXmlFile in class XmlDocument
Parameters:
newFile - the File of the XML File
Returns:
the document loaded / null if file does not exist or is not an xml file

loadXmlFile

public org.jdom.Document loadXmlFile(java.lang.String filename)
Description copied from class: XmlDocument
loadXmlFile loads an XML file as a document

Overrides:
loadXmlFile in class XmlDocument
Parameters:
filename - the file name of the XML file
Returns:
the Document loaded

saveModifiedLinguisticProperties

public org.jdom.Element saveModifiedLinguisticProperties(MonoLingualObject monoLingualObject)
saveModifiedLinguisticProperties save the properties back to the tuv of the MonoLingualObject. It is assumed that the tuv Element is stored as a LinguisticProperty (monoLingualObject.getObjectLinguisticProperty("tuv")).

Parameters:
monoLingualObject - the MonoLingualObject which contains the changed or new Properties
Returns:
the possible changed tuv Element

saveModifiedLinguisticProperties

public org.jdom.Element saveModifiedLinguisticProperties(MultiLingualObject multiLingualObject)
saveModifiedLinguisticProperties

Parameters:
multiLingualObject -

segToString

public java.lang.String segToString(org.jdom.Element seg)
segToString returns the string representation of an element

Parameters:
seg - the seg to convert
Returns:
a string representation of a seg

setDocument

public void setDocument(org.jdom.Document document)
Overrides:
setDocument in class XmlDocument
Parameters:
document - the document to set

setSrclang

public void setSrclang(java.lang.String srclang)

toString

public java.lang.String toString(org.jdom.Element element)
toString converts an (TMX) element to a string)
 <seg>hallo<ph>xxx</ph> ist...</seg>
 

Parameters:
element - to create astring from
Returns:
a string representing the element

tuToMultiLingualObject

public MultiLingualObject tuToMultiLingualObject(org.jdom.Element tu)
tuToMultiLingualObject converts a given tu element into a MultiLingualObject

Parameters:
tu - the tu Element
Returns:
the MultiLingualObject for the given tu

tuvToMonoLingualObject

public MonoLingualObject tuvToMonoLingualObject(org.jdom.Element tuv)
tuvToMonoLingualObject converts a given tuv element into a MoonLingualObject

Parameters:
tuv - the tuv Element
Returns:
the MonoLingualObject for the given tuv