Reading XML with XML Web Control

Results 1 to 2 of 2

Thread: Reading XML with XML Web Control

  1. #1
    Join Date
    Dec 1969

    Default Reading XML with XML Web Control

    I have posted this in the other forums without a response so I am hoping someone here may know how I can get this to work...<BR><BR> I have an XML web control on a usercontrol. The only purpose for this usercontrol is to get XML data from a URL and display <BR>it in the xml web control with the help of XSL. <BR><BR>I can get this to work if I log into the machine that is hosting the website, whether it be my dev box or staging box. When I try to access the page remotely, I get an error: <BR><BR>This is an unexpected token. The expected token is &#039;QUOTE&#039;. Line 1, position 110. <BR>at System.Xml.XmlScanner.ScanToken(Int32 expected) at <BR>System.Xml.XmlTextReader.SetLiteralValues(XmlA ttributeTokenInfo fld) at System.Xml.XmlTextReader.SetAttributeValues() at <BR>System.Xml.XmlTextReader.ParseElement() at System.Xml.XmlTextReader.Read() at <BR>System.Xml.XmlLoader.LoadChildren(XmlNode parent) at <BR>System.Xml.XmlLoader.LoadElementNode() at <BR>System.Xml.XmlLoader.LoadCurrentNode() at <BR>System.Xml.XmlLoader.LoadChildren(XmlNode parent) at <BR>System.Xml.XmlLoader.LoadElementNode() at <BR>System.Xml.XmlLoader.LoadCurrentNode() at <BR>System.Xml.XmlLoader.LoadDocSequence(XmlDocume nt parentDoc) at <BR>System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean <BR>preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at <BR>Website.mysurveys1.GetXML(String strSourceFile) <BR><BR>Here are the following entries in my web.config file: <BR><BR>&#060;authentication mode="Windows" /&#062; <BR>&#060;identity impersonate="true" /&#062; <BR><BR>And here is the code I wrote in the usercontrol to access the XML: <BR><BR> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load <BR> Xml1.Document = GetXML("http://somedomain/folder/GetXml.asp") <BR> End Sub <BR><BR> Function GetXML(ByVal strSourceFile As String) <BR> Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(strSourceFile) <BR> myRequest.Credentials = System.Net.CredentialCache.DefaultCredentials <BR> Try <BR> Dim myResponse As System.Net.WebResponse = myRequest.GetResponse() <BR> Dim myReader As System.Xml.XmlTextReader = New System.Xml.XmlTextReader(myResponse.GetResponseStr eam()) <BR> Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument <BR> doc.Load(myReader) <BR> GetXML = doc <BR> Catch ex As Exception <BR>Response.Write(ex.Message.ToString & " <BR>" & ex.StackTrace.ToString) <BR> End Try <BR> End Function <BR><BR>The error is occuring at this line of my function: <BR>Dim myResponse As System.Net.WebResponse = myRequest.GetResponse() <BR><BR>Am I doing something wrong? <BR><BR>I have been searching for an answer for a few days now to no avail. Any help would be greatly appreciated. <BR>

  2. #2
    Join Date
    Dec 1969

    Default I would assume...

    ...that your request is generating some sort of error and then that error violates XML rules. <BR><BR>Can you hit that page (http://somedomain/folder/GetXml.asp) from a browser and see what it returns? Especially when given invalid credentials?<BR><BR>And are you *SURE* you get it on the line you showed? Your stack trace is only showing the call to GetXML. Maybe temporarily lose the TRY CATCH and see for sure where it&#039;s happening? I would have expected it to happen on the next line, or even a couple of lines later, if it&#039;s simply a matter of invalid XML.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts