Are these: " (Straight quotation mark) and ' (Apostrophe) special characters in xml?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am working on a xmldocument created from a dataset. During the debug mode, I see the following:<br/>
VS xml visualizer shows:<br/>
<BatchIndexes><BatchIndex><VEHICLE1_MODEL>"<&SENTRA>"</VEHICLE1_MODEL></BatchIndex></BatchIndexes>
VS text visualizer shows:<br/>
<BatchIndexes><BatchIndex><VEHICLE1_MODEL>"&lt;&amp;SENTRA&gt;"</VEHICLE1_MODEL></BatchIndex></BatchIndexes>
My question is why the " and did not get replaced to &quot; and &apos;<br/>
If I want to create another xml file using the InnerXml of the xmlnode, should I replace the " and with entity reference?
Below is the code I have for the xmldocument generation:<br/>
Public Function WriteXMLDoc(ByRef htIndexes As Hashtable) As XmlDocument<br/>
Dim xmldoc As XmlDocument = New XmlDocument<br/>
Dim dataset As DataSet<br/>
Dim datatable As DataTable<br/>
If htIndexes.Count > 0 Then<br/>
Dim htEntry As DictionaryEntry<br/>
Dim memorystream As New MemoryStream<br/>
Dim streamreader As StreamReader<br/>
Dim colcounter As Integer = New Integer<br/>
datatable = New DataTable("BatchIndex")<br/>
datatable.AcceptChanges()<br/>
datatable.Rows.Add()<br/>
For Each htEntry In htIndexes<br/>
datatable.Columns.Add(htEntry.Key.ToString, GetType(System.String))<br/>
datatable.Rows(0).Item(colcounter) = htEntry.Value.ToString<br/>
colcounter = colcounter + 1<br/>
Next<br/>
dataset = New DataSet("BatchIndexes")<br/>
dataset.Tables.Add(datatable)<br/>
dataset.WriteXml(memorystream)<br/>
memorystream.Position = 0<br/>
streamreader = New StreamReader(memorystream)<br/>
Dim xmlstr As String = streamreader.ReadToEnd()<br/>
xmldoc.LoadXml(xmlstr)<br/>
End If<br/>
Return xmldoc<br/>
End Function


View the full article
 
Back
Top