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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:58:37+00:00 2026-05-27T06:58:37+00:00

When using XMLParser of Groovy (and smiliar APIs) to change a text-node’s content in

  • 0

When using XMLParser of Groovy (and smiliar APIs) to change a text-node’s content in an XML, it will loose the overall structure while parsing the file and thus when written back to a file. I.e. the spaces change, comments are removed, dtd-references are stripped.

There exists an ANT library called XMLTask that allows to do simple replacements with the help of XPath and maintains the overall structure of the file. Is there some similar and easy-to-use API in Java, Groovy, Jython or friends that allows this?
Preferably Groovy, so it integrates well with Gradle.

  • 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-27T06:58:38+00:00Added an answer on May 27, 2026 at 6:58 am

    You could just stick xmltask on the classpath, and use groovy’s AntBuilder. There’s an example of this here I believe

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

Sidebar

Related Questions

I am using XMLParser to parse an xml document that has the following structure:
I'm using the XmlParser to insert nodes into an existing XML. Unfortunately this parser
I parse in the XML using from lxml import etree tree = etree.parse('test.xml', etree.XMLParser())
I'm using an XMLparser class to convert XML into an object. The problem is
I've succesfully loaded and parsed this XML file, using XMLParser and AS2: <Resources> <item
I am using libxml/xmlparser.h library in my program to parse the xml file. Is
I m using the code below to get value of node from a XML
Possible Duplicate: Best XML Parser for PHP Using JAXB with Google Android I need
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Nunit, I want to be able to write a test fixture that will

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.