Class XmlTranslator
Extends the XmlDocument. It can hold a DOM of any XML document or fragment, which can be used to translate the XML into other forms. Currently, this class only supports translation from XML to RTF (Rich Text Format).
Inheritance
Namespace: Syncfusion.GridHelperClasses
Assembly: Syncfusion.GridHelperClasses.Windows.dll
Syntax
public class XmlTranslator : XmlDocument
Constructors
XmlTranslator()
Initializes a new instance of the XmlTranslator class.
Declaration
public XmlTranslator()
XmlTranslator(String)
Initializes a new instance of the XmlTranslator class. Passing a string of XML code to be translated creates a DOM of the Xml fragment.
Declaration
public XmlTranslator(string xmlText)
Parameters
Type | Name | Description |
---|---|---|
System.String | xmlText | XML code to be translated. |
Properties
Errors
Gets the errors of HTML code in XHTML cell. Any errors encountered during translation will be contained in this ArrayList of strings.
Declaration
public ArrayList Errors { get; }
Property Value
Type |
---|
System.Collections.ArrayList |
Methods
ToRtfDocument()
Initiates translation from XML to RTF (Rich Text Format) Returns an object representing a RTF document.
Declaration
public RtfDocument ToRtfDocument()
Returns
Type | Description |
---|---|
RtfDocument | The RtfDocument. |
TranslateXmlNodeIntoRtfGroup(XmlNode, Int32)
Translates the XML into RTF code. It recursively walks the XML DOM tree, building the RTF document as it goes.
Declaration
public void TranslateXmlNodeIntoRtfGroup(XmlNode x, int baseFontSize)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlNode | x | The current node to be translated. |
System.Int32 | baseFontSize | The XHTML font size (1-7) of the parent element. |
TrimBody(String)
Trims all the XML code outside of body element.
Declaration
public string TrimBody(string xmlText)
Parameters
Type | Name | Description |
---|---|---|
System.String | xmlText | XML code to be trimmed. |
Returns
Type | Description |
---|---|
System.String | Trimmed XML code. |
Remarks
/// If there is a body element, then all XML code outside of it is removed.