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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:35:53+00:00 2026-06-08T03:35:53+00:00

I want to open an XML file and process it in a special way

  • 0

I want to open an XML file and process it in a special way in Emacs. (Let’s say a major mode which is customized to open XML files and process it and present it in a special way)
What I want to do is to hide the extra markup tags in XML and show just the content to the user. Can anyone advice me how I should do this?

`<name id=22> Luke </name>` 

=> I just want “Luke” to be shown.

  • 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-06-08T03:35:55+00:00Added an answer on June 8, 2026 at 3:35 am

    One way to do this would be to use a regular expression to extract the element information from your XML, and then open a temporary buffer for viewing into which you paste that element information. i’m not sure that narrowing is granular enough to hide the markup and display only the element information.

    Having said that, an alternative to the temporary buffer approach would be to extract the element information, paste it into the bottom of the file, and then narrow to just that portion of the file so that the source markup is invisible.

    The function below does approximately what I have in mind:

    (defun show-xml-entities ()  
      (interactive)  
      (save-excursion  
        (let ((old-max (point-max)))  ;; save current end of buffer  
          (goto-char (point-min))     ;; go to beginning of buffer  
          (while (re-search-forward ">\\([^<>]+\\)<" nil t)  ;; search for elements until not found  
        (when (> (length (match-string-no-properties 1)) 0)  ;; if match is non-zero length  
          (setq temp (point-marker))                         ;; save end of match  
          (goto-char (point-max))                            ;; go to end of buffer  
              ;; paste current match to end of buffer   
          (insert (concat (buffer-substring-no-properties (match-beginning 1) (match-end 1))))  
          (goto-char (marker-position temp))  ;; return to end of current match  
          )  
        )  
          (narrow-to-region old-max (point-max)))   ;; narrow to newly pasted element text  
        )  
      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose i want to open an xml file which i have in my email
I want to open a document file using Open Xml Open Method, search for
What is the open xml file for office 2007. In fact I want to
I have an xml file, I want to open it, edit certain CDATA node
I've got an XML file automatically generated, which I want to display in HTML.
Is there a way within a single XSLT file to first open one XML
Hy! I want to open an .xml file from c++ with a specified application
I am creating a XML file which I want to return to the user,
I want to open and read an XML file using php, but I wont
I have a project with ~30 modules. Now I want to open pom.xml file

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.