473,513 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XpathNavigator.SelectChildren problem

hi

i have xml in this structue

<?xml version="1.0" encoding="utf-8" ?>
<obrazac sifra="N-08-V">
<!--
Stanje: u obradi
Primjedbe: nema
-->
<odjeljak>
<naslov>OBAVIJEST O OBJAVI NA PROFILU NARUČITELJA (KUPCA)</naslov>
</odjeljak>
<odjeljak sifra="P.1">
<izmjena id="1">Objava se odnosi na objavljivanje</izmjena>
<izmjena id="1-1">Prethodne (informacijske) obavijesti</izmjena>
<izmjena id="1-2">Prethodne (indikativne) obavijesti - koja ne
služi kao poziv na nadmetanje</izmjena>
</odjeljak>
....
</obrazac>
when i use XpathNavigator.SelectChildren("@"//odjeljak[@sifra='P.1']",
"") i get 0 nodes. what i need to put as second parameter
(namespaceURI)? i dont have any namespace defined.
May 31 '08 #1
5 7131
Gigs_ wrote:
hi

i have xml in this structue

<?xml version="1.0" encoding="utf-8" ?>
<obrazac sifra="N-08-V">
<!--
Stanje: u obradi
Primjedbe: nema
-->
<odjeljak>
<naslov>OBAVIJEST O OBJAVI NA PROFILU NARUČITELJA (KUPCA)</naslov>
</odjeljak>
<odjeljak sifra="P.1">
<izmjena id="1">Objava se odnosi na objavljivanje</izmjena>
<izmjena id="1-1">Prethodne (informacijske) obavijesti</izmjena>
<izmjena id="1-2">Prethodne (indikativne) obavijesti - koja ne
služi kao poziv na nadmetanje</izmjena>
</odjeljak>
....
</obrazac>
when i use XpathNavigator.SelectChildren("@"//odjeljak[@sifra='P.1']",
"") i get 0 nodes. what i need to put as second parameter
(namespaceURI)? i dont have any namespace defined.
If you want to pass in an XPath expression (e.g.
//odjeljak[@sifra='P.1']) then use the Select method, not the
SelectChildren method:

XPathDocument doc = new XPathDocument(@"..\..\XMLFile1.xml");
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select(@"//odjeljak[@sifra='P.1']");
Console.WriteLine(it.Count);

That yields 1 for your posted XML sample.

The SelectChildren method takes an element name (e.g. odjeljak) but not
an XPath expression.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 31 '08 #2
On May 31, 2:44 pm, Martin Honnen <mahotr...@yahoo.dewrote:
Gigs_ wrote:
hi
i have xml in this structue
<?xml version="1.0" encoding="utf-8" ?>
<obrazac sifra="N-08-V">
<!--
Stanje: u obradi
Primjedbe: nema
-->
<odjeljak>
<naslov>OBAVIJEST O OBJAVI NA PROFILU NARUČITELJA (KUPCA)</naslov>
</odjeljak>
<odjeljak sifra="P.1">
<izmjena id="1">Objava se odnosi na objavljivanje</izmjena>
<izmjena id="1-1">Prethodne (informacijske) obavijesti</izmjena>
<izmjena id="1-2">Prethodne (indikativne) obavijesti - koja ne
služi kao poziv na nadmetanje</izmjena>
</odjeljak>
....
</obrazac>
when i use XpathNavigator.SelectChildren("@"//odjeljak[@sifra='P.1']",
"") i get 0 nodes. what i need to put as second parameter
(namespaceURI)? i dont have any namespace defined.

If you want to pass in an XPath expression (e.g.
//odjeljak[@sifra='P.1']) then use the Select method, not the
SelectChildren method:

XPathDocument doc = new XPathDocument(@"..\..\XMLFile1.xml");
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select(@"//odjeljak[@sifra='P.1']");
Console.WriteLine(it.Count);

That yields 1 for your posted XML sample.

The SelectChildren method takes an element name (e.g. odjeljak) but not
an XPath expression.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
ok, but i just want to get list of specific odjeljak children and
after some processing i want to go recursive to that children children
if thez have it. for that i need XpathNavigator.SelectChildren,
because i cannot know what children will be in specific node. how can
i get specific odjeljka children
May 31 '08 #3
On May 31, 2:44 pm, Martin Honnen <mahotr...@yahoo.dewrote:
Gigs_ wrote:
hi
i have xml in this structue
<?xml version="1.0" encoding="utf-8" ?>
<obrazac sifra="N-08-V">
<!--
Stanje: u obradi
Primjedbe: nema
-->
<odjeljak>
<naslov>OBAVIJEST O OBJAVI NA PROFILU NARUČITELJA (KUPCA)</naslov>
</odjeljak>
<odjeljak sifra="P.1">
<izmjena id="1">Objava se odnosi na objavljivanje</izmjena>
<izmjena id="1-1">Prethodne (informacijske) obavijesti</izmjena>
<izmjena id="1-2">Prethodne (indikativne) obavijesti - koja ne
služi kao poziv na nadmetanje</izmjena>
</odjeljak>
....
</obrazac>
when i use XpathNavigator.SelectChildren("@"//odjeljak[@sifra='P.1']",
"") i get 0 nodes. what i need to put as second parameter
(namespaceURI)? i dont have any namespace defined.

If you want to pass in an XPath expression (e.g.
//odjeljak[@sifra='P.1']) then use the Select method, not the
SelectChildren method:

XPathDocument doc = new XPathDocument(@"..\..\XMLFile1.xml");
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select(@"//odjeljak[@sifra='P.1']");
Console.WriteLine(it.Count);

That yields 1 for your posted XML sample.

The SelectChildren method takes an element name (e.g. odjeljak) but not
an XPath expression.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
thanks, but i need to get list of childrens and than do some
processing on them and if they have children i will go deeper with
recursion and again do some stuff if thez have children. but i dont
know what children they have, so i need to use SelectChildren. how can
i get children from specific odjeljak?
May 31 '08 #4
Gigs_ wrote:
On May 31, 2:44 pm, Martin Honnen <mahotr...@yahoo.dewrote:
>Gigs_ wrote:
>>hi
i have xml in this structue
<?xml version="1.0" encoding="utf-8" ?>
<obrazac sifra="N-08-V">
<!--
Stanje: u obradi
Primjedbe: nema
-->
<odjeljak>
<naslov>OBAVIJEST O OBJAVI NA PROFILU NARUČITELJA (KUPCA)</naslov>
</odjeljak>
<odjeljak sifra="P.1">
<izmjena id="1">Objava se odnosi na objavljivanje</izmjena>
<izmjena id="1-1">Prethodne (informacijske) obavijesti</izmjena>
<izmjena id="1-2">Prethodne (indikativne) obavijesti - koja ne
služi kao poziv na nadmetanje</izmjena>
</odjeljak>
....
</obrazac>
when i use XpathNavigator.SelectChildren("@"//odjeljak[@sifra='P.1']",
"") i get 0 nodes. what i need to put as second parameter
(namespaceURI)? i dont have any namespace defined.
If you want to pass in an XPath expression (e.g.
//odjeljak[@sifra='P.1']) then use the Select method, not the
SelectChildren method:

XPathDocument doc = new XPathDocument(@"..\..\XMLFile1.xml");
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select(@"//odjeljak[@sifra='P.1']");
Console.WriteLine(it.Count);

That yields 1 for your posted XML sample.

The SelectChildren method takes an element name (e.g. odjeljak) but not
an XPath expression.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

thanks, but i need to get list of childrens and than do some
processing on them and if they have children i will go deeper with
recursion and again do some stuff if thez have children. but i dont
know what children they have, so i need to use SelectChildren. how can
i get children from specific odjeljak?
sorry for two post, mz mistake. just forget second
May 31 '08 #5
Gigs_ wrote:
ok, but i just want to get list of specific odjeljak children and
after some processing i want to go recursive to that children children
if thez have it. for that i need XpathNavigator.SelectChildren,
because i cannot know what children will be in specific node. how can
i get specific odjeljka children
SelectChildren takes the element name thus if you know you want the
child elements named 'odjeljka' then use that name with SelectChildren:
nav.SelectChildren("odjeljka", "")

Or you use Select and pass in an XPath expression selecting specific
children:
nav.Select("odjeljka[@sifra='P.1']")
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 31 '08 #6

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

Similar topics

7
4066
by: David Thielen | last post by:
Hi; Is there a way from an XPathNavigator object to get an xpath string that will, when used in a Select(xpath) on the underlying base/root XPathNavigator return the same XPathNavigator? In...
2
2882
by: JSheble | last post by:
I'm integrating with a customer application, and in their assembly, when I call a method it returns data to us as an XPathNavigator object. I can parse the various elements I need out of this...
4
7430
by: Jack Fox | last post by:
I'm navigating through a XPathDocument consisting of mostly mixed complex type elements (i.e. innertext plus more elements). When I use XPathNavigator.Value to retrieve the text I get everything...
1
3731
by: gustavo_randich | last post by:
Hi, given the following simple XML fragment: <country> <code>ES</code> <description>SPAIN</description> <destination> <code>IBZ</code> <description>IBIZA</description> </destination>...
11
6424
by: ericms | last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I have tried the follwing with no luck: XmlDocument docNav = new XmlDocument(); docNav.LoadXml(xmlString);...
1
6340
by: Keith Patrick | last post by:
I'm converting over from using XmlNodes (specifically ConfigXmlNode, but the API uses XmlNode) to IXPathNavigable in some methods I have, but I'm finding in the process, that I can't seem to get...
2
9023
by: Jiho Han | last post by:
I have an xml document as follows: <?xml version="1.0" encoding="utf-8" ?> <entityConfiguration xmlns="http://schemas.infinityinfo.com/entityconfiguration" version="1.0"> <entity...
1
2806
by: WestyCHC | last post by:
Morning all from a newbie. I have recently written an automation program (my first ever program) for testing and now I am trying to read XML data and assign the values to variables (rather than...
5
230
by: Gigs_ | last post by:
hi i have xml in this structue <?xml version="1.0" encoding="utf-8" ?> <obrazac sifra="N-08-V"> <!-- Stanje: u obradi Primjedbe: nema -->
0
7260
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
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7101
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
5686
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
4746
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
3234
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...
0
3223
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1597
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
803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.