Results 1 to 3 of 3

Thread: Knowledge limitation in XmlTextReader

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    29

    Unhappy Knowledge limitation in XmlTextReader

    Hi Guys,
    I am currently facing a problem with XmlTextReader. I use XmlTextReader.Read() to read an xml document. Following is a portion of the document:

    <title> XML &amp; XHTML </title>

    What I would like to do is to copy the whole text without any modification on it and assign it to a string, xmlDoc.
    Therefore the expected result is:
    xmlDoc = " XML &amp; XHTML "

    However, XmlTextReader.Read() automatically converts that text into " XML & XHTML ". So the result that I get is:
    xmlDoc = " XML & XHTML "

    May I know, is there any solution to solve this problem? I have been thinking of the char by char checking. After detecting the char "&" then assign "&amp;" to the string. But this way is not practical at all because other than "&", we still have many special character like ©, <, >, etc

    I would appreciate any reply, thank you

  2. #2
    Addicted Member
    Join Date
    Sep 2004
    Location
    Brooklyn
    Posts
    147

    Re: Knowledge limitation in XmlTextReader

    Well if you do end up doing char-by-char checking, you can just read from the & through the ; and convert that to the string.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    29

    Re: Knowledge limitation in XmlTextReader

    But in that case the work will become tedious. Is it no other way to solve this out?

Posting Permissions

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



Click Here to Expand Forum to Full Width