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 <[EMAIL PROTECTED]> 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 refactored 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 have 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 default task. 

So check it out and let me know what you think of it


Dries

John Ludlow < [EMAIL PROTECTED]> 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 see 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 has any ideas, please email me.

Cheers

John

On 03/02/06, John Ludlow <[EMAIL PROTECTED]> 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 < [EMAIL PROTECTED]> wrote:
That 's correct it needs to be added to the Abstract Task class so we can add it as a default property and (but this needs to be checked out) I think it doesn't matter where you put the namespace references the NamespaceManager will contain all namespace declarations of an xml 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 tags are useable ...

At the moment I don't have a compilable version of the Nant source 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 ... it may not conflict with existing properties in any subclass ...

so let me know what you can find out
Dries

John Ludlow <[EMAIL PROTECTED]> 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 situations 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 the XML functions within the nantcontrib <sql> tasks.  Similarly, to append to a document or merge the contents of a document into another, you can (with my patch to the xmlpoke task, or with my xmlpoke2 task) do something like this:

<xmlpoke file="xmlfile.xml" xpath"//data">
   <![CDATA[
      ${xml::get-xml(other.xml, '//data[test = 'true']')}
      <myothertag value="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=" xmlfile.xml" xpath"//x2:data" xmlns:x=" http://www.gordic.cz/shared/project-config/v_1.0.0.0" xmlns:x2=" http://www.gordic.cz/shared/project-config/v_2.0.0.0">
   <![CDATA[
      ${xml::get-xml(other.xml, '//x:data[test = 'true']')}
      <myothertag value="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 < [EMAIL PROTECTED]> wrote:
Hi,
maybe a stuppid idee but why cant we have some kind of mechanisme to add the NamespaceManager of our nant build xml file to the task so you can add multiple Namespace in an xml fashioned way ...

<echo message="${xml::get-value-using-ns(' test.xml', '/x:configuration/x:appSettings/x:[EMAIL PROTECTED] = ''server'']/@value')}"
xmlns:x=" http://www.gordic.cz/shared/project-config/v_1.0.0.0"
xmlns:x2=" http://www.gordic.cz/shared/project-config/v_2.0.0.0"/>

To do this we only need to add an extra property to the abstract Task class and fill it with the NamespaceManager available at that 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 from Yahoo! Mail.




Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.



Reply via email to