Exemple #1
0
        //        private static HtmlElementProps  s_otherElements = Create(false, false, false, false, false, false, false);

        public static HtmlElementProps? GetProps(string name)
        {
            HtmlElementProps? result = (HtmlElementProps?)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;
        }
 internal void Initialize(string prefix, string name, string nspace)
 {
     _prefix            = prefix;
     _localName         = name;
     _namespaceURI      = nspace;
     _name              = null;
     this.htmlProps     = null;
     this.htmlAttrProps = null;
     this.TextInfoCount = 0;
 }
Exemple #3
0
 internal void Init(string name, string nspace, string prefix, XmlSpace space, string lang, bool mixed)
 {
     this.scopes       = null;
     _name             = name;
     _nsUri            = nspace;
     _prefix           = prefix;
     _space            = space;
     _lang             = lang;
     _mixed            = mixed;
     _toCData          = false;
     _htmlElementProps = null;
 }
Exemple #4
0
        private void WriteEndElement(RecordBuilder record)
        {
            HtmlElementProps?htmlProps = record.Manager.CurrentElementScope.HtmlElementProps;

            if (htmlProps != null && htmlProps.Empty)
            {
                return;
            }

            Indent(record);
            Write(s_LessThanSlash);
            WriteName(record.MainNode.Prefix, record.MainNode.LocalName);
            Write(s_GreaterThan);
        }
        internal void Initialize(BuilderInfo src)
        {
            _prefix            = src.Prefix;
            _localName         = src.LocalName;
            _namespaceURI      = src.NamespaceURI;
            _name              = null;
            _depth             = src.Depth;
            _nodeType          = src.NodeType;
            this.htmlProps     = src.htmlProps;
            this.htmlAttrProps = src.htmlAttrProps;

            this.TextInfoCount = 0;
            EnsureTextInfoSize(src.TextInfoCount);
            src.TextInfo.CopyTo(this.TextInfo, 0);
            this.TextInfoCount = src.TextInfoCount;
        }
Exemple #6
0
        //
        // Particular outputs
        //
        private void WriteStartElement(RecordBuilder record)
        {
            Debug.Assert(record.MainNode.NodeType == XmlNodeType.Element);
            BuilderInfo      mainNode  = record.MainNode;
            HtmlElementProps?htmlProps = null;

            if (_isHtmlOutput)
            {
                if (mainNode.Prefix.Length == 0)
                {
                    htmlProps = mainNode.htmlProps;
                    if (htmlProps == null && mainNode.search)
                    {
                        htmlProps = HtmlElementProps.GetProps(mainNode.LocalName);
                    }
                    record.Manager.CurrentElementScope.HtmlElementProps = htmlProps;
                    mainNode.IsEmptyTag = false;
                }
            }
            else if (_isXmlOutput)
            {
                if (mainNode.Depth == 0)
                {
                    if (
                        _secondRoot && (
                            _output.DoctypeSystem != null ||
                            _output.Standalone
                            )
                        )
                    {
                        throw XsltException.Create(SR.Xslt_MultipleRoots);
                    }
                    _secondRoot = true;
                }
            }

            if (_outputDoctype)
            {
                WriteDoctype(mainNode);
                _outputDoctype = false;
            }

            if (_cdataElements != null && _cdataElements.Contains(new XmlQualifiedName(mainNode.LocalName, mainNode.NamespaceURI)) && _isXmlOutput)
            {
                record.Manager.CurrentElementScope.ToCData = true;
            }

            Indent(record);
            Write(s_LessThan);
            WriteName(mainNode.Prefix, mainNode.LocalName);

            WriteAttributes(record.AttributeList, record.AttributeCount, htmlProps);


            if (mainNode.IsEmptyTag)
            {
                Debug.Assert(!_isHtmlOutput || mainNode.Prefix != null, "Html can't have abbreviated elements");
                Write(s_SlashGreaterThan);
            }
            else
            {
                Write(s_GreaterThan);
            }

            if (htmlProps != null && htmlProps.Head)
            {
                mainNode.Depth++;
                Indent(record);
                mainNode.Depth--;
                Write("<META http-equiv=\"Content-Type\" content=\"");
                Write(_output.MediaType);
                Write("; charset=");
                Write(this.encoding !.WebName);
                Write("\">");
            }
        }