xmlpeek and multiple nodes

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

xmlpeek and multiple nodes

Chris Fouts

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Bob Archer

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Chris Fouts

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Bob Archer

But, is there something unique in the node that you want to update? I assume no since you are looping through them all?

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Chris Fouts

If I can find out how to loop through them all, I can do the rest.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:54 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

But, is there something unique in the node that you want to update? I assume no since you are looping through them all?

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Bob Archer
In reply to this post by Chris Fouts

In other words, if you can’t get to a specific node with an XPath expression you really need to roll your own. That’s really what it is designed for.

 

You could do something like what you are doing, however, you probably still need your own script task to get the count of matching nodes. A quick google find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

 

BOb

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Chris Fouts

So no canned support for this?

 

-chris

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:59 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

In other words, if you can’t get to a specific node with an XPath expression you really need to roll your own. That’s really what it is designed for.

 

You could do something like what you are doing, however, you probably still need your own script task to get the count of matching nodes. A quick google find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Bob Archer

Not really, no.

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 10:03 AM
To: [hidden email]
Subject: Re: [NAnt-users] xmlpeek and multiple nodes

 

So no canned support for this?

 

-chris

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:59 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

In other words, if you can’t get to a specific node with an XPath expression you really need to roll your own. That’s really what it is designed for.

 

You could do something like what you are doing, however, you probably still need your own script task to get the count of matching nodes. A quick google find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Chris Fouts

Ok, here’s my workaround to parse this xml file, and it works! Essentially I just increment the node index and make a recursive target call.

 

<tests>

   <!--

      testRunStatus = run this test?: yes, no, or skip

   -->

   <test>

      <name>Lesson1234</name>

      <testRunStatus>skip</testRunStatus>

   </test>

   <test>

      <name>Lesson4567</name>

      <testRunStatus>yes</testRunStatus>

   </test>

   <test>

      <name>Lesson5678</name>

      <testRunStatus>no</testRunStatus>

   </test>

   <!-- This has to be the last node! -->

   <test>

      <name>*</name>

      <testRunStatus>no</testRunStatus>

   </test>

</tests>

 

   <!—Initial xml idx value is 0 -->

   <property name="xmlidx" value="0" />

   <target name="selectTestToRun">

      <xmlpeek file="C:\Sompath\teststoRun.xml" xpath="/tests/test/name" nodeindex="${xmlidx}" property="name" />

      <if test="${name != '*'}">

         <echo>name is ${name} </echo>

        <xmlpeek file="C:\Somepath\teststoRun.xml" xpath="/tests/test/testRunStatus" nodeindex="${xmlidx}" property="testRunStatus" />

         <echo>testRunStatus is ${testRunStatus} </echo>

         <if test="${testRunStatus == 'yes'}">

            <!—RUN THE TEST -->

         </if>

         <!—increment xml index -->

         <property name="xmlidx" value="${int::parse(xmlidx)+1}" />

        <!—Recursive call -->

         <call target="selectTestToRun" />

      </if>

   </target

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 11:05 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

Not really, no.

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 10:03 AM
To: [hidden email]
Subject: Re: [NAnt-users] xmlpeek and multiple nodes

 

So no canned support for this?

 

-chris

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:59 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

In other words, if you can’t get to a specific node with an XPath expression you really need to roll your own. That’s really what it is designed for.

 

You could do something like what you are doing, however, you probably still need your own script task to get the count of matching nodes. A quick google find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Chris Fouts
In reply to this post by Bob Archer

Silly me.

 

This works for xmlpeek, but I can’t xmlpoke on a nodeindex. Duh…. Backtrack

 

-chris

 

