Package org.omegat.filters3.xml
Interface XMLDialect
- All Known Implementing Classes:
AndroidDialect,CamtasiaWindowsDialect,DefaultXMLDialect,DocBookDialect,FlashDialect,HelpAndManualDialect,InfixDialect,L10nmgrDialect,OpenDocDialect,OpenXMLDialect,PropertiesDialect,RelaxNGDialect,ResXDialect,SchematronDialect,ScribusDialect,SvgDialect,TXMLDialect,Typo3Dialect,VisioDialect,WiXDialect,WordpressDialect,XHTMLDialect,XLIFFDialect,XMLSpreadsheetDialect
public interface XMLDialect
Interface to describe XML dialect.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstraint on Doctype name.static final intUnboxed (of primitive type int) constraint on Doctype name.static final intConstraint on PUBLIC Doctype declaration.static final intUnboxed (of primitive type int) constraint on PUBLIC Doctype declaration.static final intConstraint on root tag name.static final intUnboxed (of primitive type int) constraint on root tag name.static final intConstraint on SYSTEM Doctype declaration.static final intUnboxed (of primitive type int) constraint on SYSTEM Doctype declaration.static final intConstraint on xmlns declaration.static final intUnboxed (of primitive type int) constraint on xmlns declaration. -
Method Summary
Modifier and TypeMethodDescriptionconstructShortcuts(List<Element> elements, List<ProtectedPart> protectedParts) Returns shortcut string representation of the entry source.Gives the value of closingTagRequired.Returns defined constraints to restrict supported subset of XML files.Returns the map of content based tags where key is tag name, value is tag type.Gives the value of forceSpacePreserving;Returns the set of tags that surround intact portions of document, that should not be translated at all.Returns the set of "out-of-turn" tags.Returns the set of paragraph tags.Returns the set of tags that surround preformatted text.Returns the map of tags to their shortcuts.Gives the value of tagsAggregationEnabled.Returns the set of translatable attributes (no matter what tag they belong to).Returns the multimap of translatable attributes of each tag.voidhandleXMLTag(XMLTag tag, boolean translated) Implement general purpose function to handle XML tag/attributes when necessary.@Nullable InputSourceresolveEntity(String publicId, String systemId) Resolves external entites if child filter needs it.voidsetClosingTagRequired(boolean onOff) Sets closingTag totrueorfalsevoidsetForceSpacePreserving(boolean onOff) Set forceSpacePreserving.voidsetTagsAggregationEnabled(boolean onOff) Sets tagsAggregationEnabled totrueorfalsevalidateContentBasedTag(String tag, @Nullable Attributes atts) For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes.validateIntactTag(String tag, @Nullable Attributes atts) For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes.validateParagraphTag(String tag, @Nullable Attributes atts) For a given tag, return wether the content of this tag is a paragraph tag, depending on the content of one attribute (and/or the presence or absence of other attributes).validatePreformatTag(String tag, @Nullable Attributes atts) For a given tag, return wether the content of this tag is a preformat tag, depending on the content of one attribute (and/or the presence or absence of other attributes).validateTranslatableTag(String tag, @Nullable Attributes atts) For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes.validateTranslatableTagAttribute(String tag, String attribute, @Nullable Attributes atts) Returns for a given attribute of a given tag if the attribute should be translated with the given other attributes present.
-
Field Details
-
CONSTRAINT_DOCTYPE_UNBOXED
static final int CONSTRAINT_DOCTYPE_UNBOXEDUnboxed (of primitive type int) constraint on Doctype name.- See Also:
-
CONSTRAINT_PUBLIC_DOCTYPE_UNBOXED
static final int CONSTRAINT_PUBLIC_DOCTYPE_UNBOXEDUnboxed (of primitive type int) constraint on PUBLIC Doctype declaration.- See Also:
-
CONSTRAINT_SYSTEM_DOCTYPE_UNBOXED
static final int CONSTRAINT_SYSTEM_DOCTYPE_UNBOXEDUnboxed (of primitive type int) constraint on SYSTEM Doctype declaration.- See Also:
-
CONSTRAINT_ROOT_UNBOXED
static final int CONSTRAINT_ROOT_UNBOXEDUnboxed (of primitive type int) constraint on root tag name.- See Also:
-
CONSTRAINT_XMLNS_UNBOXED
static final int CONSTRAINT_XMLNS_UNBOXEDUnboxed (of primitive type int) constraint on xmlns declaration.- See Also:
-
CONSTRAINT_DOCTYPE
static final int CONSTRAINT_DOCTYPEConstraint on Doctype name.- See Also:
-
CONSTRAINT_PUBLIC_DOCTYPE
static final int CONSTRAINT_PUBLIC_DOCTYPEConstraint on PUBLIC Doctype declaration.- See Also:
-
CONSTRAINT_SYSTEM_DOCTYPE
static final int CONSTRAINT_SYSTEM_DOCTYPEConstraint on SYSTEM Doctype declaration.- See Also:
-
CONSTRAINT_ROOT
static final int CONSTRAINT_ROOTConstraint on root tag name.- See Also:
-
CONSTRAINT_XMLNS
static final int CONSTRAINT_XMLNSConstraint on xmlns declaration.- See Also:
-
-
Method Details
-
getParagraphTags
Returns the set of paragraph tags.Each entry in a set should be a String class.
-
getPreformatTags
Returns the set of tags that surround preformatted text.Each entry in a set should be a String class.
-
getContentBasedTags
Returns the map of content based tags where key is tag name, value is tag type. -
getIntactTags
Returns the set of tags that surround intact portions of document, that should not be translated at all.Each entry in a set should be a String class.
-
getOutOfTurnTags
Returns the set of "out-of-turn" tags. Such tags specify chunks of text that should be translated separately, not breaking currently collected text entry. For example, footnotes in OpenDocument.Each entry in a set should be a String class.
-
constructShortcuts
Returns shortcut string representation of the entry source. This is what the user translates. E.g. forHere's <b>bold text</b>should returnHere's <b0>bold text</b0>. -
getTranslatableTagAttributes
Returns the multimap of translatable attributes of each tag.Each entry should map from a String to a set of Strings.
-
validateTranslatableTagAttribute
Returns for a given attribute of a given tag if the attribute should be translated with the given other attributes present. If the tagAttribute is returned by getTranslatable(Tag)Attributes(), this function is called to further test the attribute within its context. This allows for example the XHTML filter to not translate the value attribute of an input-element, except when it is a button or submit or reset. -
validateIntactTag
For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes. For instance, in the ResX filter, tags should not be translated when they contain the attribute "type", or when the attribute "name" starts with ">";- Parameters:
tag- The tag that could be translatedatts- The list of the tag attributes- Returns:
trueorfalse
-
validateContentBasedTag
For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes.- Parameters:
tag- The tag that could be translatedatts- The list of the tag attributes- Returns:
trueorfalse
-
validateTranslatableTag
For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes. For instance, in the Typo3 filter, tags should be translated when the attribute locazible="1".- Parameters:
tag- The tag that could be translatedatts- The list of the tag attributes- Returns:
trueorfalse
-
validateParagraphTag
For a given tag, return wether the content of this tag is a paragraph tag, depending on the content of one attribute (and/or the presence or absence of other attributes). For instance, in the XLIFF filter, the <mark> tag should start a new paragraph when the attribute "mtype" contains "seg".- Parameters:
tag- The tag that could be a paragraph tagatts- The list of the tag attributes- Returns:
trueorfalse
-
validatePreformatTag
For a given tag, return wether the content of this tag is a preformat tag, depending on the content of one attribute (and/or the presence or absence of other attributes). For instance, in the XLIFF filter, the <mark> tag should be a preformat tag when the attribute "mtype" contains "seg".- Parameters:
tag- The tag that could be a preformat tagatts- The list of the tag attributes- Returns:
trueorfalse
-
getTranslatableAttributes
Returns the set of translatable attributes (no matter what tag they belong to).Each entry in a set should be a String class.
-
getShortcuts
-
getConstraints
-
resolveEntity
Resolves external entites if child filter needs it. Should returnnullif it doesn't or cannot. -
setClosingTagRequired
void setClosingTagRequired(boolean onOff) Sets closingTag totrueorfalse- Parameters:
onOff- The parameter setting wether closing tags should be used or not for empty tags.
-
getClosingTagRequired
Boolean getClosingTagRequired()Gives the value of closingTagRequired. -
setTagsAggregationEnabled
void setTagsAggregationEnabled(boolean onOff) Sets tagsAggregationEnabled totrueorfalse- Parameters:
onOff- The parameter setting whether tags aggregation can be enabled in order to reduce the number of tags shown to the user.
-
getTagsAggregationEnabled
Boolean getTagsAggregationEnabled()Gives the value of tagsAggregationEnabled. -
getForceSpacePreserving
Boolean getForceSpacePreserving()Gives the value of forceSpacePreserving;- Returns:
- whether forceSpacePreserving is set.
-
setForceSpacePreserving
void setForceSpacePreserving(boolean onOff) Set forceSpacePreserving. -
handleXMLTag
Implement general purpose function to handle XML tag/attributes when necessary.- Parameters:
tag- XML tag to handle.
-