void WriteStartElement(RecordBuilder record) {
Debug.Assert(record.MainNode.NodeType == XmlNodeType.Element);
BuilderInfo mainNode = record.MainNode;
HtmlElementProps htmlProps = null;
if (this.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 (this.isXmlOutput) {
if (mainNode.Depth == 0) {
if(
secondRoot && (
output.DoctypeSystem != null ||
output.Standalone
)
) {
throw XsltException.Create(Res.Xslt_MultipleRoots);
}
secondRoot = true;
}
}
if (this.outputDoctype) {
WriteDoctype(mainNode);
this.outputDoctype = false;
}
if (this.cdataElements != null && this.cdataElements.Contains(new XmlQualifiedName(mainNode.LocalName, mainNode.NamespaceURI)) && this.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(! this.isHtmlOutput || mainNode.Prefix != null, "Html can't have abreviated 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(this.output.MediaType);
Write("; charset=");
Write(this.encoding.WebName);
Write("\">");
}
}