Beispiel #1
0
 /// <summary>
 /// Serialize search index data and push it into the package
 /// </summary>
 /// <param name="searchData">search data to serialize</param>
 protected void SerializeAndPushToPackage(SearchData searchData)
 {
     if (searchData.HasIndexData())
     {
         //prevent unwanted namespaces from appearing in the output
         XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
         ns.Add("", ""); 
         XmlDocument xmlData = new XmlDocument();
         xmlData.LoadXml(SerializeObjectToXml(searchData, ns));
         XmlElement body = searchData.GetCatchAllElement();
         XmlElement custom = searchData.GetCustomElement();
         XmlNode bodyNode = xmlData.ImportNode(body, true);
         XmlNode customNode = xmlData.ImportNode(custom, true);
         xmlData.DocumentElement.AppendChild(bodyNode);
         xmlData.DocumentElement.AppendChild(customNode);
         this.PushXmlDocumentToPackage(Constants.PACKAGE_ITEM_SEARCHDATA, xmlData);
     }
 }