| Stephen W. Thomas 2004-10-15, 9:09 pm |
| Inside an Orchestration, you can select a single node like this:
xDoc = new XmlDocument();
xDoc = xpath(Message,"(//*[local-name()='NODE'])");
Message is your XmlDocument you want to query against and the xPath can be
anything you need. The above will return a null reference if you try to
access the xDoc and it doesn’t have a value.
If you wanted a string returned directly, you can do something like this:
String = xpath(Message,"string(YourXPathStringToNodeHere)");
Hope this helps.
Stephen W. Thomas
http://www.geekswithblogs.com/sthomas
"John Smith" wrote:
> Hi,
>
> I have a serious problem using xpath queries after receiving a xml document
> with a .Net class. I use an Expression shape to initialize my class and use
> a method to send the received message to this class.
>
> Everything works fine until i want to use a XPath query to select some
> nodes. I get a null reference to a node, though I know it exists. If I use
> the same code, but then loading the xml document from the file system I have
> no problems!
>
> Does anybody has an idea?
>
> This is a part of my code:
>
> aXmlDoc = (XmlDocument) msg[0].RetrieveAs(typeof(XmlDocument));
> aSalesOrders = aXmlDoc.DocumentElement.ChildNodes;
>
> for (int i=0;i<aSalesOrders.Count;i++)
>
> {
>
> aTo = aSalesOrders[i].SelectSingleNode("ShipTo/Name").InnerText;
>
>
>
> Thanks,
> Bas Dirkse (b_dirkse@hotmail.com)
>
>
>
>
|