1

Closed

Create ItemGroup from XPath

description

Discussed here: http://msbuildextensionpack.codeplex.com/discussions/244051

Basically the user should be able to provide and xpath which results in >=1 nodes and these should be added to an itemgroup..... We could expand to attributes being modeled as metadata too...

No files are attached

Closed Nov 7 2011 at 9:55 PM by mikeFourie

comments

williagi wrote Feb 7 at 10:40 AM

... sorry, I believe that I need an entirely different task, ReadElementText

williagi wrote Feb 7 at 9:17 AM

Thanks Mike, however, how would you parse the following structure?

<RenderingConfiguration>
<RenderEngines>
<RenderEngine>RE1</RenderEngine>
<RenderEngine>RE2</RenderEngine>
<RenderEngine>RE3</RenderEngine>
</RenderEngines>
</RenderingConfiguration>

mikeFourie wrote Feb 6 at 9:25 PM


ReadElements (Required: File, XPath Optional: Namespaces Output: Elements). Attributes are added as metadata


Sample Xml
<RenderingConfiguration>
<RenderEngines>
<RenderEngine ID="RE1" />
<RenderEngine ID="RE2" />
<RenderEngine ID="RE3" />
</RenderEngines>
</RenderingConfiguration>

Sample Target
<Target Name="Default">
<XmlFile TaskAction="ReadElements" File="d:\a\pathtoxmlfile.xml" XPath="//RenderingConfiguration/RenderEngines/RenderEngine">
<Output ItemName="ddd" TaskParameter="Elements"/>
</XmlFile>

<Message Text="%(ddd.Identity) --- %(ddd.ID)"/>
</Target>


Output
Project "D:\Projects\MSBuildExtensionPack\Releases\3.5.11.0\Main\Framework\XmlS
amples\XmlFile.proj" on node 1 (default targets).
Default:
XmlFile: d:\a\pathtoxmlfile.xml
Read Elements: //RenderingConfiguration/RenderEngines/RenderEngine
RenderEngine --- RE1
RenderEngine --- RE2
RenderEngine --- RE3
Done Building Project "D:\Projects\MSBuildExtensionPack\Releases\3.5.11.0\Main\
Framework\XmlSamples\XmlFile.proj" (default targets).

williagi wrote Feb 6 at 5:05 PM

Is there an example of its implementation anywhere?

wrote Nov 7 2011 at 9:55 PM

Resolved with changeset 71163.