This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes new line character Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "new line character" Watch "new line character" New topic
Author

new line character

Macca Murray
Greenhorn

Joined: Oct 19, 2004
Posts: 9
Im using ANT and the replaceregexp target, and I am editing an xml file.
I am using a properties file (but not completly essential if someone has an idea) to hold the values of what I want to replace text with.

I want to replace 1 tag in my xml file, and put another whole set of tags in its place, but I need to know how to make a new line character in the xml file to break up the new tags. I have tried to use the \ n character (with no space) and it doesnt make a new line, in fact, it doesnt even render anything, its like i didnt even put it in there.

Any help would be greatly appreciated
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

Well, normally if you're going to do major surgery on an XML file using Ant, you'd probably want to use the XSLT Ant task rather than take the text-editor approach.

IIRC, however, the OS-dependent newline character (sequence) is available as a Ant property along with all the other standard JVM properties (see Sun's JavaDocs for java.lang.System.getProperty).


Customer surveys are for companies who didn't pay proper attention to begin with.
Natasha QA
Greenhorn

Joined: Jul 03, 2002
Posts: 1
Use this in the replace attribute instead of \n:

${line.separator}
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: new line character
 
Similar Threads
How can we use <jsp:scriptlet /> tag in jspx file that uses faclets
tags
Please explain this becuase I dont understand
adding a newline character to a file using fileoutputstream
Read data to the xml file from the database?