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

  • Home
  • SEARCH
  • 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 130545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:57:53+00:00 2026-05-11T05:57:53+00:00

When I realized I needed to create an index for approximately 50 XHTML pages,

  • 0

When I realized I needed to create an index for approximately 50 XHTML pages, which may be added/deleted/renamed/moved in the future, I thought ‘No problem — I’ll write a quick index generator using LINQ to XML, since XHTML definitely counts as XML’.

Of course, as soon as I tried running it, I found out about the fact that XLINQ chokes on XHTML entities like  . I got around it by using the following algorithm:

  1. Read XHTML file into string.
  2. Use regex search and replace on that string to add a section into the DOCTYPE that defines all relevant entities (because I only care about the ‘title’ attribute in the files I read and my output file does not use any entities right now, it just sets them all to blank, but I may add the actual values later).
  3. Parses the result into an XDocument.

To save a file, I do the opposite:

  1. Save XDocument to a string.
  2. Strip out the entity definitions.
  3. Save to file.

My question is, are there any libraries (especially built-in .Net ones) I can use that will read XHTML files into XDocuments? The code I wrote has accomplished its purpose (to generate the current index and to test the rest of the generator program), and I would really prefer not to spend time testing it if someone else already wrote and tested the same thing.

Thank y’all so much for your time,
Ria.

Edit: Thank you so much; this works! I still have to do a little string processing when I save the XHTML (guess the library was not really made for that:)) and I had to fiddle with the source of the Agility Pack slightly to get it to stop indiscriminately sticking a CDATA section around the insides of every style attribute (even when there was already one present), but that’s the point of Open Source, right?

  • 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. 2026-05-11T05:57:54+00:00Added an answer on May 11, 2026 at 5:57 am

    This might be helpful: LINQ & Lambda, Part 3: Html Agility Pack to LINQ to XML Converter

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

Sidebar

Ask A Question

Stats

  • Questions 281k
  • Answers 281k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ivan Vucica already described how to do it by modifying… May 13, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer I can't say for sure without access to your repository… May 13, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer var api = { getAttr:function(attr) { var args = [];… May 13, 2026 at 3:50 pm

Related Questions

I think I've worked myself into a pretty stupid corner, here. Let me show
I'm just looking for people's opinions on this... I really got worried when Second
I have recently(today) began meddeling with my registry from within Delphi. :) all is
Below is a method that I want to ship off into a background worker

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.