Esempio n. 1
0
 private void ReadFormNodes(XmlNodeList nodesWithForms, LiftMultiText text)
 {
     foreach (XmlNode formNode in nodesWithForms)
     {
         try
         {
             string  lang     = Utilities.GetStringAttribute(formNode, _wsAttributeLabel);
             XmlNode textNode = formNode.SelectSingleNode("text");
             if (textNode != null)
             {
                 // Add the separator if we need it.
                 if (textNode.InnerText.Length > 0)
                 {
                     text.AddOrAppend(lang, "", "; ");
                 }
                 foreach (XmlNode node in textNode.ChildNodes)
                 {
                     if (node.Name == "span")
                     {
                         var span = text.AddSpan(lang,
                                                 Utilities.GetOptionalAttributeString(node, "lang"),
                                                 Utilities.GetOptionalAttributeString(node, "class"),
                                                 Utilities.GetOptionalAttributeString(node, "href"),
                                                 node.InnerText.Length);
                         ReadSpanContent(text, lang, span, node);
                     }
                     else
                     {
                         text.AddOrAppend(lang, node.InnerText, "");
                     }
                 }
             }
             var nodelist = formNode.SelectNodes("annotation");
             if (nodelist != null)
             {
                 foreach (XmlNode annotationNode in nodelist)
                 {
                     Annotation annotation = GetAnnotation(annotationNode);
                     annotation.LanguageHint = lang;
                     text.Annotations.Add(annotation);
                 }
             }
         }
         catch (Exception e)
         {
             // not a fatal error
             NotifyFormatError(e);
         }
     }
 }