2

I have a situation where I need to scan through a large number of .xsd files, and replace an instance of a string with another string based on the file name of the current schema being examined.

For example: I wish to replace the string: 'DataSet' in file1.xsd with the string 'file1DataSet' I wish to replace the string: 'DataSet' in file2.xsd with the string 'file2DataSet' and so on until all schemas have been modified.

I would like to know if there is anyway to do this without using the ant-contrib for loops.

1 Answer 1

1

You could try the <replace> task if you have a generally good idea how many schemas you have. The <replaceRegex> might be able to do it without looping.

Ant isn't really a programming language where you can loop. If you can do everything in one pass, that's great, but once you start really manipulating files, Ant runs into limitations.

Sign up to request clarification or add additional context in comments.

1 Comment

yes, I ended up caving around November 25th or so and used ant-contribs with a foreach target loop pointing to a pathconvert with a chainedmapper to extract the filename and a simple <replace file="${filelocation}" token="NewDataSet" value="${file.name}Type"/> statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.