473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Still having problems with NameSpaceManage r

Hi,

I'm trying to extract data from objects that contain xml that fits a
third party schema with it's own root namespace. I've added a
namespace manager that seemed to work most of the time but I never
fully understood why. I've now hit another problem. It might be code
blindness but I can't see why it doesn't work.

I am trying to select a node using XPath from an XmlElement

XmlElement xEntityNode ;

/* xEntityNode's OuterXml is this
<facilityList xmlns="qvEntity Types">
<facility>
<internalId>6 </internalId>
<description>Or derOnLine</description>
<displayOrder>1 </displayOrder>
</facility>
<facility>
<internalId>7 </internalId>
<description>Co nfirmHeldOrders </description>
<displayOrder>1 </displayOrder>
</facility>
<facility>
<internalId>2 8</internalId>
<description>Vi ewProductStock</description>
<displayOrder>1 </displayOrder>
</facility>
<facility>
<internalId>2 9</internalId>
<description>Se eOtherUsersOrde rs</description>
<displayOrder>1 </displayOrder>
</facility>
<facility>
<internalId>3 0</internalId>
<description>Bu y</description>
<displayOrder>1 </displayOrder>
</facility>
</facilityList>
*/

// Here's my code
nsmgr = new XmlNamespaceMan ager( new System.Xml.Name Table() );
nsmgr.AddNamesp ace("qv", "qvEntityTypes" ) ;
XmlNode propertyNode = xEntityNode.Sel ectSingleNode(
"//qv:facilityList/qv:facility[description = \"Buy\"]" , nsmgr);

// END

SelectSingleNod e returns null. I think the namespace applies to the
nested facility level hence the qv:facility.

Can anyone suggest a better way of dealing with the namespace?
Nov 12 '05 #1
2 2533
"Chris" <fr*******@surf .to> wrote in message news:57******** *************** **@posting.goog le.com...
It might be code blindness but I can't see why it doesn't work.
Definitely code blindness. ;-)

: : XmlNode propertyNode = xEntityNode.Sel ectSingleNode(
"//qv:facilityList/qv:facility[description = \"Buy\"]" , nsmgr);


The XPathExpression that successfully returns a node is,

//qv:facilityList/qv:facility[qv:description = 'Buy']

The prefix that you correctly used on each of the location
steps is also required on the child element, description, in
the expression's predicate.
Derek Harmon
Nov 12 '05 #2
Oh yeah. Should have tried that. Thanks :-)

"Derek Harmon" <lo*******@msn. com> wrote in message news:<#k******* ******@TK2MSFTN GP11.phx.gbl>.. .
"Chris" <fr*******@surf .to> wrote in message news:57******** *************** **@posting.goog le.com...
It might be code blindness but I can't see why it doesn't work.


Definitely code blindness. ;-)

: :
XmlNode propertyNode = xEntityNode.Sel ectSingleNode(
"//qv:facilityList/qv:facility[description = \"Buy\"]" , nsmgr);


The XPathExpression that successfully returns a node is,

//qv:facilityList/qv:facility[qv:description = 'Buy']

The prefix that you correctly used on each of the location
steps is also required on the child element, description, in
the expression's predicate.
Derek Harmon

Nov 12 '05 #3

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

Similar topics

4
4418
by: Vishy | last post by:
Hi I'm trying to read xml file with namespacemanager; it seems that it adds up a namespace if there is none; How can avoid this? so <ID>00589</ID> becomes <Id xmlns=\"x-schema:#Schema1\">00589</Id> Thanks
687
23781
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't believe that. in pieces of the application where speed really matters you can still use "normal" functions or even static methods which is basically the same. in C there arent the simplest things present like constants, each struct and enum...
8
1732
by: Michael C | last post by:
Hi all, I'm still having problems with VS.NET 2003 running on my XP machine. I finally decided I might as well uninstall completely and reinstall from scratch. But lo and behold it won't let me uninstall... It gets stuck about 2/3rds of the way through the uninstall (based on the progress bar) and hangs for a very, very long time (a few hours last time). Then it seems to give up and returns an error message stating that it cannot...
4
1619
by: Charles | last post by:
I am still having problems with sessions crossing over from other sessions. What I mean by this is that Mary may get just some or all of Renae’s information. I think that what is going on with this problem is the way that I have the solution setup I have this .NET CEmployees class that I am storing into a session object. The sessions are stored using SQL Server. I also have this ActiveX DLL file created in VB6. The ActiveX DLL file has...
0
1071
by: Wayne Wengert | last post by:
I am still having problems trying to run demos I download. I downloaded a ASP.NET Roadshow demo. It appears to include several "solutions". One sample is in a sub-directory named TipsTricks which includes a sln file and several aspx and aspx.vb files. I used the IIS manager to create a virtual directory named "TipsTricks" and pointed it to the directory containing the files. When I double click on the sln file I get the following error: ...
8
2006
by: Brad Simon | last post by:
I have written a shopping cart using ASP .NET (VB). It has been running quite successfully on a site for about a year or so. I use the SessionID as the key to hold information on the shopping cart. I have copy / pasted the code into a new site. Everything is working, EXCEPT for the shopping cart holding the SessionID. I have watched the variable, and each time I hit the 'Update' button in a datalist, the session ID changes. That is...
14
1666
by: Alan Silver | last post by:
Hello, I have spent ages trawling through Google, looking for information about global functions in ASP.NET and I'm still not clear about the best way to go about this (or not). I am writing a site that will be for members only. They will have to log in to gain access to any of the pages. I am holding the user information in an XML file (there will probably never be a large number of user, so this is efficient enough).
0
1225
by: Martin | last post by:
Hi, I am using xmldocument.selectsinglenode to query an xml document. This works perfectly when the document to be queried has no namespace, however as some as i put a namespace in then null is returned from selectsinglenode. I think I am not creating the namespace manager correctly. I have created a very small sample piece of code (see below) that
1
5072
by: Bruce Sandeman | last post by:
Hi, Is anyone able to help me? I have the following code and when I try to create an XPathNavigator object it keeps returning null. any cunning ideas? private void loadXMLDoc(String xml) { xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); namespaceManager = new
3
2336
by: rudeman76 | last post by:
Hi, I have a form that has no menu bar (so people cannot go playing) and when the admin presses the admin button they have to enter in a password. After they enter in the password the menubar appears. What I have done is placed 2 buttons on top of each other. (cmdAdmin and cmdLogout) when the admin enters in their password the cmdAdmin is supposed to disappear and the cmdLogout appear. But what is happening is it gives me an error saying i...
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10097
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7642
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4313
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 we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.