473,480 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XPath pb

Hi

In infopath, I use a XPath expression to get some nodes :

var oEMailNodeList = XDocument.DOM.selectNodes("//Message/EMail");

My problem is that this method returns 0 items. Here is the DOM.xml property
:

<?xml version="1.0" ?>

<?mso-infoPathSolution productVersion=\"11.0.5329\" PIVersion=\"1.0.0.0\"
href=\"file:///C:\Documents%20and%20Settings\t-stevbe\Local%20Settings\Appli
cation%20Data\Microsoft\InfoPath\7ab6e8af39fc42e2\ manifest.xsf\"
solutionVersion=\"1.0.0.9\" initialView=\"messagesList\" ?>

<?mso-application progid=\"InfoPath.Document\"?>

<dfs:myFields
xmlns:my="\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-07-
24T09:51:34\"

xmlns:s1="\"http://microsoft.com/wsdl/types/\"
xmlns:s0="\"http://tempuri.org/\"
xmlns:dfs="\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\"

xml:lang="\"fr\">

<dfs:queryFields>

<s0:GetMessagesByUserName>

<s0:userName>EUROPE\t-stevbe</s0:userName>

</s0:GetMessagesByUserName>

</dfs:queryFields>

<dfs:dataFields>

<GetMessagesByUserNameResponse xmlns="\"http://tempuri.org/\">

<GetMessagesByUserNameResult />

<messages>

<Message>

<UserName>DOMAIN\user</UserName>

<EMail>us**@domain.com</EMail>

<MessageTitle>Test</MessageTitle>

<MessageBody>etettete</MessageBody>

<MessageID>bd3d5156-3960-4074-a7f8-f75d35e61219</MessageID>

<MessageDate>2003-07-21T15:52:11.8770000+02:00</MessageDate>

</Message>

</messages>

</GetMessagesByUserNameResponse>

</dfs:dataFields>

</dfs:myFields>

Is the XPath expression correct ??

Note that the expression "//dfs:dataFields" return actually the right node,
but the expression "//dfs:dataFields/GetMessagesByUserNameResponse" return 0
items.

Thanks for any help !

Steve
Nov 11 '05 #1
1 1852
Steve B. [Labo.Net] wrote:

In infopath, I use a XPath expression to get some nodes :

var oEMailNodeList = XDocument.DOM.selectNodes("//Message/EMail");
<GetMessagesByUserNameResponse xmlns="\"http://tempuri.org/\">

<GetMessagesByUserNameResult />

<messages>

<Message>
Is the XPath expression correct ??

Nope. See yourself - Message element is in "http://tempuri.org/" namespace,
while //Message expression selects Message elements in null namespace.
Read about namespace issues in selectNodes method documentation.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6809
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
0
1898
by: gael.pegliasco | last post by:
Hi, How are you dear and nice helper :) ? I'm trying to test xpath with this simple program : import xml.dom.minidom from xml.xpath.Context import Context import xml.xpath
4
21181
by: Son KwonNam | last post by:
In XSLT, is this possible to get value from xml using XPath which is in XSLT variable? I mean XPath strings can be dynamic while XSL Transforming. If possible, How?? Because I'm not a...
5
4182
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
18
7699
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
9
2120
by: David Thielen | last post by:
Hi; I am sure I am missing something here but I cannot figure it out. Below I have a program and I cannot figure out why the xpath selects that throw an exception fail. From what I know they...
5
7905
by: Gnic | last post by:
Hi , I have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa>
3
2184
by: werD | last post by:
Hello I have an xml document that im currently using a forward only .net repeater on and using some xpath queries to display the data The xml is quite simple <?xml version="1.0"...
3
4957
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
0
7039
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.