<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://uat.community.rws.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context</link><pubDate>Wed, 18 Jul 2018 07:37:29 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Current Revision posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 7/18/2018 7:37:29 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment and does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-50/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-03-50/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag the list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-50/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-03-50/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. This is why need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am &lt;strong&gt;IText&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-50/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-03-50/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How to create a Placeholder tag using public API&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://gist.github.com/andreaGhisa/20623f7f0f1461a9ccfe9de5636037e6"&gt;gist.github.com/.../20623f7f0f1461a9ccfe9de5636037e6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We assume that we want to transform the IText object from VisitText() into a placeholder. We take the text&amp;nbsp;from the object, create a new placeholder using the method above. All good&amp;nbsp; but what we achieved until now is to create a new placeholder which is not added to the sdlxliff.&lt;/p&gt;
&lt;p&gt;The tag we created must be inserted in the &lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;on the exactly the same position where the IText&amp;nbsp;is.&lt;/p&gt;
&lt;h3&gt;How&amp;nbsp;replace the IText with IPlaceholder tag&lt;/h3&gt;
&lt;p&gt;Each object you&amp;nbsp;receive in&amp;nbsp;visitor patterns methods belongs to a &lt;span style="color:#339966;"&gt;&amp;quot;Parent&amp;quot;&lt;/span&gt;, which is a&lt;span style="color:#339966;"&gt;&amp;nbsp;IAbstractMarkupDataContainer&lt;/span&gt;. What we need to to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take the parent container:&amp;nbsp;&lt;strong&gt;&lt;code&gt;var elementContainer = text.Parent;&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;from the parent container we need to take all the subitems :&lt;code&gt;&amp;nbsp;&lt;strong&gt;text.Parent.AllSubItems.ToList()&lt;/strong&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;remove the element at specified position: &lt;strong&gt;&lt;code&gt;elementContainer.AllSubItems.ToList()[postion].RemoveFromParent();&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;insert the tag in the position we removed the text :&amp;nbsp;&lt;strong&gt;&lt;code&gt;elementContainer.Insert(position, tag);&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/12</link><pubDate>Mon, 30 Apr 2018 11:10:37 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 12 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 11:10:37 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment and does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag the list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. This is why need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am &lt;strong&gt;IText&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How to create a Placeholder tag using public API&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;var tag = IDocumentItemFactory.CreatePlaceholderTag(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;IPropertiesFactory.CreatePlaceholderTagProperties(&amp;quot;text which should be displayed&amp;quot;));&lt;/code&gt;&lt;br /&gt;&lt;code&gt; tag.Properties.SetMetaData(&amp;quot;customKey&amp;quot;, &amp;quot;customValue&amp;quot;);&lt;/code&gt; &lt;span style="color:#339966;"&gt;how to set custom metadata on your tag&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We assume that we want to transform the IText object from VisitText() into a placeholder. We take the text&amp;nbsp;from the object, create a new placeholder using the method above. All good&amp;nbsp; but what we achieved until now is to create a new placeholder which is not added to the sdlxliff.&lt;/p&gt;
&lt;p&gt;The tag we created must be inserted in the &lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;on the exactly the same position where the IText&amp;nbsp;is.&lt;/p&gt;
&lt;h3&gt;How&amp;nbsp;replace the IText with IPlaceholder tag&lt;/h3&gt;
&lt;p&gt;Each object you&amp;nbsp;receive in&amp;nbsp;visitor patterns methods belongs to a &lt;span style="color:#339966;"&gt;&amp;quot;Parent&amp;quot;&lt;/span&gt;, which is a&lt;span style="color:#339966;"&gt;&amp;nbsp;IAbstractMarkupDataContainer&lt;/span&gt;. What we need to to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take the parent container:&amp;nbsp;&lt;strong&gt;&lt;code&gt;var elementContainer = text.Parent;&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;from the parent container we need to take all the subitems :&lt;code&gt;&amp;nbsp;&lt;strong&gt;text.Parent.AllSubItems.ToList()&lt;/strong&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;remove the element at specified position: &lt;strong&gt;&lt;code&gt;elementContainer.AllSubItems.ToList()[postion].RemoveFromParent();&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;insert the tag in the position we removed the text :&amp;nbsp;&lt;strong&gt;&lt;code&gt;elementContainer.Insert(position, tag);&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/11</link><pubDate>Mon, 30 Apr 2018 11:05:10 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 11 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 11:05:10 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag. The list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. Because of that we need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am &lt;strong&gt;IText&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How to create a Placeholder tag using public API&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;var tag = IDocumentItemFactory.CreatePlaceholderTag(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;IPropertiesFactory.CreatePlaceholderTagProperties(&amp;quot;text which should be displayed&amp;quot;));&lt;/code&gt;&lt;br /&gt;&lt;code&gt; tag.Properties.SetMetaData(&amp;quot;customKey&amp;quot;, &amp;quot;customValue&amp;quot;);&lt;/code&gt; &lt;span style="color:#339966;"&gt;how to set custom metadata on your tag&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We assume that we want to transform the IText object from VisitText() into a placeholder. We take the text of the object, create a new placeholder using the method above. All good&amp;nbsp; but what we achieve until now is to create a new placeholder which is not added to the sdlxliff.&lt;/p&gt;
&lt;p&gt;The tag we created must be inserted in the &lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;on the exactly the same position where the IText&amp;nbsp;is. That means we need to find the index of the IText object, remove it from list, and in his place we need to add the&amp;nbsp; tag item we&amp;nbsp; created above.&lt;/p&gt;
&lt;h3&gt;How&amp;nbsp;replace the IText with IPlaceholder tag&lt;/h3&gt;
&lt;p&gt;Each object you&amp;nbsp;receive in&amp;nbsp;visitor patterns methods belongs to a &lt;span style="color:#339966;"&gt;&amp;quot;Parent&amp;quot;&lt;/span&gt;, which is a&lt;span style="color:#339966;"&gt;&amp;nbsp;IAbstractMarkupDataContainer&lt;/span&gt;. What we need to to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take the parent container:&amp;nbsp;&lt;strong&gt;&lt;code&gt;var elementContainer = text.Parent;&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;from the parent container we need to take all the subitems :&lt;code&gt;&amp;nbsp;&lt;strong&gt;text.Parent.AllSubItems.ToList()&lt;/strong&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;remove the element at specified position: &lt;strong&gt;&lt;code&gt;elementContainer.AllSubItems.ToList()[postion].RemoveFromParent();&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;insert the tag in the position we removed the text :&amp;nbsp;&lt;strong&gt;&lt;code&gt;elementContainer.Insert(position, tag);&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/10</link><pubDate>Mon, 30 Apr 2018 10:50:34 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 10 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:50:34 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag. The list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. Because of that we need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am &lt;strong&gt;IText&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How to create a Placeholder tag using public API&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;var tag = IDocumentItemFactory.CreatePlaceholderTag(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;IPropertiesFactory.CreatePlaceholderTagProperties(&amp;quot;text which should be displayed&amp;quot;));&lt;/code&gt;&lt;br /&gt;&lt;code&gt; tag.Properties.SetMetaData(&amp;quot;customKey&amp;quot;, &amp;quot;customValue&amp;quot;);&lt;/code&gt; &lt;span style="color:#339966;"&gt;how to set custom metadata on your tag&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We assume that we want to transform the IText object from VisitText() into a placeholder. We take the text of the object, create a new placeholder using the method above. All good&amp;nbsp; but what we achieve until now is to create a new placeholder which is not added to the sdlxliff.&lt;/p&gt;
&lt;p&gt;The tag we created must be inserted in the &lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;on the exactly the same position where the IText&amp;nbsp;is. That means we need to find the index of the IText object, remove it from list, and in his place we need to add the&amp;nbsp; tag item we&amp;nbsp; created above.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/9</link><pubDate>Mon, 30 Apr 2018 10:42:31 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 9 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:42:31 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag. The list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. Because of that we need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am &lt;strong&gt;IText&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How to create a Placeholder tag using public API&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;var tag = IDocumentItemFactory.CreatePlaceholderTag(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;IPropertiesFactory.CreatePlaceholderTagProperties(&amp;quot;text which should be displayed&amp;quot;));&lt;/code&gt;&lt;br /&gt;&lt;code&gt; tag.Properties.SetMetaData(&amp;quot;Anonymizer&amp;quot;, &amp;quot;Anonymizer&amp;quot;);&lt;/code&gt; how to set custom metadata on your tag&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/8</link><pubDate>Mon, 30 Apr 2018 10:36:09 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 8 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:36:09 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag. The list will have one &lt;strong&gt;IText&lt;/strong&gt; object and an&amp;nbsp;&lt;strong&gt;IPlaceholderTag&lt;/strong&gt; both interfaces inherits&amp;nbsp;&lt;strong&gt;IAbstractMarkupData.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the objects you see above are interfaces we don&amp;#39;t have access to them out of the box. Because of that we need to use Visitor Pattern which will loop&amp;nbsp;through all the elements and if the element is a placeholder, the method&amp;nbsp;&lt;span style="color:#339966;"&gt;VisitPlaceholderTag()&lt;/span&gt; will be called automatically. If the element is a text &lt;span style="color:#339966;"&gt;VisitText()&lt;/span&gt; method will be called automatically.&lt;/p&gt;
&lt;p&gt;Bellow you can see how you have access to text property for am IText object.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/visitText.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For example if we want to transform &amp;quot;December&amp;quot; which currently is IText object we need to implement Visitor Pattern&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/7</link><pubDate>Mon, 30 Apr 2018 10:21:48 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 7 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:21:48 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;h3&gt;Brief API&amp;#39;s concepts explications&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Each segment you see in Studio editor programmatically is in fact&amp;nbsp;&lt;strong&gt;List&amp;lt;IAbstractMarkupData&amp;gt; &lt;/strong&gt;. For example if in one segment you have plain text and placeholder tag. The list will have one IText object and an&amp;nbsp;IPlaceholderTag.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/tagexample.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/6</link><pubDate>Mon, 30 Apr 2018 10:05:34 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 6 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:05:34 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;If you don&amp;#39;t have referenced &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; and &lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dll&lt;/span&gt;&amp;nbsp;please add a reference to them.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.BilingualApi.dll&lt;/span&gt; we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IDocumentItemFactory&lt;/span&gt; interface.&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span style="color:#339966;"&gt;Sdl.FileTypeSupport.Framework.NativeApi.dl&lt;/span&gt;l we&amp;#39;ll use&amp;nbsp;&lt;span style="color:#339966;"&gt;IPropertiesFactory&lt;/span&gt; interface. This two interfaces will allow is to create a placeholder object.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/5</link><pubDate>Mon, 30 Apr 2018 10:00:13 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 5 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 10:00:13 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor Pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;. &lt;strong&gt;SegmentVisitor.cs&lt;/strong&gt; class contains the algorithm which recursive searches for&amp;nbsp;words inside a segment. And does all the logic for replacing the data.&lt;/p&gt;
&lt;h3&gt;What we want to achieve&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-39/exampletags.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/4</link><pubDate>Mon, 30 Apr 2018 09:53:15 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 4 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 9:53:15 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure, and with &lt;strong&gt;Visitor Pattern&lt;/strong&gt;. More information about Visitor pattern can be found &lt;a href="/developers-more/developers/language-developers/w/wiki/3210.how-to-edit-the-plain-text-from-sdlxliff-in-batch-task-context"&gt;here&lt;/a&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/3</link><pubDate>Mon, 30 Apr 2018 09:52:00 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 3 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 9:52:00 AM&lt;br /&gt;
&lt;p&gt;In this documentation we assume you are familiar with Batch Task plugin structure, and with &lt;strong&gt;Visitor Pattern&amp;nbsp;&lt;/strong&gt;. Like in previous documentation we&amp;#39;ll also use&amp;nbsp;&lt;a title="Project Anonymizer" href="/product-groups/translationproductivity/w/customer-experience/3199.sdl-project-anonymizer"&gt;Project Anonymizer&lt;/a&gt;&amp;nbsp;plugin for&amp;nbsp;code example. Full source code of the project can be found&amp;nbsp;&lt;a href="https://github.com/sdl/Sdl-Community/tree/master/Anonymizer"&gt;here&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment  in Batch Task context</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/2</link><pubDate>Mon, 30 Apr 2018 09:34:13 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 2 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 9:34:13 AM&lt;br /&gt;
&lt;p&gt;..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item><item><title>How to insert a placeholder in Segment</title><link>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context/revision/1</link><pubDate>Mon, 30 Apr 2018 08:42:32 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:259eac19-177e-4343-8913-e69a2c730046</guid><dc:creator>Andrea-Melinda Ghisa</dc:creator><comments>https://uat.community.rws.com/developers-more/trados-portfolio/trados-studio-developers/w/trados-studio-api/3243/how-to-insert-a-placeholder-in-segment-in-batch-task-context#comments</comments><description>Revision 1 posted to Studio Developers WIKI by Andrea-Melinda Ghisa on 4/30/2018 8:42:32 AM&lt;br /&gt;
&lt;p&gt;..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: batch task, Studio Documentation, Studio API, openexchange&lt;/div&gt;
</description></item></channel></rss>