XPath problem

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 
Mike,

what about...

xml.getNodeText ( "forums/forum/subscribed" );




Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 
Daniel,

I need to find a specific forum. I have a huge list of forums and need XPath to find a specific node.

Mike


"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in message Mike,

what about...

xml.getNodeText ( "forums/forum/subscribed" );




Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 
Try posting at microsoft.public.xml

Daniel,

I need to find a specific forum. I have a huge list of forums and need XPath to find a specific node.

Mike


"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in message Mike,

what about...

xml.getNodeText ( "forums/forum/subscribed" );




Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 
Try forums/forum[name="BSIT1"]/subscribed

Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 
Yep, did work. Thanks!


Try forums/forum[name="BSIT1"]/subscribed

Hi,

I am new to XML.
I have the following C# code, which cannot make work:
if (xml.getNodeText("servers:server[servers:name='" + this.cboServers.Text + "']/servers:forums/servers:forum[servers:name=['" + forum + "']", m_ServersDoc) == "1")

I am trying to access the next sibling (called "subscribed") in the following XML file.

<forums>
<forum>
<name>BSIT1</name>
<subscribed>0</subscribed>
</forum>
<forum>

I tried "following-sibling::" but I cannot make it work. Any suggestion?

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Retrieving items from XML file 1
Searching for nodes 6
XML problem 4
Error in Xpath 3
XPath query on XmlNode 2
Xpath in c# 9
C# linq ToDictionary 6
XmlDocument and Xpath 5

Back
Top