Eric Williams wrote:

I am working on a project where I am using a utility called XMLPreprocess which needs a input file in a format of /settings/properties/@name.

That's not XML, and so couldn't be created with XMLPoke. Do you mean that as a string inside an XML file (e.g. <element>/settings/properties/@name</element>) or are you using an XPath expression as a surrogate for a schema? If the latter, an explicit example would be clearer.

I would want to create this file at build time driven off of a nant.include file (I have that part done already). I was wondering what other people are doing for creating a xml file with NAnt. A file that does not exist before the NAnt script starts, one that NAnt creates with some task. I was looking at making a change to XMLPoke with an boolean switch to tell it to create the file if it doesn't exist and to also enter an element and/or attribute if they don't exist either. I have found other situtations, outside of my little XMLPreprocess issue where this would be really usful.

I don't see how this can work in general. XMLPoke doesn't have enough information to generate the root element, the XML declaration, etc. Again, you might be able to treat an XPath expression as a partial schema, but it would only work for extremely simple cases. There's not enough information to generate arbitrary xml declarations or other processing instructions. If an element has two attributes, it gets complicated. And so on.


Just looking for suggestions before spending too much time on this. Maybe someone has already built this already? If not, does anyone else think that this would be a nice to have that maybe NAnt should "just have" for us?

Start with a template XML file, and use either an XSLT (with the <style> task) or XMLPoke to generate the target file. If you could describe the input and expected output in a bit more detail, it would be easier to decide.

Gary



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to