/[xmltv_parser]/trunk/libxmltv/Core/XMLTVRuntimeInstance.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTVRuntimeInstance.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 83 by william, Sat Mar 9 12:41:07 2013 UTC revision 107 by william, Sun Mar 10 12:58:40 2013 UTC
# Line 55  namespace libxmltv.Core Line 55  namespace libxmltv.Core
55              this.XmlFile_FullName = string.Empty;              this.XmlFile_FullName = string.Empty;
56              this.XmlDoc = string.Empty;              this.XmlDoc = string.Empty;
57              this.OnInstanceCreated = null;              this.OnInstanceCreated = null;
58                this.ExtraEntries = new List<IExtraMetaData>();
59          }          }
60    
61          #region IXMLTVRuntimeInstance members          #region IXMLTVRuntimeInstance members
# Line 75  namespace libxmltv.Core Line 76  namespace libxmltv.Core
76          public List<IXMLTVChannel> Channels { get { return _Channels; } set { _Channels = value; } }          public List<IXMLTVChannel> Channels { get { return _Channels; } set { _Channels = value; } }
77          private List<IXMLTVProgram> _Programs;          private List<IXMLTVProgram> _Programs;
78          public List<IXMLTVProgram> Programs { get { return _Programs; } set { _Programs = value; } }          public List<IXMLTVProgram> Programs { get { return _Programs; } set { _Programs = value; } }
79    
80            private List<IExtraMetaData> _ExtraEntries;
81            public List<IExtraMetaData> ExtraEntries { get { return _ExtraEntries; } set { _ExtraEntries = value; } }
82          #endregion                #endregion      
83          #region IOnInstanceCreated members          #region IOnInstanceCreated members
84          [NonSerialized]          [NonSerialized]
# Line 405  namespace libxmltv.Core Line 409  namespace libxmltv.Core
409                      }                      }
410                  }                  }
411              }              }
412              if (handler_type == null)              if (handler_type == null)
413              {              {
414                  StringBuilder node_builder = new StringBuilder();                  try
415                  node_builder.AppendFormat("<{0} ", node.Name);                  {
416                  if (node.HasAttributes) { foreach (var attribute in node.Attributes()) { node_builder.AppendFormat("{0}=\"{1}\" ", attribute.Name, attribute.Value); } }                      raw_instance = Activator.CreateInstance(typeof(UnhandledNodeData), flags, null, new object[] { gInstance, node }, culture);
417                  string node_text = string.Format("{0}>", node_builder.ToString().TrimEnd(new char[] { ' ' }));                  }
418                  throw new Exception(string.Format("Unable to find a compatible handler to parse node: {0}", node_text));                  catch (Exception ex) { throw ex; }
419    
420                    if (raw_instance == null)
421                    {
422                        StringBuilder node_builder = new StringBuilder();
423                        node_builder.AppendFormat("<{0} ", node.Name);
424                        if (node.HasAttributes) { foreach (var attribute in node.Attributes()) { node_builder.AppendFormat("{0}=\"{1}\" ", attribute.Name, attribute.Value); } }
425                        string node_text = string.Format("{0}>", node_builder.ToString().TrimEnd(new char[] { ' ' }));
426                        throw new Exception(string.Format("Unable to find a compatible handler to parse node: {0}", node_text));
427                    }
428                }
429                else
430                {
431                    xmltv_logger.Verbose.Debug.WriteLine("Created handler for node: '{0}'", node_name.ToString());
432                    raw_instance = Activator.CreateInstance(handler_type, flags, null, new object[] { gInstance, node }, culture);                
433              }              }
             xmltv_logger.Verbose.Debug.WriteLine("Created handler for node: '{0}'", node_name.ToString());  
             raw_instance = Activator.CreateInstance(handler_type, flags, null, new object[] { gInstance, node }, culture);  
434              return true;              return true;
435          }          }
436            #region UnhandledExtraMetaData
437            private class UnhandledNodeData : XMLTVBase<XMLTVRuntimeInstance>
438            {
439                public UnhandledNodeData() : base(null, null) { }
440                public UnhandledNodeData(XMLTVRuntimeInstance instance, XElement node)
441                    : base(instance, null)
442                {
443                    if (node == null) { throw new NullReferenceException("The node instance was null"); }
444                    xmltv_logger.Verbose.Debug.WriteLine("Parsng unhandled node data: {0}", node.Name.ToString());
445                    if (this.GetInstance() != null)
446                    {
447                        ExtraMetaData data = new ExtraMetaData(node);
448                        instance.ExtraEntries.Add(data);
449                    }
450                }
451            }
452            #endregion
453                    
454      }      }
455  }  }

Legend:
Removed from v.83  
changed lines
  Added in v.107

  ViewVC Help
Powered by ViewVC 1.1.22