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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:56:33+00:00 2026-05-26T13:56:33+00:00

There has been times where I need to convert an old HTML structure to

  • 0

There has been times where I need to “convert” an old HTML structure to a new one. To illustrate, converting this:

<!-- Old HTML structure. -->
<div class="class-a">
  <div class="class-b">
    <span>Hello</span>
  </div>
  <div class="class-c">
    <p>How are you doing?</p>
  </div>
</div>
<div class="class-a">
  <div class="class-b">    
  ... (and so on, basically repeats the construct above) ...

To something like:

<!-- New HTML structure. -->
<div class="class-aa">
  <span class="class-ab">Hello</span>
  <p>How are you doing?</p>
</div>
<div class="class-aa">
  <span class="class-ab">Hi!</span>
  ... (and so on, basically repeats the construct above) ...

Note that I still need the text, but the structure needs a complete overhaul.

The worst situation is the HTML file is super long and doing it manually (yep, a lot of typing). What I’ve been doing so far is either using a simple substitution regex (if not too complex) or resorting to the old school vi macro.

Would somebody please suggest a better approach to accomplish this?

  • 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-26T13:56:33+00:00Added an answer on May 26, 2026 at 1:56 pm

    You could write a JavaScript/jQuery that does the restructuring and then use the DOM inspector/debugger of the browser get a copy of the modified HTML.

    BTW, a while ago I was looking for a editor/tool that does this kind of thing automatically, but there doesn’t seem to be such a thing: https://softwareengineering.stackexchange.com/questions/79615/html-text-editor-with-dom-manipulation

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

Sidebar

Related Questions

I know this has been discussed a lot of times but is there any
Pardon me if you feel this has been answered numerous times, but I need
There has been confusion a few times with my testers somehow getting old builds
This has been asked a lot of times already: I need to get the
Now I realise this topic has been covered many times before. However there did
While it seems that this has been asked many times before, but there's a
I know this has been asked several times and I have read all the
Please forgive if this question has been asked numerous times. I recently installed Eclipse
I know this question has been asked alot of times, however most of them
I know this question has been asked many times and I've researched it myself

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.