From: Chris Fouts
Sent: Friday, April 20, 2012 11:18 AM
To: [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

Ok, here’s my workaround to parse this xml file, and it works! Essentially I just increment the node index and make a recursive target call.

 

<tests>

   <!--

      testRunStatus = run this test?: yes, no, or skip

   -->

   <test>

      <name>Lesson1234</name>

      <testRunStatus>skip</testRunStatus>

   </test>

   <test>

      <name>Lesson4567</name>

      <testRunStatus>yes</testRunStatus>

   </test>

   <test>

      <name>Lesson5678</name>

      <testRunStatus>no</testRunStatus>

   </test>

   <!-- This has to be the last node! -->

   <test>

      <name>*</name>

      <testRunStatus>no</testRunStatus>

   </test>

</tests>

 

   <!—Initial xml idx value is 0 -->

   <property name="xmlidx" value="0" />

   <target name="selectTestToRun">

      <xmlpeek file="C:\Sompath\teststoRun.xml" xpath="/tests/test/name" nodeindex="${xmlidx}" property="name" />

      <if test="${name != '*'}">

         <echo>name is ${name} </echo>

        <xmlpeek file="C:\Somepath\teststoRun.xml" xpath="/tests/test/testRunStatus" nodeindex="${xmlidx}" property="testRunStatus" />

         <echo>testRunStatus is ${testRunStatus} </echo>

         <if test="${testRunStatus == 'yes'}">

            <!—RUN THE TEST -->

         </if>

         <!—increment xml index -->

         <property name="xmlidx" value="${int::parse(xmlidx)+1}" />

        <!—Recursive call -->

         <call target="selectTestToRun" />

      </if>

   </target

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 11:05 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

Not really, no.

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 10:03 AM
To: [hidden email]
Subject: Re: [NAnt-users] xmlpeek and multiple nodes

 

So no canned support for this?

 

-chris

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:59 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

In other words, if you can’t get to a specific node with an XPath expression you really need to roll your own. That’s really what it is designed for.

 

You could do something like what you are doing, however, you probably still need your own script task to get the count of matching nodes. A quick google find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:48 AM
To: Bob Archer; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

That’s all I want to do, find a node and update it.

 

From: Bob Archer [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:36 AM
To: Chris Fouts; [hidden email]
Subject: RE: xmlpeek and multiple nodes

 

For more than a simple find a node and update it I would recommend you write you own code using the script task. Or write your own task.

 

BOb

 

 

From: Chris Fouts [mailto:[hidden email]]
Sent: Friday, April 20, 2012 9:02 AM
To: [hidden email]
Subject: [NAnt-users] xmlpeek and multiple nodes

 

How can I use xmlpeek/xmlpoke to recursively peruse all the similarly named nodes in a file, the the <test> node below.

 

<tests>

   <test>…</test>

   <test>…</test>

   <test>…</test>

</tests>

 

This didn’t help, http://nant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html

 

And I found this

http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017190.html

 

Per that page, do I really have to do this, that is hard code the indices? So if I add a 16th node, I’ll have to change the script to add a 16th index?

<foreach item=”String” in=”1,2,3,4,5,6,7,8,9,10,11,12,13,14,15” delim=”,” property=”index”>

   <xmlpeek file=”${somefile} nodeindex=”${index}” …./>

</foreach>

 

So I found this http://www.mail-archive.com/nant-users@.../msg11179.html

But my nant version 0.91 complains about <xmllist> being an unknown task or data type.

 

-chris


***This e-mail message is intended only for the above named recipient(s)
and may contain information that is sensitive or proprietary. If you have
received this message in error or are not the named recipient(s), please
immediately notify the sender, delete this e-mail message without making
a copy and do not disclose or relay this e-mail message to anyone.***


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

mike
In reply to this post by Chris Fouts
I have a modified copy of the XMLLIST task that I use for this.  This issue comes up quite often for me; I don't understand why this type of situation/solution seems to get downplayed as "...don't do that".




--
Mike Frederick

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users
Reply | Threaded
Open this post in threaded view
|

Re: xmlpeek and multiple nodes

Bob Archer

I don’t think I said “don’t do that”… All I said was, out of the box xmlpoke and xmlpeek are really designed to work with an xpath that matches a single element in the XML. ;)

 

BOb

 

 

From: [hidden email] [mailto:[hidden email]]
Sent: Friday, April 20, 2012 11:44 AM
To: [hidden email]
Subject: Re: [NAnt-users] xmlpeek and multiple nodes

 

I have a modified copy of the XMLLIST task that I use for this.  This issue comes up quite often for me; I don't understand why this type of situation/solution seems to get downplayed as "...don't do that".

 

 

 

 

--

Mike Frederick


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
NAnt-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nant-users