Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

How do I read this XML Error: There is an error in XML document (8, 2).

I have an xml error during deserializing
Fail: There is an error in XML document (8, 2).

what does 8,2 mean? where is that?
<?xml version="1.0" encoding="UTF-8"?>
<XXXTraineeResult>
  <Processed>
    <Environment>TEST</Environment>
    <Trainees>
      <Trainee>
        <TrainingSessionNumber>0</TrainingSessionNumber>
        <SessionDateTime>2014-10-15T18:02:27.000</SessionDateTime>
        <ExamResult>P</ExamResult>
        <SocialSecurityLastFour>5555</SocialSecurityLastFour>
        <DateOfBirth>1997-11-03</DateOfBirth>
        <Name>
          <First>test</First>
          <MiddleInitial>K</MiddleInitial>
          <Last>test</Last>
        </Name>
      </Trainee>
    </Trainees>
  </Processed>
</XXXTraineeResult>

thanks!
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Problem could be at your class definition, can we have a look in your class scripts?

in case this is useful:

XmlSerializer.Deserialize Method (XmlReader)
http://msdn.microsoft.com/en-us/library/tz8csy73(v=vs.110).aspx
Avatar of Starr Duskk

ASKER

attached is the vb from the schema.

Here is my deserialization method:

        Public Function GetOrderQueryReply(ByVal result As String) As RampTraineeResult.RAMPTraineeResult
            Dim oqr As RampTraineeResult.RAMPTraineeResult = New RampTraineeResult.RAMPTraineeResult()
            Dim serializer As New XmlSerializer(GetType(RampTraineeResult.RAMPTraineeResult))
            Dim reader As New StringReader(result)
            oqr = DirectCast(serializer.Deserialize(reader), RampTraineeResult.RAMPTraineeResult)
            Return oqr

        End Function

Open in new window

RampTraineeResult.vb
ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of louisfr
louisfr

(8, 2) means line 8, character 2.
The Exception should have an InnerException with the exact cause of the error.
Perfect!! Why do I always forget I can look there!!!?? thanks!