Skip to content

Instantly share code, notes, and snippets.

@rodmhgl rodmhgl/Data.xml
Last active Apr 2, 2018

Embed
What would you like to do?
XPath Troubleshooting
<?xml version="1.0" encoding="utf-8"?>
<bpr:release xmlns:bpr="http://www.blueprism.co.uk/product/release">
<bpr:name>BPRelease v3</bpr:name>
<bpr:release-notes>
</bpr:release-notes>
<bpr:created>2018-03-31 04:20:16Z</bpr:created>
<bpr:package-id>4</bpr:package-id>
<bpr:package-name>BPRelease_Info Troubleshooting</bpr:package-name>
<bpr:user-created-by>admin</bpr:user-created-by>
<bpr:contents count="2">
<process id="31681777-fe3d-43bd-b07a-a6aafabf859f" name="BPRelease_Info Troubleshooting"
xmlns="http://www.blueprism.co.uk/product/process">
<process name="BPRelease_Info Troubleshooting" version="1.0" bpversion="6.1.0.992" narrative="">
<view>
<camerax>0</camerax>
<cameray>0</cameray>
<zoom version="2">1.25</zoom>
</view>
<preconditions />
<endpoint narrative="" />
<stage stageid="7d446fc8-98a7-4176-9411-c0e2b1ef828f" name="Start" type="Start">
<narrative></narrative>
<displayx>15</displayx>
<displayy>-105</displayy>
<displaywidth>60</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<onsuccess>743f3344-3a86-47d6-beaa-fd7593371aaf</onsuccess>
</stage>
<stage stageid="3da1d5f8-641e-44d6-a58f-7903c4f4f98c" name="End" type="End">
<narrative></narrative>
<displayx>15</displayx>
<displayy>165</displayy>
<displaywidth>60</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
</stage>
<stage stageid="79fc1bf4-12cb-4344-bf24-bd2bc9999ff2" name="Stage1" type="ProcessInfo">
<narrative></narrative>
<displayx>-195</displayx>
<displayy>-105</displayy>
<displaywidth>150</displaywidth>
<displayheight>90</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
</stage>
<stage stageid="46d27e48-3d69-4518-99c1-acafc8c81583" name="System Exception Test" type="Exception">
<narrative></narrative>
<displayx>165</displayx>
<displayy>75</displayy>
<displaywidth>120</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<exception type="System Exception" detail="&quot;Just a Test Exceptation&quot;" />
</stage>
<stage stageid="b59d1e21-f264-45a4-bf5d-792241402971" name="DataItem1of3" type="Data">
<narrative></narrative>
<displayx>-240</displayx>
<displayy>0</displayy>
<displaywidth>180</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<datatype>text</datatype>
<initialvalue xml:space="preserve">Intial Value of DataItem1of3</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="9b0b90dd-ae63-4964-81cc-3c4051202a56" name="DataItem2of3-Global" type="Data">
<narrative></narrative>
<displayx>-240</displayx>
<displayy>45</displayy>
<displaywidth>180</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<datatype>number</datatype>
<initialvalue>1</initialvalue>
<alwaysinit />
</stage>
<stage stageid="7ce75490-c99d-401e-a918-1130b0b114b6" name="DataItem3of3" type="Data">
<narrative></narrative>
<displayx>-240</displayx>
<displayy>90</displayy>
<displaywidth>180</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<datatype>text</datatype>
<initialvalue xml:space="preserve">Intial Value of DataItem3of3</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="743f3344-3a86-47d6-beaa-fd7593371aaf" name="Action1" type="Action">
<narrative></narrative>
<displayx>15</displayx>
<displayy>0</displayy>
<displaywidth>60</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<onsuccess>ca441a53-19fc-4937-8aa3-be021f1ae12d</onsuccess>
<resource object="BPRelease_Info Troubleshooting VBO" action="Action 1" />
</stage>
<stage stageid="ca441a53-19fc-4937-8aa3-be021f1ae12d" name="Decision1" type="Decision">
<narrative></narrative>
<displayx>15</displayx>
<displayy>75</displayy>
<displaywidth>60</displaywidth>
<displayheight>30</displayheight>
<font family="Segoe UI" size="10" style="Regular" color="000000" />
<decision expression="" />
<ontrue>3da1d5f8-641e-44d6-a58f-7903c4f4f98c</ontrue>
<onfalse>46d27e48-3d69-4518-99c1-acafc8c81583</onfalse>
</stage>
</process>
</process>
<object id="38200706-c57f-4f1e-ae9b-db36d45808ae" name="BPRelease_Info Troubleshooting VBO" xmlns="http://www.blueprism.co.uk/product/process"><process name="BPRelease_Info Troubleshooting VBO" version="1.0" bpversion="6.1.0.992" narrative="" type="object" runmode="Exclusive"><appdef><element name="Application Root"><id>1d0904fc-5735-4966-b645-cc8cb71d9b7d</id><type>Application</type><basetype>Application</basetype><datatype>unknown</datatype><diagnose>False</diagnose></element></appdef><view><camerax>0</camerax><cameray>0</cameray><zoom version="2">1.25</zoom></view><preconditions /><endpoint narrative="" /><subsheet subsheetid="12305a41-a2bf-4d4a-a493-3aea1f5036b1" type="CleanUp" published="True"><name>Clean Up</name><view><camerax>0</camerax><cameray>0</cameray><zoom version="2">1.25</zoom></view></subsheet><subsheet subsheetid="2c7cf750-4b2e-4328-b2cf-16c2b7ddf5aa" type="Normal" published="True"><name>Action 1</name><view><camerax>0</camerax><cameray>0</cameray><zoom version="2">1.25</zoom></view></subsheet><stage stageid="c0b40993-8387-4333-85f6-466228c3d8c0" name="Start" type="Start"><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>-105</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><onsuccess>f60a8e77-66af-442e-a99d-50d03b9045d1</onsuccess></stage><stage stageid="9276aeed-d7eb-444c-af81-1a26fdb0e8eb" name="End" type="End"><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>90</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="78f2f66d-1f86-4d6e-93dc-e34f6189fc2c" name="Stage1" type="ProcessInfo"><narrative></narrative><displayx>-195</displayx><displayy>-105</displayy><displaywidth>150</displaywidth><displayheight>90</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><references><reference>System.dll</reference><reference>System.Data.dll</reference><reference>System.Xml.dll</reference><reference>System.Drawing.dll</reference></references><imports><import>System</import><import>System.Drawing</import><import>System.Data</import></imports><language>visualbasic</language><globalcode><![CDATA[]]></globalcode><code><![CDATA[]]></code></stage><stage stageid="763922ed-d3ea-4e81-baeb-33f9bd8efc08" name="Clean Up" type="SubSheetInfo"><subsheetid>12305a41-a2bf-4d4a-a493-3aea1f5036b1</subsheetid><narrative></narrative><displayx>-195</displayx><displayy>-105</displayy><displaywidth>150</displaywidth><displayheight>90</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="cf7ce3db-1565-476b-83e4-f5235640eb3e" name="Start" type="Start"><subsheetid>12305a41-a2bf-4d4a-a493-3aea1f5036b1</subsheetid><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>-105</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><onsuccess>ded23af6-12e6-41c9-ab56-2491fa7fc4c3</onsuccess></stage><stage stageid="ded23af6-12e6-41c9-ab56-2491fa7fc4c3" name="End" type="End"><subsheetid>12305a41-a2bf-4d4a-a493-3aea1f5036b1</subsheetid><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>90</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="eb6cf233-cea5-49a7-9702-66257158cb69" name="Action 1" type="SubSheetInfo"><subsheetid>2c7cf750-4b2e-4328-b2cf-16c2b7ddf5aa</subsheetid><narrative></narrative><displayx>-195</displayx><displayy>-105</displayy><displaywidth>150</displaywidth><displayheight>90</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="e08d531d-f64e-4c53-ae56-5b67307c3ab7" name="Start" type="Start"><subsheetid>2c7cf750-4b2e-4328-b2cf-16c2b7ddf5aa</subsheetid><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>-105</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><onsuccess>a37c0545-4aa8-4fda-8e7a-d030776d0f60</onsuccess></stage><stage stageid="5f859fc4-793a-4ff5-b2ef-26f2679a215a" name="End" type="End"><subsheetid>2c7cf750-4b2e-4328-b2cf-16c2b7ddf5aa</subsheetid><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>90</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="f9995005-c9a5-4320-a339-0e24d6e7bd9d" name="Note1" type="Note"><subsheetid>12305a41-a2bf-4d4a-a493-3aea1f5036b1</subsheetid><narrative>Clean Up Page
This is an optional page where you might choose to perform some finalisation (or "cleanup") tasks as your business object is closed down.
The cleanup action will be called automatically immediately after closing your business object at the end of a business process.
You will not be able to call this action from a business process, nor will it be called at any other time than before the disposal of the business object.</narrative><displayx>-180</displayx><displayy>60</displayy><displaywidth>180</displaywidth><displayheight>230</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="3e522ff3-72b8-455f-9906-53403e77c587" name="Note2" type="Note"><narrative>Initialise Page
This is an optional page where you might choose to perform some initialisation tasks after your business object is loaded.
The initialise action will be called automatically immediately after loading your business object.
You will not be able to call this action from a business process, nor will it be called at any other time than after the creation of the object.</narrative><displayx>-180</displayx><displayy>60</displayy><displaywidth>180</displaywidth><displayheight>230</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /></stage><stage stageid="a37c0545-4aa8-4fda-8e7a-d030776d0f60" name="Action1" type="Action"><subsheetid>2c7cf750-4b2e-4328-b2cf-16c2b7ddf5aa</subsheetid><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>0</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><onsuccess>5f859fc4-793a-4ff5-b2ef-26f2679a215a</onsuccess><resource object="" action="" /></stage><stage stageid="9d6ac488-9cfc-4919-8edb-99037dbddd19" name="Data1" type="Data"><loginhibit /><narrative></narrative><displayx>150</displayx><displayy>-105</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><datatype>unknown</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="9fb599f0-e7bb-482b-91d4-b436fd1bad03" name="Exception1" type="Exception"><narrative></narrative><displayx>135</displayx><displayy>-15</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><exception type="" detail="" /></stage><stage stageid="f60a8e77-66af-442e-a99d-50d03b9045d1" name="Decision1" type="Decision"><loginhibit /><narrative></narrative><displayx>15</displayx><displayy>-15</displayy><displaywidth>60</displaywidth><displayheight>30</displayheight><font family="Segoe UI" size="10" style="Regular" color="000000" /><decision expression="True" /><ontrue>9276aeed-d7eb-444c-af81-1a26fdb0e8eb</ontrue><onfalse>9fb599f0-e7bb-482b-91d4-b436fd1bad03</onfalse></stage></process></object>
</bpr:contents>
</bpr:release>
using System;
using System.Xml;
namespace XMLTesting
{
class Program
{
static void Main(string[] args)
{
XmlDocument document = null;
document = new XmlDocument();
document.Load("Data.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
nsmgr.AddNamespace("bpr", "http://www.blueprism.co.uk/product/release");
nsmgr.AddNamespace("dft", "http://www.blueprism.co.uk/product/release");
/// Calling SelectNodes with this XPath returns results
/// "/bpr:release/bpr:contents"
/// Calling SelectNodes with this XPath does not return results in C# but does in PowerShell
/// "/bpr:release/bpr:contents/dft:process/dft:process/dft:stage[@type='Data']"
/// This also works in PowerShell: "//dft:process/dft:stage[@type='Data']"
Console.WriteLine("Begin Process Data Items");
XmlNodeList processDataItemList = document.SelectNodes("/bpr:release/bpr:contents", nsmgr);
Console.WriteLine(processDataItemList.Count);
Console.WriteLine("End Process Data Items");
/// Calling SelectNodes with this XPath returns results
/// "/bpr:release/bpr:contents"
/// Calling SelectNodes with this XPath does not return results in C# but does in PowerShell
/// "/bpr:release/bpr:contents/dft:object/dft:process/dft:stage[@type='Data']"
/// This also works in PowerShell: "//dft:object/dft:stage[@type='Data']"
Console.WriteLine("Begin Object Data Items");
XmlNodeList objectDataItemList = document.SelectNodes("/bpr:release/bpr:contents", nsmgr);
Console.WriteLine(objectDataItemList.Count);
Console.WriteLine("End Object Data Items");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.