public void writeNode_XmlReader39(XmlWriterUtils utils, bool defattr) { string strxml = "<!DOCTYPE root SYSTEM \"\uD812\uDD12\"><root/>"; string exp = utils.IsIndent() ? "<!DOCTYPE root SYSTEM \"\uD812\uDD12\"[]>" + Environment.NewLine + "<root />" : "<!DOCTYPE root SYSTEM \"\uD812\uDD12\"[]><root />"; using (XmlReader xr = CreateReader(new StringReader(strxml))) { using (XmlWriter w = utils.CreateWriter()) { w.WriteNode(xr, defattr); } } Assert.Equal(exp, utils.GetString()); }
public void writeNode_XmlReader20(XmlWriterUtils utils) { string strxml = "<!DOCTYPE ROOT []><ROOT/>"; string exp = utils.IsIndent() ? "<!DOCTYPE ROOT []>" + Environment.NewLine + "<ROOT />" : "<!DOCTYPE ROOT []><ROOT />"; using (XmlReader xr = CreateReader(new StringReader(strxml))) using (XmlWriter w = utils.CreateWriter()) { while (xr.NodeType != XmlNodeType.DocumentType) { xr.Read(); } w.WriteNode(xr, false); w.WriteStartElement("ROOT"); w.WriteEndElement(); } Assert.Equal(exp, utils.GetString()); }
public void writeNode_XmlReader12(XmlWriterUtils utils) { using (XmlReader xr = CreateReaderIgnoreWSFromString("<!DOCTYPE node [ <!ENTITY test \"Test Entity\"> ]><node>&test;</node>")) { bool sanityCheck = false; while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element && xr.LocalName == "node") { sanityCheck = true; break; } } Assert.True(sanityCheck, "error in input doc"); using (XmlWriter w = utils.CreateWriter()) { w.WriteNode(xr, false); } } Assert.Equal("<node>Test Entity</node>", utils.GetString()); }