public bool CanContain(string name, SgmlDtd dtd)
 {
     if (this.DeclaredContent != Shove.HTML.SgmlReader.DeclaredContent.Default)
     {
         return(false);
     }
     return(this.Model.CanContain(name, dtd));
 }
 public bool CanContain(string name, SgmlDtd dtd)
 {
     if (this.DeclaredContent != Shove.HTML.SgmlReader.DeclaredContent.Default)
     {
         return false;
     }
     return this.Model.CanContain(name, dtd);
 }
Beispiel #3
0
 public static SgmlDtd Parse(Uri baseUri, string name, string pubid, TextReader input, string subset, string proxy, XmlNameTable nt)
 {
     SgmlDtd dtd = new SgmlDtd(name, nt);
     dtd.PushEntity(baseUri, new Entity(dtd.Name, baseUri, input, proxy));
     if (subset != null && subset != "")
     {
         dtd.PushEntity(baseUri, new Entity(name, subset));
     }
     try
     {
         dtd.Parse();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message + dtd.current.Context());
     }
     return dtd;
 }
Beispiel #4
0
        public static SgmlDtd Parse(Uri baseUri, string name, string pubid, TextReader input, string subset, string proxy, XmlNameTable nt)
        {
            SgmlDtd dtd = new SgmlDtd(name, nt);

            dtd.PushEntity(baseUri, new Entity(dtd.Name, baseUri, input, proxy));
            if (subset != null && subset != "")
            {
                dtd.PushEntity(baseUri, new Entity(name, subset));
            }
            try
            {
                dtd.Parse();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + dtd.current.Context());
            }
            return(dtd);
        }
Beispiel #5
0
        public bool CanContain(string name, SgmlDtd dtd)
        {
            foreach (object obj in Members)
            {
                if (obj is String)
                {
                    if (obj == (object)name)
                    {
                        return(true);
                    }
                }
            }

            foreach (object obj in Members)
            {
                if (obj is String)
                {
                    string      s = (string)obj;
                    ElementDecl e = dtd.FindElement(s);
                    if (e != null)
                    {
                        if (e.StartTagOptional)
                        {
                            if (e.CanContain(name, dtd))
                            {
                                return(true);
                            }
                        }
                    }
                }
                else
                {
                    Group m = (Group)obj;
                    if (m.CanContain(name, dtd))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #6
0
 public bool CanContain(string name, SgmlDtd dtd)
 {
     if (this.Exclusions != null)
     {
         foreach (string str in this.Exclusions)
         {
             if (str == name)
             {
                 return(false);
             }
         }
     }
     if (this.Inclusions != null)
     {
         foreach (string str2 in this.Inclusions)
         {
             if (str2 == name)
             {
                 return(true);
             }
         }
     }
     return(this.ContentModel.CanContain(name, dtd));
 }
 public bool CanContain(string name, SgmlDtd dtd)
 {
     if (this.Exclusions != null)
     {
         foreach (string str in this.Exclusions)
         {
             if (str == name)
             {
                 return false;
             }
         }
     }
     if (this.Inclusions != null)
     {
         foreach (string str2 in this.Inclusions)
         {
             if (str2 == name)
             {
                 return true;
             }
         }
     }
     return this.ContentModel.CanContain(name, dtd);
 }
        private void LazyLoadDtd(Uri baseUri)
        {
            if (this.dtd == null)
            {
                if (this.syslit == null || this.syslit == "")
                {
                    if (this.docType != null && StringUtilities.EqualsIgnoreCase(this.docType, "html"))
                    {
                        Assembly a = typeof(SgmlReader).Assembly;
                        string name = a.FullName.Split(',')[0] + ".Html.dtd";
                        Stream stm = a.GetManifestResourceStream(name);
                        if (stm != null)
                        {
                            StreamReader sr = new StreamReader(stm);
                            this.dtd = SgmlDtd.Parse(baseUri, "HTML", null, sr, null, this.proxy, this.nametable);
                        }
                    }
                }
                else
                {
                    if (baseUri != null)
                    {
                        baseUri = new Uri(baseUri, this.syslit);
                    }
                    else if (this.baseUri != null)
                    {
                        baseUri = new Uri(this.baseUri, this.syslit);
                    }
                    else
                    {
                        baseUri = new Uri(new Uri(Directory.GetCurrentDirectory() + "\\"), this.syslit);
                    }
                    this.dtd = SgmlDtd.Parse(baseUri, this.docType, this.pubid, baseUri.AbsoluteUri, this.subset, this.proxy, this.nametable);
                }

                if (this.dtd != null && this.dtd.Name != null)
                {
                    switch (this.CaseFolding)
                    {
                        case CaseFolding.ToUpper:
                            this.rootElementName = this.dtd.Name.ToUpper();
                            break;
                        case CaseFolding.ToLower:
                            this.rootElementName = this.dtd.Name.ToLower();
                            break;
                        default:
                            this.rootElementName = this.dtd.Name;
                            break;
                    }
                    this.isHtml = StringUtilities.EqualsIgnoreCase(this.dtd.Name, "html");
                }

            }
        }
Beispiel #9
0
        public bool CanContain(string name, SgmlDtd dtd)
        {
            foreach (object obj in Members)
            {
                if (obj is String)
                {
                    if (obj == (object)name)
                        return true;
                }
            }

            foreach (object obj in Members)
            {
                if (obj is String)
                {
                    string s = (string)obj;
                    ElementDecl e = dtd.FindElement(s);
                    if (e != null)
                    {
                        if (e.StartTagOptional)
                        {
                            if (e.CanContain(name, dtd))
                                return true;
                        }
                    }
                }
                else
                {
                    Group m = (Group)obj;
                    if (m.CanContain(name, dtd))
                        return true;
                }
            }
            return false;
        }