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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:07:39+00:00 2026-05-15T02:07:39+00:00

I have an XML file with format similar to: <root> <baby> <a>stuff</a> <b>stuff</b> <c>stuff</c>

  • 0

I have an XML file with format similar to:

<root>
   <baby>
      <a>stuff</a>
      <b>stuff</b>
      <c>stuff</c>
   </baby>
       ...
   <baby>
      <a>stuff</a>
      <b>stuff</b>
      <c>stuff</c>
   </baby>
</root>

And a Clojure hash-map similar to:

{:a "More stuff" :b "Some other stuff" :c "Yet more of that stuff"}

And I’d like to prepend XML (¶) created from this hash-map after the <root> tag and before the first <baby>

(¶) The XML to prepend would be like:

   <baby>
      <a>More stuff</a>
      <b>Some other stuff</b>
      <c>Yet more of that stuff</c>
   </baby>

I’d also like to be able to delete the last one (or n…) <baby>...</baby>s from the file.

I’m struggling with coming up with an idiomatic was to prepend and append this data. I can do raw string manipulations, or parse the XML using xml/parse and xml-seq and then roll through the nodes and (somehow?) replace the data there, but that seems messy.

Any tips? Ideas? Hints? Pointers? They’d all be much appreciated.

Thank you!

  • 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-15T02:07:39+00:00Added an answer on May 15, 2026 at 2:07 am

    what you want is a zipper. see Insertions into Zipper trees on XML files in Clojure for some good answers to your question

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

Sidebar

Related Questions

I have an xml file in following format <root> <entities> <entity> <entity_name></entity_name> <entity_id></entity_id> </entity>
I have an xml-file with a format similar to docx, i.e.: <w:r> <w:rPr> <w:sz
I have an xml file in a format similar to this: <benchmark> <group> <id>1</id>
I have a file, which is in XML format (consists just of root start
I have XML file in the following format; <root> <entry> <details> </entry> <entry> <details>
I have an XML file format that contains a structure of questions: <question id=q101>
I have an XML based file format that I'm using to store and load
I have a XML file with the following data format: <net NetName=abc attr1=123 attr2=234
I have an xml file in the following format: <food> <desert> cake <desert> </food>
I have an XSLT stylesheet that transforms an XML file to JSON format and

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.