.NET Framework - Help: XML file - Results of data retreival are blank (see examples)....
Asked By Billy
19-Jan-10 03:08 PM
Im having an issue pulling specific data from XML. The results for the
field are blank......
This is a snipplet of the XML that I want to pull from. I need to pull
the specific comment: "This is such a great way for support. It solves
the question/problem immediately! Thank you." shown in the XML below.
I also want to pull the rating value of "5" into a seperate field too.
I can pull other data from XML fields no problem. Can someone help
tell me what I am doing wrong with this piece of code to reference
these fields?
This is the portion of XML:
- <cust_survey_list>
- <cust_exit_survey gsnumber=3D"1547">
It solves the question/problem immediately! Thank you." />
by using this portion of the code in an XSL template:
td>
value/name/@comments"/></td>
This is the entire XSL file below for reference=85=85
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform">
td>
display_name"/></td>
XPath
(1)
Attendees
(1)
Prev
(1)
Reps
(1)
Exp
(1)
Retreival
(1)
MYSUPPORT
(1)
Snipplet
(1)
Eric replied to Billy
t.
_ip"/></
vey/
ame"/></
c_ip"/></td>
Martin Honnen replied to Billy
The XPath would be
cust_survey_list/cust_exit_survey/value[@name = 'comments']/@value
and if you want to output that value then you need
'comments']/@value"/>
and not xsl:attribute as that would be used to create an attribute in
the result tree.
--
Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/
Null .NET Framework Probably just a mistake in the documentation: Public Overridable Function SelectSingleNode(ByVal xpath As String) As System.Xml.XPath.XPathNavigator Member of: System.Xml.XPath.XPathNavigator Summary: Selects a single node in the System.Xml.XPath.XPathNavigator using the specified XPath query. Parameters xpath: A System.String representing an XPath expression. Return Values: An System.Xml.XPath.XPathNavigator object that contains the first matching node for the XPath query specified; otherwise, null
why is count(xpath) ! = xpath[last()] ? .NET Framework While writing a template, I came across a situation in Microsoft's evaluation of my XSLT where, for a given XPath expression, count() of that nodeset was not equal to last() of that nodeset. I can last()]" / > [position() = 1]" / > [position() = last()]" / > The XML output from this transform is Note that the XPath / root / Students / row / Name yielded a nodeset of two names, as shown by the value Xsl Discussions ASP.NET (1) TagName (1) Jeni (1) Confuses (1) Jfrensen (1) Nodeset (1) Xpath (1) XSLT (1) That's because Name elements aren't siblings. Each Name element is contains single Name element, so last() = 1. last() function returns context node-set size. During XPath expression evaluation context node-set is changing by each location step and predicate. You need the use of the predicate filter seems to change the order of evaluation of the XPath expression. That is, select = " / root / Students / row / Name" evaluates to a nodeset of two Names Students / row / Name)" evaluates to the number 2. Given that, I had assumed that the XPath expression select = " / root / Students / row / Name[position() = last()]" would be evaluated from left to right
Validating XPath .NET Framework Hi, Is there a way of validating and XPath? In this case , I am accepting an XPath from the user and I need to validate the XPath syntax. Is there a regular expression available that anyone can direct me to, to validate a XPath? thanks, Arun Xml Discussions XPathExpression (1) XPathException (1) XPathNavigator (1) Compile (1) Validating (1) XPath (1) Arun (1) Predicates (1) The W3C has an applet that checks the grammar of an XPath expression: I think however that applet is for XPath 2.0 while the Microsoft .NET framework application currently support XPath 1.0 only. You
selectsinglenode of namespace attribute .NET Framework I'm loading an xml and doing selectSingleNode( / / *[xpath]) xpath is with namespace attribute. var xmlStr = "<R AB:I = '1' xmlns:AB = 'urn:MynameSpace'> <I new ActiveXObject("MSXML2.DOMDocument.4.0"); abc.async = false abc.loadXML(xmlStr) abc.setProperty("SelectionLanguage", "XPath"); abc.setProperty("SelectionNamespaces", "xmlns:AB = 'urn:MynameSpace'"); alert(abc.documentElement.xml) / / xmml i coming proper question keywords: selectsinglenode, of, namespace, attribute description: I'm loading an xml and doing selectSingleNode( / / *[xpath]) xpath is with namespace attribute. var xmlStr = R AB:I = '1' xmlns:AB = 'urn:MynameSpace'I