Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Document Type Declaration (DTD) is prohibited in this XML

$
0
0

I have a WCF service and a Android app that I am passing data back and forth using JSON. I had everything working locally. When I published to the server, I now get this error whenever I try to read in the JSON in the android app. I found several suggestions for using prohibit on a XmlReader, but I'm not using a XmlReader. Here is the code that generates the JSON (which I cannot get to format properly in this forum):

Public Function GetJson(ByVal dt As DataTable) As String

Dim serializer As New System.Web.Script.Serialization.JavaScriptSerializer()

Dim rows As New List(Of Dictionary(Of String, Object))()

Dim row As Dictionary(Of String, Object) = Nothing

For Each dr As DataRow In dt.Rows

row = New Dictionary(Of String, Object)()

For Each dc As DataColumn In dt.Columns

row.Add(dc.ColumnName.Trim(), dr(dc))

Next

rows.Add(row)

Next

Return serializer.Serialize(rows)

End Function

Is there anything I can do on either end to prevent this error? I thought a DTD was a <!DOCTYPE, but that is not even in my JSON. Which by the way is this:[{"fldID":1,"fldGroupID":1,"FirstName":"John","LastName":"Smith"}]

Thanks for any help you can offer.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>