Exemple #1
0
 /// <summary>
 /// Attribute objects are reused during parsing to reduce memory allocations,
 /// hence the Reset method.
 /// </summary>
 public void Reset(string name, XmlNodeType nt, string value)
 {
     _value            = value;
     _name             = name;
     _nodeType         = nt;
     _space            = XmlSpace.None;
     _xmlLang          = null;
     _isEmpty          = true;
     _attributes.Count = 0;
     _dtdType          = null;
 }
Exemple #2
0
        public bool CanContain(string name, SgmlDtd dtd)
        {
            Precondition.Require(dtd, () => Error.ArgumentNull("dtd"));

            // Do a simple search of members.
            foreach (object obj in _members)
            {
                if (obj is String)
                {
                    if (String.Equals((string)obj, name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(true);
                    }
                }
            }
            // didn't find it, so do a more expensive search over child elements
            // that have optional start tags and over child groups.
            foreach (object obj in _members)
            {
                string s = (obj as string);
                if (s != null)
                {
                    ElementDeclaration 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);
        }
 /// <summary>
 /// Attribute objects are reused during parsing to reduce memory allocations, 
 /// hence the Reset method. 
 /// </summary>
 public void Reset(string name, XmlNodeType nt, string value)
 {
     _value = value;
     _name = name;
     _nodeType = nt;
     _space = XmlSpace.None;
     _xmlLang = null;
     _isEmpty = true;
     _attributes.Count = 0;
     _dtdType = null;
 }