473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

XPath expression with namespace

KB
Hello

I am trying to use SelectSingleNode in an XMLDocument for a node that
has namespace defined. My problem is the XPath for the node with no
namespace defined works as soon as I put namespace it returns nothing.

Help
KB
Nov 12 '05 #1
4 1525
Can you post your sample so we can take a look at it?

Thanks,
Hoang Nguyen
--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the
terms specified at http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread
from which they originated.

--------------------
Date: Fri, 04 Jun 2004 11:32:20 -0400
From: KB <me******@hotmail.com>
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: XPath expression with namespace
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <#z**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.xml
NNTP-Posting-Host: 216.85.84.66
Lines: 1
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.xml:21206
X-Tomcat-NG: microsoft.public.dotnet.xml

Hello

I am trying to use SelectSingleNode in an XMLDocument for a node that
has namespace defined. My problem is the XPath for the node with no
namespace defined works as soon as I put namespace it returns nothing.

Help
KB

Nov 12 '05 #2
Can you post your sample so we can take a look at it?

Thanks,
Hoang Nguyen
--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the
terms specified at http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread
from which they originated.

--------------------
Date: Fri, 04 Jun 2004 11:32:20 -0400
From: KB <me******@hotmail.com>
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: XPath expression with namespace
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <#z**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.xml
NNTP-Posting-Host: 216.85.84.66
Lines: 1
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.xml:21206
X-Tomcat-NG: microsoft.public.dotnet.xml

Hello

I am trying to use SelectSingleNode in an XMLDocument for a node that
has namespace defined. My problem is the XPath for the node with no
namespace defined works as soon as I put namespace it returns nothing.

Help
KB

Nov 12 '05 #3
KB
This is the sample document... I am trying to create expression to read
ObjectName node and Data node.
Thanks
KB

<?xml version="1.0" standalone="yes"?>
<!--Comment If Any-->
<SynchronizationObjectsDocument
xmlns="http://www.xyz.com/someapp/synchronization">
<ApplicationArea xmlns="http://www.xyz.com/someapp">
<DocId>e8ff008b-806c-4a34-8a82-ccf2bb0e47a2</DocId>
<CreationDateTime>2004-05-13T21:29:13-04:00</CreationDateTime>
<Receiver>
<DbId>DB001</DbId>
<OrgCode>GLOBAL</OrgCode>
<Operation>SYNCHRONIZATION</Operation>
<ObjectName>Part</ObjectName>
<OnError>Skip</OnError>
<Application>Someapp</Application>
<Module>MasterSetup</Module>
</Receiver>
<Comments />
</ApplicationArea>
<Data>
<V_PRT_PARTS>
<V_PRT_PART>
<PRD_CODE>PART1</PRD_CODE>
<PRD_NAME>PART NAME 1</PRD_NAME>
<PRL_PRD_CODE>PRODUCTLINE</PRL_PRD_CODE>
<UNT_CODE>Ea</UNT_CODE>
<PRD_UNIT_COST>1</PRD_UNIT_COST>
</V_PRT_PART>
<V_PRT_PART>
<PRD_CODE>PART2</PRD_CODE>
<PRD_NAME>PART NAME 2</PRD_NAME>
<PRL_PRD_CODE>PRODUCTLINE</PRL_PRD_CODE>
<UNT_CODE>Ea</UNT_CODE>
<PRD_UNIT_COST>2</PRD_UNIT_COST>
</V_PRT_PART>
</V_PRT_PARTS>
</Data>

</SynchronizationObjectsDocument>
Hoang Nguyen [MS] wrote:
Can you post your sample so we can take a look at it?

Thanks,
Hoang Nguyen

Nov 12 '05 #4
KB
This is the sample document... I am trying to create expression to read
ObjectName node and Data node.
Thanks
KB

<?xml version="1.0" standalone="yes"?>
<!--Comment If Any-->
<SynchronizationObjectsDocument
xmlns="http://www.xyz.com/someapp/synchronization">
<ApplicationArea xmlns="http://www.xyz.com/someapp">
<DocId>e8ff008b-806c-4a34-8a82-ccf2bb0e47a2</DocId>
<CreationDateTime>2004-05-13T21:29:13-04:00</CreationDateTime>
<Receiver>
<DbId>DB001</DbId>
<OrgCode>GLOBAL</OrgCode>
<Operation>SYNCHRONIZATION</Operation>
<ObjectName>Part</ObjectName>
<OnError>Skip</OnError>
<Application>Someapp</Application>
<Module>MasterSetup</Module>
</Receiver>
<Comments />
</ApplicationArea>
<Data>
<V_PRT_PARTS>
<V_PRT_PART>
<PRD_CODE>PART1</PRD_CODE>
<PRD_NAME>PART NAME 1</PRD_NAME>
<PRL_PRD_CODE>PRODUCTLINE</PRL_PRD_CODE>
<UNT_CODE>Ea</UNT_CODE>
<PRD_UNIT_COST>1</PRD_UNIT_COST>
</V_PRT_PART>
<V_PRT_PART>
<PRD_CODE>PART2</PRD_CODE>
<PRD_NAME>PART NAME 2</PRD_NAME>
<PRL_PRD_CODE>PRODUCTLINE</PRL_PRD_CODE>
<UNT_CODE>Ea</UNT_CODE>
<PRD_UNIT_COST>2</PRD_UNIT_COST>
</V_PRT_PART>
</V_PRT_PARTS>
</Data>

</SynchronizationObjectsDocument>
Hoang Nguyen [MS] wrote:
Can you post your sample so we can take a look at it?

Thanks,
Hoang Nguyen

Nov 12 '05 #5

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

Similar topics

2
by: kj | last post by:
Suppose I have some XML document that contains tags of the form <... xmlns:foo="http://www.bar.org/foo"> <... xmlns:foo="baz"> <... xmlns:frobozz="http://www.bar.org/foo"> What's the...
3
by: Bob | last post by:
Below is some code that use to work. Now it is not and I have yet to figure out why. I want to select the nodes to a nodelist and remove them from the dom. The only thing I can figure is it broke...
1
by: Seong-Tae Jeong | last post by:
for example, xml document is below, It has a default namespace "xmlns='qwer://test'". string xmlText = "<test xmlns='http://test'><clear/><clear/></test>"; I would like to select node list...
2
by: ree32 | last post by:
When I import an xml document in Visual studio and Genereate as schema from it, and create a dataset from it, it adds this line into to the root element of my xml file -...
3
by: Patrick | last post by:
Dear Ng, after I have loaded am XmlDataDocument file, I try to extract a single node via XmlElement myElem = (XmlElement)this.XmlDataDocument.SelectSingleNode("/Document/Headerdata/myElem");...
5
by: David Thielen | last post by:
Hi; I set up my xml as follows: XmlDocument xml = new XmlDocument(); xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read)); XmlNamespaceManager context = new...
2
by: Paul | last post by:
I'd like to write an XPath expression that gets all nodes with a given local-name, say 'Customer', within a given namespace. From a prior response I got the following to get nodes with a specific...
1
by: Arndt Jonasson | last post by:
The definition of XPath 1.0 says "A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. This is the same way expansion is done...
14
by: Mikhail Teterin | last post by:
Hello! What's would be the syntax for a query, which would allow me to get only the elements with non-empty text-nodes? For example, from: <a><b></b></a> <c/> <d><e>meow</e></d>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.