Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7695899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:39:15+00:00 2026-05-31T21:39:15+00:00

So, this example comes right from MSDN. http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.readelementcontentasbase64.aspx Pretty much the only thing I

  • 0

So, this example comes right from MSDN. http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.readelementcontentasbase64.aspx
Pretty much the only thing I have changed is created a loop because I have one xmlstring and want to break it up and create tif files from it(which it actually does do).

My problem is this: readbytes inside the while loop throws an exception at the last time through the loop that says I have an “unexpected end of file; the following elements are not closed” and lists them

   Public Shared Sub Base64DecodeImageFile() 

        Dim buffer(999) As Byte
         Dim readBytes As Integer = 0

        Using reader As XmlReader = XmlReader.Create(xmlstring)

                Dim outputFile As New FileStream("C:\artFiles\data\newImage.jpg", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)
                ' Read to the image element.
                reader.ReadToFollowing("image")
                ' Read the Base64 data.
                Console.WriteLine(vbCr + vbLf + "Reading Base64...")
                Dim bw As New BinaryWriter(outputFile)
                readBytes = reader.ReadElementContentAsBase64(buffer, 0, 50)
                While (readBytes > 0)
                    bw.Write(buffer, 0, readBytes)
                    readBytes = reader.ReadElementContentAsBase64(buffer, 0, 50)
                End While
                outputFile.Close()

        End Using

    End Sub 'Base64DecodeImageFile

So there are tags left open after the readtofollowing(“image”). I tried catching the exception to no avail, tried to read until eof, no avail. I dont really need elements to be closed, I just need to continue because I created files using whats in the image tag.

I appreciate any help!

EDIT: I think my xmlstring is going to have times where it will be too big to do a parse without slowing down too much…/parsing binary data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:39:16+00:00Added an answer on May 31, 2026 at 9:39 pm

    Well! I found out my issue..I figured I would post the answer anyway to maybe help some others? the problem did not lay with the reader, in fact, it worked really well. The problem was the xmlstring itself. The string never created the closing tags I needed (which would happen the last loop through).
    Thanks for your help anyway guys!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've followed this example: RCP+JavaWS but the app just briefly comes up and goes
For example, this method from NSCalendar takes a bitmask: - (NSDate *)dateByAddingComponents:(NSDateComponents *)comps toDate:(NSDate
This example is from php.net: <?php function Test() { static $a = 0; echo
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
I've downloaded WIPmania's worldip table from http://www.wipmania.com/en/base/ -- the table has 3 fields and
I'm following the example here: http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons however, it doesn't work - I get ImportError:
This example uses a StringWriter to hold the serialized data, then calling ToString() gives
This example is simplified a bit, but in my ASP.NET web page in my
this example below works when hover event is trigered and when its not, its
Given this example: <img class=a /> <img /> <img class=a /> <img class=a id=active

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.