internal void SetDocument(OpmlDocument document)
 {
     this._document = document;
     foreach (OpmlOutline item in this.List)
     {
         item.SetDocument(document);
     }
 }
 /// <summary>
 /// Parse the data from specified Uri into a document.
 /// </summary>
 /// <param name="document">The document instance to store the gained data in.</param>
 /// <param name="xmlTextReader">XmlTextReader instance</param>
 protected virtual void Parse(OpmlDocument document, System.Xml.XmlReader xmlTextReader)
 {
     try
     {
         System.Diagnostics.Debug.Assert(xmlTextReader != null);
         //
         xmlTextReader.MoveToContent();
         if (xmlTextReader.Name != "opml")
         {
             throw new FormatException(xmlTextReader.BaseURI + " is no valid Opml File");
         }
         // read the stream forward while not end of file
         int currentDepth = -1;
         System.Collections.Hashtable nodeLevels = new System.Collections.Hashtable();
         //
         while (!xmlTextReader.EOF)
         {
             // process head
             if (xmlTextReader.Name == "head" && xmlTextReader.NodeType == XmlNodeType.Element)
             {
                 document.Head = new OpmlHead(xmlTextReader);
             }
             // process outline and child outlines
             else if (xmlTextReader.Name == "outline" && xmlTextReader.NodeType == XmlNodeType.Element)
             {
                 currentDepth = xmlTextReader.Depth;
                 //
                 OpmlOutline o = OnCreateOutline(xmlTextReader);
                 if (currentDepth == 2)
                 {
                     document.Body.Items.Add(o);
                     // new node
                     nodeLevels.Clear();
                 }
                 else
                 {
                     ((OpmlOutline)nodeLevels[xmlTextReader.Depth - 1]).Items.Add(o);
                 }
                 nodeLevels[xmlTextReader.Depth] = o;
             }
             else
             {
                 xmlTextReader.Read();
                 xmlTextReader.MoveToContent();
             }
         }
     }
     finally
     {
         if (xmlTextReader != null)
         {
             xmlTextReader.Close();
         }
     }
 }
Пример #3
0
 internal void SetDocument(OpmlDocument value)
 {
     this._document = value;
 }
Пример #4
0
 internal void SetDocument(OpmlDocument value)
 {
     Document1 = value;
     _items.SetDocument(value);
 }
 /// <summary>Sets the document that the outline is assigned to.</summary>
 internal void SetDocument(OpmlDocument value)
 {
     this._document = value;
     this._items.SetDocument(value);
 }