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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:01:39+00:00 2026-05-13T11:01:39+00:00

I know this is a borderline case whether it really belongs to stackoverflow or

  • 0

I know this is a borderline case whether it really belongs to stackoverflow or superuser, but as it seems there are quite a few ‘editing code’ questions over here, I am posting it on SO.

I have a pile of XML files that someone in their infinite wisdom have decided to explode to a multiple files using the tags, which in result makes debugging/editing them a huge P-i-t-A. Therefore I am looking for:

  1. A way in VIM to open them in a single buffer (preferably so that the changes are saved in correct external entity files), OR;
  2. A way to expand the files in VIM so that the external entities are read and replaced in the buffer, OR;
  3. an easy bash/sed/python way of doing this on a command line (or in .vimrc)

The files included on top level might include new files and so on on who knows on how many levels so this needs to be recursive…

Here’s a mockup sample on what the top level file looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foobar PUBLIC "foobar:dtd" "foobar.dtd" [

        <!ENTITY foo SYSTEM "foo.xml">

        <!ENTITY bar SYSTEM "bar.xml">
]>
<foo>
        <params>
                &foo;
        </params>
        <bar>
                &bar;
        </bar>
</foo>

EDIT:
The list is in order of preference – if no 1. or 2. solutions are available, the bounty goes for the best #3…

EDIT 2:
Looks like @Gaby ‘s answer works, but unfortunately only partially, unless I am doing something wrong – I’ll write some sort of tool using his answer and post it here for improvements. Of course, a #1 or #2 solution would be appreciated… 🙂

EDIT 3:
Ok, the best non-Emacs -answer will get the bounty 😉

Conclusion:
Thanks to @hcayless I now have a working #2 solution, I added:

autocmd BufReadPost,FileReadPost *.xml silent %!xmllint --noent - 2> /dev/null

to my .vimrc and everything is hunky dory.

  • 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-13T11:01:40+00:00Added an answer on May 13, 2026 at 11:01 am

    If you have libxml2 installed, then xmllint will probably do this for you. Depending on your setup, you might need more params, but for your example,

    xmllint --noent foobar.xml
    

    will print your file to stdout with all entities resolved. Should be easy enough to wrap some bash scripting around it to do what you need.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It depends on the platform. For a Xenon PowerPC, for… May 13, 2026 at 2:33 pm
  • Editorial Team
    Editorial Team added an answer You don't say what values you are passing, or what… May 13, 2026 at 2:33 pm
  • Editorial Team
    Editorial Team added an answer txtEmailFrom.Text = "john@huno.com|james@domain1.com" Dim brokened() As String dim email as… May 13, 2026 at 2:33 pm

Related Questions

I am developing a GPL-licensed application in Python and need to know if the
(I know this is not a programming question per se, but it involves regular
Ok, this is possibly borderline-subjective, but I wonder where one would put a simple
Lets say we have an Edit View to edit our data, and we want
This might sound like a stupid question but ... will WPF stop running in

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.