/// ------------------------------------------------------------------------------------ /// <summary> /// Set string values for the given property for each writing system represented in the /// nodelist /// </summary> /// <param name="multiUnicodeproperty">A MultiUnicodeAccessor representing the property /// whose value is to be set</param> /// <param name="nodes">An XmlNodeList with the strings in one or more writing systems /// </param> /// ------------------------------------------------------------------------------------ private void SetMultiUnicodeAlternatives(IMultiUnicode multiUnicodeproperty, XmlNodeList nodes) { foreach (XmlNode node in nodes) { int ws = GetWs(node.Attributes); string alternative = node.InnerText; if (ws > 0 && alternative != null && alternative != string.Empty) { multiUnicodeproperty.set_String(ws, m_strFactory.MakeString(alternative, ws)); } // REVIEW: What should we do when the writing system is not defined in the database? } }
/// <summary> /// Read multilingual Unicode data from XML fragments like /// <Name> /// <AUni ws="en">FRAME and OCM Categories</AUni> /// </Name> /// </summary> private void SetMultiUnicodeFromXml(XmlReader xrdr, IMultiUnicode mu) { if (xrdr.IsEmptyElement) { xrdr.Read(); return; } if (xrdr.ReadToDescendant("AUni")) { do { string sWs = xrdr.GetAttribute("ws"); string sVal = xrdr.ReadString(); int ws = m_wsf.GetWsFromStr(sWs); if (ws != 0) { mu.set_String(ws, sVal); } } while (xrdr.ReadToNextSibling("AUni")); } xrdr.Read(); // read the end tag. }
private void SetMultiUnicodeFromXml(XmlReader xrdr, IMultiUnicode mu) { if (xrdr.IsEmptyElement) { xrdr.Read(); return; } if (xrdr.ReadToDescendant("AUni")) { do { string sWs = xrdr.GetAttribute("ws"); string sVal = xrdr.ReadString(); if (sWs == "en") { continue; // don't overwrite the English string } int ws = GetWsFromStr(sWs); mu.set_String(ws, sVal); } while (xrdr.ReadToNextSibling("AUni")); } xrdr.Read(); // read the end tag. }
/// <summary> /// Read multilingual Unicode data from XML fragments like /// <Name> /// <AUni ws="en">FRAME and OCM Categories</AUni> /// </Name> /// </summary> private void SetMultiUnicodeFromXml(XmlReader xrdr, IMultiUnicode mu) { if (xrdr.IsEmptyElement) { xrdr.Read(); return; } if (xrdr.ReadToDescendant("AUni")) { do { string sWs = xrdr.GetAttribute("ws"); string sVal = xrdr.ReadString(); int ws = m_wsf.GetWsFromStr(sWs); if (ws != 0) mu.set_String(ws, sVal); } while (xrdr.ReadToNextSibling("AUni")); } xrdr.Read(); // read the end tag. }
private void SetMultiUnicodeFromXml(XmlReader xrdr, IMultiUnicode mu) { if (xrdr.IsEmptyElement) { xrdr.Read(); return; } if (xrdr.ReadToDescendant("AUni")) { do { string sWs = xrdr.GetAttribute("ws"); string sVal = xrdr.ReadString(); if (sWs == "en") continue; // don't overwrite the English string int ws = GetWsFromStr(sWs); mu.set_String(ws, sVal); } while (xrdr.ReadToNextSibling("AUni")); } xrdr.Read(); // read the end tag. }
void SetString(IMultiUnicode target, int ws, string text) { target.set_String(ws, Cache.TsStrFactory.MakeString(text, ws)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Set string values for the given property for each writing system represented in the /// nodelist /// </summary> /// <param name="multiUnicodeproperty">A MultiUnicodeAccessor representing the property /// whose value is to be set</param> /// <param name="nodes">An XmlNodeList with the strings in one or more writing systems /// </param> /// ------------------------------------------------------------------------------------ private void SetMultiUnicodeAlternatives(IMultiUnicode multiUnicodeproperty, XmlNodeList nodes) { foreach (XmlNode node in nodes) { int ws = GetWs(node.Attributes); string alternative = node.InnerText; if (ws > 0 && alternative != null && alternative != string.Empty) multiUnicodeproperty.set_String(ws, m_strFactory.MakeString(alternative, ws)); // REVIEW: What should we do when the writing system is not defined in the database? } }