Learn how to work with structured XML content with the DeepL API.
tag_handling
by setting it to xml
, the DeepL API is able to process structured XML content. This includes whole XML files, as the following example shows.
Please note that for XML structured content in classic models, we set the parameter split_sentences
to nonewlines
to make sure that newlines do not alter the results. The response is beautified for better readability.
Please note that for next-gen models, the parameter split_sentences
passed by the user is ignored and a value of nonewlines
is used for maximum translation quality.
Parameters and corresponding results:
title
and the two par
tags are found to contain text. These tags are considered sentence splitters. Therefore, each of the following three texts is treated separately:
split_sentences=nonewlines
.
par
tags and proceed to translate the parts separately, as opposed to translating the sentence as a whole.
As this can lead to bad translations, this type of structure should either be avoided, or the non_splitting_tags
parameter should be set.
par
tags are duplicated (which is expected here).