/// <summary> /// Add or replace an element type for this schema. /// </summary> /// <param name="name"> /// Name (Qname) of the element /// </param> /// <param name="model"> /// Models of the element's content as a vector of bits /// </param> /// <param name="memberOf"> /// Models the element is a member of as a vector of bits /// </param> /// <param name="flags"> /// Flags for the element /// </param> public void ElementType(string name, int model, int memberOf, int flags) { var e = new ElementType(name, model, memberOf, flags, this); _elementTypes[name.ToLower()] = e; if (memberOf == M_ROOT) { _root = e; } }
private bool _preclosed; // this element has been preclosed /// <summary> /// Return an Element from a specified ElementType. /// </summary> /// <param name="type"> /// The element type of the newly constructed element /// </param> /// <param name="defaultAttributes"> /// True if default attributes are wanted /// </param> public Element(ElementType type, bool defaultAttributes) { _type = type; if (defaultAttributes) { _atts = new Attributes(type.Attributes); } else { _atts = new Attributes(); } Next = null; _preclosed = false; }
//// /// <summary> /// Returns <c>true</c> if this element type can contain another element type. /// That is, if any of the models in this element's model vector /// match any of the models in the other element type's member-of /// vector. /// </summary> /// <param name="other"> /// The other element type /// </param> public bool CanContain(ElementType other) { return (Model & other.MemberOf) != 0; }