Re: xmlpeek and multiple nodes

Chris Fouts <[email protected]> Fri, 20 Apr 2012 10:02:36 -0400
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
--===============2488260016735960365==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_CAEEAE7CCE73AD44B00FC28BC7982FAC0967FD0826srv584caemilu_"

--_000_CAEEAE7CCE73AD44B00FC28BC7982FAC0967FD0826srv584caemilu_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

So no canned support for this?

-chris

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

In other words, if you can't get to a specific node with an XPath expressio=
n 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 goog=
le find this http://bgeek.net/2005/09/19/nant-xml-node-counting/

BOb


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

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

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

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

BOb


From: Chris Fouts [mailto:[email protected]]
Sent: Friday, April 20, 2012 9:02 AM
To: [email protected]
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/xmlpe=
ek.html

And I found this
http://old.nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-express=
ion-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=3D"String" in=3D"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" delim=
=3D"," property=3D"index">
   <xmlpeek file=3D"${somefile} nodeindex=3D"${index}" ..../>
</foreach>

So I found this http://www.mail-archive.com/[email protected]=
t/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.***

--_000_CAEEAE7CCE73AD44B00FC28BC7982FAC0967FD0826srv584caemilu_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"><head><meta http-equiv=3DContent-Type content=
=3D"text/html; charset=3Dus-ascii"><meta name=3DGenerator content=3D"Micros=
oft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle22
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle23
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle24
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue vli=
nk=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span style=3D'c=
olor:#1F497D'>So no canned support for this?<o:p></o:p></span></p><p class=
=3DMsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p c=
lass=3DMsoNormal><span style=3D'color:#1F497D'>-chris<o:p></o:p></span></p>=
<p class=3DMsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span>=
</p><div><div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3=
.0pt 0in 0in 0in'><p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;f=
ont-family:"Tahoma","sans-serif"'>From:</span></b><span style=3D'font-size:=
10.0pt;font-family:"Tahoma","sans-serif"'> Bob Archer [mailto:Bob.Archer@am=
si.com] <br><b>Sent:</b> Friday, April 20, 2012 9:59 AM<br><b>To:</b> Chris=
 Fouts; [email protected]<br><b>Subject:</b> RE: xmlpeek and=
 multiple nodes<o:p></o:p></span></p></div></div><p class=3DMsoNormal><o:p>=
&nbsp;</o:p></p><p class=3DMsoNormal><span style=3D'color:#1F497D'>In other=
 words, if you can&#8217;t get to a specific node with an XPath expression =
you really need to roll your own. That&#8217;s really what it is designed f=
or.<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'color:#1F497D'=
><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'color:#1F4=
97D'>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 </span><a href=3D"http://bgeek.net/2005/09/19/nant-xml-no=
de-counting/">http://bgeek.net/2005/09/19/nant-xml-node-counting/</a><span =
style=3D'color:#1F497D'><o:p></o:p></span></p><p class=3DMsoNormal><span st=
yle=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><spa=
n style=3D'color:#1F497D'>BOb<o:p></o:p></span></p><p class=3DMsoNormal><sp=
an style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal=
><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style=3D'bo=
rder:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div=
 style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in =
0in'><p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"T=
ahoma","sans-serif"'>From:</span></b><span style=3D'font-size:10.0pt;font-f=
amily:"Tahoma","sans-serif"'> Chris Fouts [mailto:[email protected]=
] <br><b>Sent:</b> Friday, April 20, 2012 9:48 AM<br><b>To:</b> Bob Archer;=
 [email protected]<br><b>Subject:</b> RE: xmlpeek and multip=
le nodes<o:p></o:p></span></p></div></div><p class=3DMsoNormal><o:p>&nbsp;<=
/o:p></p><p class=3DMsoNormal><span style=3D'color:#1F497D'>That&#8217;s al=
l I want to do, find a node and update it.<o:p></o:p></span></p><p class=3D=
MsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><d=
iv style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0i=
n 0in'><p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:=
"Tahoma","sans-serif"'>From:</span></b><span style=3D'font-size:10.0pt;font=
-family:"Tahoma","sans-serif"'> Bob Archer [mailto:[email protected]] <br=
><b>Sent:</b> Friday, April 20, 2012 9:36 AM<br><b>To:</b> Chris Fouts; nan=
[email protected]<br><b>Subject:</b> RE: xmlpeek and multiple n=
odes<o:p></o:p></span></p></div></div><p class=3DMsoNormal><o:p>&nbsp;</o:p=
></p><p class=3DMsoNormal><span style=3D'color:#1F497D'>For more than a sim=
ple find a node and update it I would recommend you write you own code usin=
g the script task. Or write your own task.<o:p></o:p></span></p><p class=3D=
MsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p clas=
s=3DMsoNormal><span style=3D'color:#1F497D'>BOb<o:p></o:p></span></p><p cla=
ss=3DMsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p=
 class=3DMsoNormal><span style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></=
