Xml WellFormedness error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhimanav
    New Member
    • Jul 2007
    • 3

    Xml WellFormedness error

    Good Morning every one,
    I have an application that is going to recieve the Xml file via Http post.
    the Xml file will contain one root node and around 100 child nodes.
    Each child node again has 4 childnodes.
    if any one of the childnode is not well formed then by default my parser
    (Xml TextReader) will stop parsing and will throw an error that" the starting tag doesnot match Ending tag" . once the parser is encountering such error the reader does not proceed further.
    after a research i found that this kind of error is a fatal error and cannot be processed untill the file is corrected as per the Specifications.
    i wanted to know is there any way to overcome such error programatically ?!
    right now i am using XmlTextReader class to parse through the Xml file. i have chosen this class because of performance criteria and i am using While loop to iterate through the nodes repeatedly one after the other sequentially.
    I would be really thankfull if some one helps me out!
  • RoninZA
    New Member
    • Jul 2007
    • 78

    #2
    You can use a normal System.IO.Strea mReader, which will read your XML file as a normal text file, but you'll have to then add code to parse the XML yourself.

    Comment

    • abhimanav
      New Member
      • Jul 2007
      • 3

      #3
      Originally posted by RoninZA
      You can use a normal System.IO.Strea mReader, which will read your XML file as a normal text file, but you'll have to then add code to parse the XML yourself.
      I have tried using Stream Reader also but as soon as the reader reads a faulty Xml file it also throws the same error that the Starting tag doesnot match the ending tag.
      Please advice me!
      As per the logic even the client generates the Xml file progrmatically, if one child node is not well formed then the same mistake will be repeated through out the file.
      I am really confused please advice me !
      Thanks in advance

      Comment

      • RoninZA
        New Member
        • Jul 2007
        • 78

        #4
        ok, well, the only other thing is to ensure that your XML is well-formed, rather than trying to parse invalid XML.

        Comment

        • abhimanav
          New Member
          • Jul 2007
          • 3

          #5
          Thanks a lot for the advice.
          I will get back once i complete the thing!

          Comment

          Working...