Discouraged
This sample demonstrates how to remove or replace discouraged characters in a document field. For more information about discouraged characters in xml see this article.
Remove discouraged characters
C#
using System.IO;
using System.Linq;
using DocuWare.Platform.ServerClient;
namespace DocuWare.PlatformClientExamples
{
    static partial class Examples
    {
        /// <summary>
        /// This sample demonstrates how discouraged symbols to be removed.
        /// </summary>
        public static void RemoveXmlDiscouragedSymbols(FileCabinet cabinet, Document doc)
        {
            // select the first string field
            DocumentIndexField stringField = doc.Fields.First(x => x.ItemElementName == ItemChoiceType.String);
            // create a source value
            string sourceValue = "test value";
            // add discouraged symbol to the source value
            string sourceValueWithDiscouragedSymbol = sourceValue + (char)1;
            // set the source value with discouraged symbol on a field
            stringField.Item = sourceValueWithDiscouragedSymbol;
            // remove the discouraged symbol
            stringField.RemoveDiscouragedCharacters();
            FileInfo[] filesInfo = new FileInfo[]
            {
                new FileInfo("SomeFiles.txt")
            };
            doc = cabinet.UploadDocument(doc, filesInfo);
        }
    }
}
Replace discouraged characters
C#
using System.IO;
using System.Linq;
using DocuWare.Platform.ServerClient;
namespace DocuWare.PlatformClientExamples
{
    static partial class Examples
    {
        /// <summary>
        /// This sample demonstrates how discouraged symbols to be removed.
        /// </summary>
        public static void ReplaceXmlDiscouragedSymbols(FileCabinet cabinet, Document doc)
        {
            // select the first string field
            DocumentIndexField stringField = doc.Fields.First(x => x.ItemElementName == ItemChoiceType.String);
            // create a source value
            string sourceValue = "test value";
            // add discouraged symbol to the source value
            string sourceValueWithDiscouragedSymbol = sourceValue + (char)1;
            // set the source value with discouraged symbol on a field
            stringField.Item = sourceValueWithDiscouragedSymbol;
            // replace the discouraged symbol
            stringField.ReplaceDiscouragedCharacters("with no discouraged characters");
            FileInfo[] filesInfo = new FileInfo[]
            {
                new FileInfo("SomeFiles.txt")
            };
            doc = cabinet.UploadDocument(doc, filesInfo);
        }
    }
}