title: How to read an xml file as string in vb
body: <p>I'm trying to read from an onix file and save the information onto a mysql database.</p>
  
  <p>I'm able to read titles, country code, isbn and other fields but for some strange reason I cant get short description. </p>
  
  <p>The short description field <code>&lt;d102&gt;&lt;d104&gt;</code> is embed in html text and when I try to read from it without any alternations it doesnt work and if i tried to save it as a string does the same. </p>
  
  <p>On the database I created a field in the table shortdescription varchar(70) 
  and i also, at first thought it was the amount its allowed to stored "varchar(70)" if I increase it, doesn't help! </p>
  
  <p>This is part of an onix feed I'm trying to read </p>
  
  <pre><code>&lt;othertext&gt;
        &lt;d102&gt;01&lt;/d102&gt;
        &lt;d104&gt;&lt;![CDATA[A Course in Behavioral Economics  is a concise and reader-friendly      
  introduction to one of the most influential areas of economics today. Covering all core areas of the subject, the book requires no advanced mathematics and is full of examples, exercises, and problems drawn from the fields of economics, management, marketing, political science, and public policy, among others. It is an ideal first textbook for students coming to behavioral economics from a wide range of disciplines, and would also appeal to the general reader looking for a thorough and readable introduction to the subject.
  
  Available to lecturers: access to an Instructor's Manual at www.palgrave.com/economics/angner, containing a sample syllabus,
  instructor guide, sample handouts and examinations, and PowerPoint slides.]]&gt;&lt;/d104&gt;
  &lt;/othertext&gt;
  </code></pre>
  
  <p>I tried using this code below, the same theory worked for getting the isbn etc.:</p>
  
  <pre><code>Function HandleTagName(name as String) as XName 
      Select Case name
          Case "d104", "text"
              If ShortName Then
                  Return "d104"
              Else
                  Return "text"
              End If
       end select 
  end function 
  
  dim xmlDoc as XDocument
  dim xr as XmlTextReader = new XmlTextReader(Server.MapPath(ThisBook.FromFile))
  xr.Namespaces = false
  
  dim  document as XmlDocument = new XmlDocument()
  document.Load(xr)
  xr.close()
      if not document("ONIXmessage") is Nothing then
          Dim attrColl as XmlAttributeCollection = document("ONIXmessage").Attributes
          attrColl.RemoveAll()
      end if
  
  xmlDoc = XDocument.Parse(document.OuterXML)
  
  Dim Products As IEnumerable(Of XElement)
  
  if xmlDoc.DocumentType is Nothing then
       ShortName = True
  else
       if instr(xmlDoc.DocumentType.ToString(), "/short") then
            ShortName = True
       end if
  end if
  
  Products = from product in xmlDoc.Root.Descendants(HandleTagName("Product"))
  
  For Each ThisOtherText In product.Elements(HandleTagName("OtherText"))
      If ThisOtherText.Element(HandleTagName("TextTypeCode")) = "02" Then         
          If ThisBook.shortDescription = "" Then 
             ' if you say 
             ' dim xxx as string = "test"
             ' ThisBook.shortDescription = xxx
  
             ThisBook.shortDescription = ThisOtherText.Element(HandleTagName("Text"))
          End if 
      End If
  Next
  </code></pre>
  
  <p>I'm not sure if its something i'm not doing right in the code or is it something to do with how i declared shortdescription on the database </p>