public override void ExitAssignedAttr(HTMLParser.AssignedAttrContext ctx) { var attrNameCtx = ctx.htmlAttributeName(); if (attrNameCtx == null) { return; } var attrValueCtx = ctx.htmlAttributeValue(); if (attrValueCtx == null) { return; } var attrNameText = MyTreeProperty.Get(attrNameCtx); if (string.IsNullOrEmpty(attrNameText)) { return; } var attrValueText = MyTreeProperty.Get(attrValueCtx); if (string.IsNullOrEmpty(attrValueText)) { return; } //TODO swap attributes name & values here if (attrValueText.Length <= 2) FilteredPut(ctx, attrNameText + "=" + attrValueText); else { var openQuot = attrValueText.Substring(0, 1); var closeQuot = attrValueText.Substring(attrValueText.Length - 1, 1); var attrInnerValue = attrValueText.Substring(1, attrValueText.Length - 2).EscapeString(EscapeStringType.XML); FilteredPut(ctx, attrNameText + "=" + openQuot + attrInnerValue + closeQuot); } }