Open cmwoods opened 11 years ago
Also the BR tag seems to get rendered without it's self closing slash, which breaks XHTML compliance.
I'm just getting back into the swing of things after my daughter was born (:first-child) but I'm planning to get caught up this week! Thanks for hanging in there.
+1
This sounds (no harm intended) like a small change?
This works as far as I can tell, see CsQuery.Tests\HtmlParser\DocType.cs
- as long as the document type is XHTML, it should render the correct tag format.
[Test]
public void Issue94()
{
string html = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN""
""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html><head></head><body><br></body></html>";
var dom = CQ.Create(html);
var br = dom["br"];
Assert.AreEqual(br.RenderSelection(), "<br />");
}
You can change the doctype by replacing the DocType
node:
dom.Document.DocTypeNode = dom.Document.CreateDocumentType(DocType.XHTML);
Is there any way to specify that the Save or Render methods should generate XHTML output? I'm reading in XHTML input document but the output is generated is no longer XHTML (tags like meta aren't being self-closed which I think is a requirement of XHTML?).