internal void EncodeNormalValue(XmlStandard standard) { FastXmlWriter writer = new FastXmlWriter(50, standard); writer.WriteElement("Test", "Value"); Assert.Equal("<Test>Value</Test>", writer.ToString()); }
internal void EncodeSyntaxCharacters(XmlStandard standard) { FastXmlWriter writer = new FastXmlWriter(50, standard); writer.WriteElement("Test", "<&>"); Assert.Equal("<Test><&></Test>", writer.ToString()); }
internal void EncodeSurrogatePair(XmlStandard standard) { FastXmlWriter writer = new FastXmlWriter(50, standard); writer.WriteElement("Test", "💩"); string actual = writer.ToString(); Assert.Equal("<Test>💩</Test>", actual); }
internal void XDocumentCompatibility(XmlStandard standard) { FastXmlWriter writer = new FastXmlWriter(ushort.MaxValue + 200, standard, XmlCharMode.Omit, XmlCharMode.Omit); StringBuilder sb = new StringBuilder(ushort.MaxValue); for (int i = 0; i < ushort.MaxValue; i++) { sb.Append((char)i); } writer.WriteElement("test", sb.ToString()); XDocument _ = XDocument.Parse(writer.ToString()); }
public string FastXmlWriterTest() { FastXmlWriter writer = new FastXmlWriter(100); writer.WriteStartElement("rootnode"); writer.WriteStartElement("person"); writer.WriteElement("name", "santa claus"); writer.WriteElement("age", "800"); writer.WriteElement("status", "missing"); writer.WriteElement("name", "Donald 💩💩💩💩💩\0\0\0\0"); writer.WriteElement("age", "7"); writer.WriteElement("status", "present"); writer.WriteEndElement("person"); writer.WriteEndElement("rootnode"); return(writer.ToString()); }