Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2011, 07:51 AM
Authorized User
 
Join Date: Oct 2011
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Default XML - c#

Guys, don't know if this is athe right palce to ask but here it goes.
I have an xml string in a c# programm and want to get a specific element value (which is about five children down from top node). However, there are lots of namespaces within the xml, too.
see below

<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
<SOAP-ENV:Header><ns:FXTradeVersion ns0:mustUnderstand=\"1 xsi:type=\"xs:string\"



My code below:

Code:
           XmlDocument xml = new XmlDocument();
            xml.LoadXml(fpml);
            XmlNodeList xnList = xml.SelectNodes("SOAP-ENV:Envelope/SOAP-ENV:Body/fpml:TradeAffirmation/fpml:trade/fpml:tradeHeader/fpml:partyTradeIdentifier");
But I get the following exception thrown
Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

thanks
 
Old December 12th, 2011, 08:18 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

This forum is about XSLT so your question is not on topic here. Try the documentation http://msdn.microsoft.com/en-us/library/4bektfx9.aspx, it has an example on using SelectNodes with an XmlNamespaceManager, if that does not help then post in http://p2p.wrox.com/xml-91/ or a .NET forum.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
anthonym (December 12th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert XML to CSV with XML field names as column headers? swheeler XSLT 10 February 10th, 2012 11:18 AM
Split xml file with result document and javax.xml.transform.Transformer. nisargmca XSLT 3 January 12th, 2010 06:26 AM
Urgent ::Reading two xml files subcontent and adding that to third xml file archleader XSLT 6 August 18th, 2009 03:11 AM
VB.net, adding XML data to an existing XML file saikoboarder XML 11 April 17th, 2008 04:19 PM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.