Пример #1
0
 /// <summary>
 /// 从HTML读取器中加载对象数据
 /// </summary>
 /// <param name="myReader"></param>
 /// <returns></returns>
 internal override bool InnerRead(HTMLTextReader myReader)
 {
     strLoadErrorMsg = null;
     strSourceXML    = myReader.ReadToEndTag(this.TagName);
     try
     {
         myXMLDocument.RemoveAll();
         System.Xml.XmlNamespaceManager nsm = new System.Xml.XmlNamespaceManager(myXMLDocument.NameTable);
         foreach (HTMLAttribute attr in myOwnerDocument.Attributes)
         {
             string vName = attr.Name;
             if (vName.ToLower().StartsWith(StringConstAttributeName.XMLNS))
             {
                 int index = vName.IndexOf(":");
                 if (index > 0)
                 {
                     string NsName = vName.Substring(index + 1);
                     nsm.AddNamespace(NsName, attr.Value);
                 }
             }
         }
         System.Xml.XmlParserContext pc          = new System.Xml.XmlParserContext(myXMLDocument.NameTable, nsm, null, System.Xml.XmlSpace.None);
         System.Xml.XmlTextReader    myXMLReader = new System.Xml.XmlTextReader(strSourceXML, System.Xml.XmlNodeType.Element, pc);
         myXMLDocument.Load(myXMLReader);
         myXMLReader.Close();
     }
     catch (Exception ext)
     {
         myXMLDocument.RemoveAll();
         strLoadErrorMsg = "加载XML数据岛信息错误 - " + ext.Message;
     }
     return(true);
 }