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 3455972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:40:47+00:00 2026-05-18T09:40:47+00:00

I am trying to format xml entries I have so that I can use

  • 0

I am trying to format xml entries I have so that I can use the xmltextreader without getting errors. I added a default header and footer in the event I notice there is no opening or closing tags. I remove illegal characters and check for unicode but I always find an issue where an entry slips in and gives the error:
data at the root level is invalid
and when I check that entry is slipped through the cleaning process or just has an unmatched tag somewhere. Now I use

   Dim stringSplitter() As String = {"</entry>"}
        ' split the file content based on the closing entry tag
        sampleResults = _html.Split(stringSplitter, StringSplitOptions.RemoveEmptyEntries)

to split my xml into individual entries before I start the cleanup process. Here are my default headers;

Private defaultheader = "xmlns=""http://www.w3.org/2005/Atom"""
    Private headerl As String = "<?xml version=""1.0"" encoding=""utf-8""?>" & vbNewLine & "<entry " & defaultNameSpace & ">"
    Private footer As String = "</entry>"

is there any tool in the .net framework that can detect and cleanup unmatched tags so that I can get this to work

  • 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-18T09:40:47+00:00Added an answer on May 18, 2026 at 9:40 am

    I think you are looking in the wrong direction for a solution 🙂
    I think what you need is to check out the IXmlSerializer.

    check out this article:
    Proper way to implement IXmlSerializable?

    My approach would be to create an entry object, make it serializable, and read it via the serializer.

    Create another serialized object called CleanedEntry, and give that the entry object in the constructor.

    If the input never contains any errors, you should be able to make this work quite easily.

    (of course this depends a bit on how the source looks like, and what you want to do with it.)
    Please give an example of expected input /output if my answer seems hazy, and I will try to elaborate on it. (if I have the time ; ) )

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

Sidebar

Related Questions

Trying to make a generic PL/SQL procedure to export data in specific XML format,
I'm trying to use jQuery to format code blocks, specifically to add a <pre>
I'm trying to use rails nested form_for helper, but I am getting the following
I am experiencing weird behaviour when trying to format xml output while modifying domdocument
I need to post some xml to a webservice and I'm trying to use
I'm trying to format a column in a <table/> using a <col/> element. I
I am trying to format some bad html to output into a pop window.
I've got unformatted html in a string. I am trying to format it nicely
Im trying to save a bitmap jpg format with a specified encoding quality. However
I am trying to understand the file format of a Visual FoxPro compact index

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.