zalpha314
zalpha314

Reputation: 1495

ANT - replace xml declaration

I have an XML document composed of several other XML documents appended to it. As a result, there are several XML declarations within the document which prevent my XSLT from parsing it correctly. I am trying to remove the declarations from the document using the ant replace and replaceregexp tasks, but they do nothing to the file. This is what I have so far.

<replaceregexp file="${cppUnit.file}" >
    <regexp pattern="&lt;?xml * ?&gt;" />
    <substitution expression="" />
</replaceregexp>

Upvotes: 0

Views: 1075

Answers (2)

ewan.chalmers
ewan.chalmers

Reputation: 16235

Try this instead:

<replaceregexp file="${cppUnit.file}" match="&lt;\?xml.*\?&gt;"
     replace="" byline="true"/>

Upvotes: 2

zalpha314
zalpha314

Reputation: 1495

ok. This worked.

<regexp pattern="..?xml version=.1.0. encoding='ISO-8859-1' standalone='yes' ?..." />

Upvotes: 0

Related Questions