From: John L. <joh...@gm...> - 2006-02-07 10:17:51
|
The updated task (using the code from Dries) is at home :( I'll email it tonight (I meant to copy it to my MP3 player or my GMail drive, but forgot. Sorry) Wouldn't the NamespaceManager on Project be a different instance to the one on the Task, therefore have a different set of namespaces? John On 07/02/06, Martin Aliger <mar...@go...> wrote: > > Namespacemanager on Element should be there for namespace handling of nan= t > build file itself. I do not test this funcionality, but we're solving thi= s > issue some time ago. > > I'm looking forward to get a look into your changed tasks. Is it on > nightlies already or have you a patch somewhere? > > Thanks, > Martin > > > ------------------------------ > *From:* nan...@li... [mailto: > nan...@li...] *On Behalf Of *John Ludlow > *Sent:* Tuesday, February 07, 2006 12:21 AM > *To:* Dries Verbeke; nan...@li... > *Subject:* Re: [nant-dev] New XML tasks and functions > > Ok, I've integrated your changes into my copy, Dries. I can forward you > the binaries if you want to test it, but I'm not sure what kind of a > difference this will make. As far as I know, the updated XmlPoke I did > should support namespaces. Probably the XmlPoke2 task doesn't, but that = was > probably why Ian asked if I could merge my task with the existing one. > > There is the Xml-Foreach task which this might come in handy for, but I > haven't submitted that. The functions still don't support namespaces > because they're not element-aware, and I think the original question was > could they support namespaces. I think it might be an idea if the functi= ons > could find out where they were called from, and get the namespacemanager > that way. > > (BTW, there is a namespacemanager in the Element class, so it's possible > that we could just get that rather than needing a base class for XmlTask. > Having said that, there's a case for having an XmlTask base anyway as > there's some common functionality there.) > > I get the feeling I'm missing something fairly obvious. Anyway, I'm off > to bed since I'm tired and I have an interview tomorrow. :) See ya later= . > > John > > On 06/02/06, John Ludlow <joh...@gm...> wrote: > > > > I'm pretty new to it myself ;) I'll take a look at the changes and see > > if I can get it built and tested, and I'll let you know what happens. > > > > Cheers > > > > John > > > > On 06/02/06, Dries Verbeke <dri...@ya...> wrote: > > > > > > Hi John, > > > i re-read the original thread and concluded that what they wanted was > > > just the same behaviour as the xmlpeek and xmlpoke task so I refactor= ed the > > > functionality out of those task and put it in an abstract base class > > > 'XmlTask'. Nowyour new tasks can easily inherit from this task and h= ave the > > > same functionality (read multiple namespaces). > > > > > > In the attachments a cvs patch file. Keep in mind that I'm new to > > > this opensource thing and didn't add a lot of comments to the changes= . I > > > also placed the abstract class in the same namespace as the other def= ault > > > task. > > > > > > So check it out and let me know what you think of it > > > > > > Dries > > > > > > *John Ludlow < joh...@gm...>* wrote: > > > > > > Hi, > > > > > > Unless I'm missing something, it's a slightly larger job than that. > > > I've added a property into my copy of the NAnt source, but I can't se= e how > > > to make the Expression evaluator care about that property. It doesn'= t > > > reference Task at all, so I don't think it could (in its current > > > implementation) know that a namespace has been specified on the task = and it > > > should apply that namespace. > > > > > > I'll see if I can get it to work out the task instance that has been > > > run and from there whether or not to apply a namespace. If anyone ha= s any > > > ideas, please email me. > > > > > > Cheers > > > > > > John > > > > > > On 03/02/06, John Ludlow <joh...@gm...> wrote: > > > > > > > > Ok, wasn't sure if that's what you meant. I'm working on something > > > > else at the moment but I'll take a look when I get the chance. > > > > > > > > On 03/02/06, Dries Verbeke < dri...@ya...> wrote: > > > > > > > > > > That 's correct it needs to be added to the Abstract Task class s= o > > > > > we can add it as a default property and (but this needs to be che= cked out) I > > > > > think it doesn't matter where you put the namespace references th= e > > > > > NamespaceManager will contain all namespace declarations of an xm= l document > > > > > it's associated to. > > > > > > > > > > In the microsoft doc's there is something mentioned as scope > > > > > management. It could be that only the task tag or any parent ta= gs are > > > > > useable ... > > > > > > > > > > At the moment I don't have a compilable version of the Nant sourc= e > > > > > as soon as can I'll check this or if you have some time ... > > > > > > > > > > the only thing we need to agree is the name of the Property ... i= t > > > > > may not conflict with existing properties in any subclass ... > > > > > > > > > > so let me know what you can find out > > > > > Dries > > > > > > > > > > *John Ludlow <joh...@gm...>* wrote: > > > > > > > > > > Hmmm... It would have to be implemented on more than just the > > > > > echo task - I just included that as an example, but I think that = useage > > > > > wouldn't be as useful as, say, the <property> task. You could do= something > > > > > like that for the <property> task, I guess, but there's other sit= uations > > > > > where properties are useful. If you wanted to take the values of= an XML > > > > > document and post them to a database, for example, ou could use t= he XML > > > > > functions within the nantcontrib <sql> tasks. Similarly, to appe= nd to a > > > > > document or merge the contents of a document into another, you ca= n (with my > > > > > patch to the xmlpoke task, or with my xmlpoke2 task) do something= like this: > > > > > > > > > > > > > > > <xmlpoke file=3D"xmlfile.xml" xpath"//data"> > > > > > <![CDATA[ > > > > > ${xml::get-xml(other.xml, '//data[test =3D 'true']')} > > > > > <myothertag value=3D"123"/> > > > > > ]]> > > > > > </xmlpoke> > > > > > > > > > > I'm not sure where you'd put the xmlns:x definition in this case. > > > > > I suppose you could put them as attributes of the <xmlpoke> task: > > > > > > > > > > <xmlpoke file=3D" xmlfile.xml" xpath"//x2:data" xmlns:x=3D" > > > > > http://www.gordic.cz/shared/project-config/v_1.0.0.0<http://www.g= ordic.cz/shared/project-config/v_1.0.0.0%27%29%29%7D>" > > > > > xmlns:x2=3D" http://www.gordic.cz/shared/project-config/v_2.0.0.0= <http://www.gordic.cz/shared/project-config/v_1.0.0.0%27%29%29%7D> > > > > > "> > > > > > <![CDATA[ > > > > > ${xml::get-xml(other.xml, '//x:data[test =3D 'true']')} > > > > > <myothertag value=3D"123"/> > > > > > ]]> > > > > > </xmlpoke> > > > > > > > > > > Would this work? If so, I'd suggest these modifications to the > > > > > base Task class, so that this can be used in any task. > > > > > > > > > > John > > > > > > > > > > On 03/02/06, Dries Verbeke < dri...@ya...> wrote: > > > > > > > > > > > > Hi, > > > > > > maybe a stuppid idee but why cant we have some kind of > > > > > > mechanisme to add the NamespaceManager of our nant build xml fi= le to the > > > > > > task so you can add multiple Namespace in an xml fashioned way = ... > > > > > > > > > > > > <echo message=3D"${xml::get-value-using-ns(' test.xml', > > > > > > '/x:configuration/x:appSettings/x:add[@key =3D ''server'']/@val= ue')}" > > > > > > xmlns:x=3D" http://www.gordic.cz/shared/project-config/v_1.0.0.= 0<http://www.gordic.cz/shared/project-config/v_1.0.0.0%27%29%29%7D> > > > > > > " > > > > > > xmlns:x2=3D" http://www.gordic.cz/shared/project-config/v_2.0.0= .0<http://www.gordic.cz/shared/project-config/v_1.0.0.0%27%29%29%7D> > > > > > > "/> > > > > > > > > > > > > To do this we only need to add an extra property to the abstrac= t > > > > > > Task class and fill it with the NamespaceManager available at t= hat moment > > > > > > ... and from their on every task can use this extra property. > > > > > > > > > > > > just brain storming ... > > > > > > Dries > > > > > > > > > > > > > > > > > > > > ------------------------------ > > > > > Get the latest photos from your camera to your friends & family > > > > > fast and easy with PhotoMail > > > > > <http://us.rd.yahoo.com/mail_us/taglines/PMGM2/*http://photomail.= mail.yahoo.com>from > > > > > Yahoo! Mail. > > > > > > > > > > > > > > > > > > > ------------------------------ > > > Yahoo! Autos<http://us.rd.yahoo.com/evt=3D38381/+ylc=3DX3oDMTEzcGlrdG= Y5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.yahoo.com/= index.html+>. > > > Looking for a sweet ride? Get pricing, reviews, & more on new and use= d cars. > > > > > > > > > > > > > > > |