// static private HtmlElementProps s_otherAttributes = Create(false, false, false); static public HtmlAttributeProps GetProps(string name) { HtmlAttributeProps result = (HtmlAttributeProps)s_table[name]; return(result); // We can do this but in case of Xml/Html mixed output this doesn't have big sence. // return result != null ? result : s_otherElements; }
static public HtmlAttributeProps Create(bool abr, bool uri, bool name) { HtmlAttributeProps props = new HtmlAttributeProps(); props.abr = abr; props.uri = uri; props.name = name; return(props); }
internal void Initialize(string prefix, string name, string nspace) { this.prefix = prefix; this.localName = name; this.namespaceURI = nspace; this.name = null; this.htmlProps = null; this.htmlAttrProps = null; this.lastTextInfo = this; // TextInfo: this.disableEscaping = false; this.valueBuilder = new StringBuilder(); this.nextTextInfo = null; }
private void WriteAttributes(ArrayList list, int count, HtmlElementProps htmlElementsProps) { Debug.Assert(count <= list.Count); for (int attrib = 0; attrib < count; attrib++) { Debug.Assert(list[attrib] is BuilderInfo); BuilderInfo attribute = (BuilderInfo)list[attrib]; string attrValue = attribute.Value; bool abr = false, uri = false; { if (htmlElementsProps != null && attribute.Prefix.Length == 0) { HtmlAttributeProps htmlAttrProps = attribute.htmlAttrProps; if (htmlAttrProps == null && attribute.search) { htmlAttrProps = HtmlAttributeProps.GetProps(attribute.LocalName); } if (htmlAttrProps != null) { abr = htmlElementsProps.AbrParent && htmlAttrProps.Abr; uri = htmlElementsProps.UriParent && (htmlAttrProps.Uri || htmlElementsProps.NameParent && htmlAttrProps.Name ); } } } Write(s_Space); WriteName(attribute.Prefix, attribute.LocalName); if (abr && 0 == string.Compare(attribute.LocalName, attrValue, /*ignoreCase:*/ true, CultureInfo.InvariantCulture)) { // Since the name of the attribute = the value of the attribute, // this is a boolean attribute whose value should be suppressed continue; } Write(s_EqualQuote); if (uri) { WriteHtmlUri(attrValue); } else if (this.isHtmlOutput) { WriteHtmlAttributeValue(attrValue); } else { WriteXmlAttributeValue(attrValue); } Write(s_Quote); } }
internal void Initialize(BuilderInfo src) { this.prefix = src.Prefix; this.localName = src.LocalName; this.namespaceURI = src.NamespaceURI; this.name = null; this.depth = src.Depth; this.nodeType = src.NodeType; this.htmlProps = src.htmlProps; this.htmlAttrProps = src.htmlAttrProps; this.lastTextInfo = src.lastTextInfo; // TextInfo: this.disableEscaping = src.disableEscaping; this.valueBuilder = src.valueBuilder; this.nextTextInfo = src.nextTextInfo; // This not really correct to copy valueBuilder, but on next usage it will be reinitialized. The same for clone. }
public BeginEvent(Compiler compiler) { NavigatorInput input = compiler.Input; Debug.Assert(input != null); Debug.Assert(input.NodeType != XPathNodeType.Namespace); this.nodeType = input.NodeType; this.namespaceUri = input.NamespaceURI; this.name = input.LocalName; this.prefix = input.Prefix; this.empty = input.IsEmptyTag; if (nodeType == XPathNodeType.Element) { this.htmlProps = HtmlElementProps.GetProps(this.name); } else if (nodeType == XPathNodeType.Attribute) { this.htmlProps = HtmlAttributeProps.GetProps(this.name); } }
static public HtmlAttributeProps Create(bool abr, bool uri, bool name) { HtmlAttributeProps props = new HtmlAttributeProps(); props.abr = abr; props.uri = uri; props.name = name; return props; }