ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg 'Cosmo' Haun <GH...@cenquest.com>
Subject RE: Why does this not created a munged file as requested?
Date Mon, 16 Sep 2002 18:29:46 GMT
You are getting a parse error because you can't use \" to escape a quote in
XML.  Perhaps &quot; would work, but I don't see why you need quotes around
_generate.

Also <filter> is for char-delimited tokens, not general search and replace.
For that you want to use the <replace> task.

Gregory Cosmo Haun
Architect, Interactive Development
Cenquest, Inc.

Phone: 503.276.7943
Email: ghaun@cenquest.com

Learn more about Cenquest collaborative e-learning at www.cenquest.com


> -----Original Message-----
> From: Scott Ellsworth [mailto:scott@alodar.com]
> Sent: Thursday, September 12, 2002 6:07 PM
> To: Ant List
> Subject: Why does this not created a munged file as requested?
> 
> 
> I am trying to turn an Apple/Next property list into one with 
> a certain  
> tag replaced and eol's turned to unix.  These may be several levels  
> deep, so I want to do a regex replace rather than something 
> that tries  
> to parse the properties.
> 
> I start with a file that looks like this:
> 
> {\r
> {\r
> stuff\r
> stuff\n
> stuff\r\n
>        _generate = "";\r\n
> stuff\r\n
> }\r
> {\r
>        _xenerate = "";\r
>        _generate = "true";\n
>        _generate = "false";\r
> stuff\n
> stuff\n
> }\r
> }\r
> 
> and I want one that looks like:
> 
> {\r
> {\r
> stuff\r
> stuff\r
> stuff\r
>        _generate = "";\r
> stuff\r
>        _generate = "";\r
> }\r
> {\r
>        _generate = "true";\r
>        _generate = "true";\r
> stuff\r
> stuff\r
> }\r
> }\r
> 
> (In other words, copy the file and turn all of the _xenerate 
> keys into  
> _generate keys, turn all of the _generate = false key-value 
> pairs into  
> _generate = true key-value pairs, and make the line endings unix.)
> 
> It seems to me that the following code _should_ do it:
> 
>      <copy file="${plist.source}" tofile="${plist.source.generated}">
>        <filterset begintoken="" endtoken="">
>          <filter token="\"_xenerate\"" value="\"_generate\""/>
>          <filter token="\"_generate\" = \"false\";" 
> value="\"_generate\"  
> = \"true\";"/>
>        </filterset>
>      </copy>
>      <fixcrlf srcdir="${project.work.dir}" eol="cr"  
> includes="${plist.generated}" />
> 
> but instead, it complains that
> 
> file:/Users/work/Documents/coding/isis/source/genetrove/persistence/ 
> cluster_genetrove/build-intercalate.xml:29: Element type 
> "filter" must  
> be followed by either attribute specifications, ">" or "/>".
>          at  
> org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHel
> perImpl.ja 
> va:170)
>          at  
> org.apache.tools.ant.ProjectHelper.configureProject(ProjectHel
> per.java:1 
> 17)
>          at org.apache.tools.ant.Main.runBuild(Main.java:597)
>          at org.apache.tools.ant.Main.start(Main.java:196)
>          at org.apache.tools.ant.Main.main(Main.java:235)
> 
> So, what is the best way to do this?
> 
> Scott
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:ant-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message