473,230 Members | 1,381 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,230 software developers and data experts.

Using System.Xml.XPath;

Hi, I am using Visual C# window creating an application to read an xml file.
At some point I need to use XPathNavigator and XPathNodeIterator however
when I used those subjects I get error message . I add the "System.Xml.XPath"
class however it either empty or not implemented. This problem happened also
when I was going to use FlowLayoutPanel. How I can activate the above
classes? Do I need to instal something? Thanks
--
Nejadian
Jun 27 '08 #1
5 4544
At some point I need to use XPathNavigator and XPathNodeIterator
What makes you think that? In most cass, something like XmlDocument or
XDocument work fine and don't require explicit use of either of these...
Can you state what you are trying to do? Perhaps with example (if
broken) code?
I add the "System.Xml.XPath" class
That is a namespace
however it either empty or not implemented.
The XPathNavigator base-class is abstract; there are several private
implementations, but you shouldn't generally need to use them directly.

This problem happened also when I was going to use FlowLayoutPanel.
I strongly suspect this was unrelated; you'd need to indicate the
specific (ideally copy and paste verbatim) error message to give a
meaningful answer...

Marc
Jun 27 '08 #2
This the error message I am getting: The type or namespace name
'XPathNavigator' could not be found (are you missing a using directive or an
assembly reference?)

--
Nejadian
"Marc Gravell" wrote:
At some point I need to use XPathNavigator and XPathNodeIterator
What makes you think that? In most cass, something like XmlDocument or
XDocument work fine and don't require explicit use of either of these...
Can you state what you are trying to do? Perhaps with example (if
broken) code?
I add the "System.Xml.XPath" class
That is a namespace
however it either empty or not implemented.
The XPathNavigator base-class is abstract; there are several private
implementations, but you shouldn't generally need to use them directly.

This problem happened also when I was going to use FlowLayoutPanel.
I strongly suspect this was unrelated; you'd need to indicate the
specific (ideally copy and paste verbatim) error message to give a
meaningful answer...

Marc
Jun 27 '08 #3
It sounds like you are either missing a "using" directive at the top of
the file:

using System.Xml.XPath;

Or you are missing a reference to System.Xml - but either way, you don't
necessarily need to use an XPathNavigator to edit xml...

Marc
Jun 27 '08 #4
I already had that using directive on the top and it still giving me the
error message. That is way I posted this question.l
--
Nejadian
"Marc Gravell" wrote:
It sounds like you are either missing a "using" directive at the top of
the file:

using System.Xml.XPath;

Or you are missing a reference to System.Xml - but either way, you don't
necessarily need to use an XPathNavigator to edit xml...

Marc
Jun 27 '08 #5
I already had that using directive on the top and it still giving me the
error message. That is way I posted this question.l
OK, but you still haven't included nearly enough information to answer
anything here... unless you count telepathy.

An example using a navigator is below, but to be honest I've never had
to directly use a navigator, and I've done "more than a bit" of xml...
if this doesn't compile, or doesn't work (and you are sure you have
the System.Xml reference), then you are going to have to supply some
kind of information if you want help... for example:

* what version of .NET are you using? 1.1 / 2.0 / 3.0 / 3.5 / ...
* what tool are you using? VS2005 / VS2008 / csc / MSBuild / ...
* have you got a short, complete example of the code that doesn't
work? Like how mine is a short, complete example of code that works
(on my machine, at least).

Marc

using System.Xml;
using System.Xml.XPath;
static class Program {
static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"<xml><test><some value=""abc""/></test></xml>");

// using a navigator
XPathNavigator nav = doc.CreateNavigator();
nav.MoveToFollowing("some", "");
string val = nav.GetAttribute("value", "");

// but why bother? SelectNodes / SelectSingleNode does the job
fine...
XmlElement el = (XmlElement)doc.SelectSingleNode("/xml/test/
some");
val = el.GetAttribute("value");

}
}

Jun 27 '08 #6

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

Similar topics

1
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...
7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
3
by: Otmar Ganahl | last post by:
Hi! In my application I transform a docbook file to a html view using the webcontrol "Xml" (with a xsl).It works fine, except the using of the tag "fileref" in the docbook-file will cause an...
1
by: Sonu Kapoor | last post by:
Hi, I would like to use xpath with xslt. I know that this should be possible, but I dont get it ! Here is what I have tried so far: ==================================== my xml file:...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
5
by: Drew Yallop | last post by:
I read an XML file with a stream reader in VB.Net. When I look at the stream reader output in debug mode (by passing cursor over the stream reader object)the format is a perfect replica of the...
3
by: Goran Djuranovic | last post by:
Hi All, Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this: <Root> <Customer> <Name>MyName</Name> </Customer>...
3
by: Brian | last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the RadioButtonList within a Repeater ItemTemplate. I've tried a number of approaches, but I haven't...
6
by: Derek Hart | last post by:
I bring in an xml file into vb.net by using xmlDoc.LoadXml(XMLString) - I run xpath statements against the xml file to grab data from it, so I use, as an example, //Vehicles/Vehicles/@make to get...
2
by: luthriaajay | last post by:
I need some help to extract the LatestFillQuantity element value using XPATH. in Java. I am unable to extract the value of 10000. Please help as to what have I done wrong.? Help appreciated. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.