예제 #1
0
 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);
     }
 }
예제 #2
0
        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);
            }
        }