Class XmlUtil
- Namespace
- SunamoXliffParser
- Assembly
- SunamoXliffParser.dll
Provides utility methods for working with XML elements and attributes.
public static class XmlUtil
- Inheritance
-
XmlUtil
- Inherited Members
Methods
DeNormalizeLineBreaks(string)
Restores standard Windows line breaks by replacing lone newlines with carriage return + newline pairs.
public static string DeNormalizeLineBreaks(string text)
Parameters
textstringThe text to de-normalize.
Returns
- string
The text with Windows-style line breaks, or an empty string if the input is null or whitespace.
GetAttributeIfExists(XElement, string)
Gets the value of an attribute if it exists on the specified element.
public static string GetAttributeIfExists(XElement node, string name)
Parameters
Returns
- string
The attribute value, or an empty string if the attribute does not exist.
GetIntAttributeIfExists(XElement, string)
Gets the integer value of an attribute if it exists on the specified element.
public static int GetIntAttributeIfExists(XElement node, string name)
Parameters
Returns
- int
The parsed integer value, or 0 if the attribute does not exist.
NormalizeLineBreaks(string)
Normalizes line breaks by removing carriage return characters.
public static string NormalizeLineBreaks(string text)
Parameters
textstringThe text to normalize.
Returns
- string
The text with carriage returns removed, or an empty string if the input is null or whitespace.