internal static HxlWriterSettings From(DomWriterSettings settings) { if (settings is HxlWriterSettings hw) { return(hw); } return(new HxlWriterSettings()); }
public void ToDomString_with_pretty_print_inner_text() { var doc = new DomDocument().LoadXml("<root>before text<child />after text<child><grandchild /></child></root>"); var pretty = new DomWriterSettings { PrettyPrint = true }; Assert.Expect(doc.ToDomString(pretty)).ToBe.EqualTo(@" <root>before text <child />after text <child> <grandchild /> </child> </root>".TrimStart() ); }
public void ToDomString_with_pretty_print() { var doc = new DomDocument().LoadXml("<root attribute=\"v\" a=\"b\"><child /><child><grandchild a=\"b\" aaa=\"bbb\"/></child></root>"); var pretty = new DomWriterSettings { PrettyPrint = true }; Assert.Expect(doc.ToDomString(pretty)).ToBe.EqualTo(@" <root attribute = ""v"" a = ""b""> <child /> <child> <grandchild a = ""b"" aaa = ""bbb"" /> </child> </root>".TrimStart() ); }
protected override DomWriter CreateDomWriter(TextWriter textWriter, DomWriterSettings settings) { return(new HxlWriter(textWriter, HxlWriterSettings.From(settings))); }
public new HxlWriter CreateWriter(TextWriter writer, DomWriterSettings settings) { return((HxlWriter)base.CreateWriter(writer, settings)); }
protected override DomWriter CreateDomWriter(TextWriter textWriter, DomWriterSettings settings) { return(new CustomWriter()); }