When overridden in a derived class, writes the given text content.
Assembly: System.Xml (in System.Xml.dll)
WriteString does the following:
The characters &, <, and > are replaced with &, <, and >, respectively.
The default behavior of an XmlWriter created using Create is to throw an ArgumentException when attempting to write character values in the range 0x-0x1F (excluding white space characters 0x9, 0xA, and 0xD). These invalid XML characters can be written by creating the XmlWriter with the CheckCharacters property set to false. Doing so will result in the characters being replaced with numeric character entities (� through �x1F). Note Microsoft does not encourage the practice of writing invalid XML characters since many applications that consume XML are not designed to handle invalid characters.
If WriteString is called in the context of an attribute value, double and single quotes are replaced with " and ' respectively.
For example, this input string test<item>test is written out as
If text is either Nothing or String.Empty, this method writes a text node with no data content.
Dim output As StringBuilder = New StringBuilder() Dim xmlString As String = "<?xml version='1.0'?>" & _ "<!-- This is a sample XML document -->" & _ "<Items>" & _ "<Item>test with a child element <more/> stuff</Item>" & _ "</Items>" ' Create an XmlReader Using reader As XmlReader = XmlReader.Create(New StringReader(xmlString)) Dim ws As XmlWriterSettings = New XmlWriterSettings() ws.Indent = True Using writer As XmlWriter = XmlWriter.Create(output, ws) ' Parse the file and display each of the nodes. While reader.Read() Select Case reader.NodeType Case XmlNodeType.Element writer.WriteStartElement(reader.Name) Case XmlNodeType.Text writer.WriteString(reader.Value) Case XmlNodeType.XmlDeclaration Case XmlNodeType.ProcessingInstruction writer.WriteProcessingInstruction(reader.Name, reader.Value) Case XmlNodeType.Comment writer.WriteComment(reader.Value) Case XmlNodeType.EndElement writer.WriteFullEndElement() End Select End While End Using End Using OutputTextBlock.Text = output.ToString()
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.