p><div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in 0i=
n 4.0pt'><div><div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padd=
ing:3.0pt 0in 0in 0in'><p class=3DMsoNormal><b><span style=3D'font-size:10.=
0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style=3D'font-=
size:10.0pt;font-family:"Tahoma","sans-serif"'> Chris Fouts [mailto:Chris.F=
[email protected]] <br><b>Sent:</b> Friday, April 20, 2012 9:02 AM<br><b>T=
o:</b> [email protected]<br><b>Subject:</b> [NAnt-users] xml=
peek and multiple nodes<o:p></o:p></span></p></div></div><p class=3DMsoNorm=
al><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>How can I use xmlpeek/xmlpoke =
to recursively peruse all the similarly named nodes in a file, the the &lt;=
test&gt; node below.<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></=
p><p class=3DMsoNormal>&lt;tests&gt;<o:p></o:p></p><p class=3DMsoNormal>&nb=
sp;&nbsp; &lt;test&gt;&#8230;&lt;/test&gt;<o:p></o:p></p><p class=3DMsoNorm=
al>&nbsp;&nbsp; &lt;test&gt;&#8230;&lt;/test&gt;<o:p></o:p></p><p class=3DM=
soNormal>&nbsp;&nbsp; &lt;test&gt;&#8230;&lt;/test&gt;<o:p></o:p></p><p cla=
ss=3DMsoNormal>&lt;/tests&gt;<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp=
;</o:p></p><p class=3DMsoNormal>This didn&#8217;t help, <a href=3D"http://n=
ant.sourceforge.net/release/0.85/help/tasks/xmlpeek.html">http://nant.sourc=
eforge.net/release/0.85/help/tasks/xmlpeek.html</a><o:p></o:p></p><p class=
=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>And I found this<o:p=
></o:p></p><p class=3DMsoNormal><a href=3D"http://old.nabble.com/xmlpeek---=
Multiple-nodes-found-with-the-XPath-expression-td20017190.html">http://old.=
nabble.com/xmlpeek---Multiple-nodes-found-with-the-XPath-expression-td20017=
190.html</a><o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p cla=
ss=3DMsoNormal>Per that page, do I really have to do this, that is hard cod=
e the indices? So if I add a 16<sup>th</sup> node, I&#8217;ll have to chang=
e the script to add a 16<sup>th</sup> index?<o:p></o:p></p><p class=3DMsoNo=
rmal><span style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";color=
:navy'>&lt;foreach item=3D&#8221;String&#8221; in=3D&#8221;1,2,3,4,5,6,7,8,=
9,10,11,12,13,14,15&#8221; delim=3D&#8221;,&#8221; property=3D&#8221;index&=
#8221;&gt;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-si=
ze:10.0pt;font-family:"Arial","sans-serif";color:navy'>&nbsp;&nbsp; &lt;xml=
peek file=3D&#8221;${somefile} nodeindex=3D&#8221;${index}&#8221; &#8230;./=
&gt;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:10.=
0pt;font-family:"Arial","sans-serif";color:navy'>&lt;/foreach</span><span s=
tyle=3D'font-family:"Arial","sans-serif";color:navy'>&gt;<o:p></o:p></span>=
</p><p class=3DMsoNormal><span style=3D'font-family:"Arial","sans-serif";co=
lor:navy'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'f=
ont-family:"Arial","sans-serif";color:navy'>So I found this <a href=3D"http=
://www.mail-archive.com/[email protected]/msg11179.html">htt=
p://www.mail-archive.com/[email protected]/msg11179.html</a>=
<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-family:"Aria=
l","sans-serif";color:navy'>But my nant version 0.91 complains about &lt;xm=
llist&gt; being an unknown task or data type.<o:p></o:p></span></p><p class=
=3DMsoNormal><span style=3D'font-family:"Arial","sans-serif";color:navy'><o=
:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'font-family:"=
Arial","sans-serif";color:navy'>-chris</span><o:p></o:p></p><p><br>***This =
e-mail message is intended only for the above named recipient(s)<br>and may=
 contain information that is sensitive or proprietary. If you have<br>recei=
ved this message in error or are not the named recipient(s), please <br>imm=
ediately notify the sender, delete this e-mail message without making<br>a =
copy and do not disclose or relay this e-mail message to anyone.***<o:p></o=
:p></p></div></div></div></body></html>=

--_000_CAEEAE7CCE73AD44B00FC28BC7982FAC0967FD0826srv584caemilu_--


--===============2488260016735960365==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
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
--===============2488260016735960365==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

--===============2488260016735960365==--