locked
xpath , to show a vlaue in a text box RRS feed

  • Question

  • hello

    if I had the below xml and wante to search fro eg PID_V30 and the value of that show in a text box, how would the xpath statemrtn look please.

    I have tried various syntax and gone trhough my cbt vids, but can not get it correct.

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
    -<properties>

    <comment>Saving All Parameter + Motor + Indexer Program</comment>

    <entry key="PID_IdxType10">383,tInt,0</entry>

    <entry key="PID_V31">131,tDouble,0.0000</entry>

    <entry key="PID_V30">130,tDouble,0.0000</entry>

    I am up to this point.

    Private

    SubButton4_Click(sender AsObject, e AsEventArgs) HandlesButton4.Click

    Dimparam AsXmlNode

    Dimtest AsString

    DimNav AsXPathNavigator

            Nav = xmldoc.CreateNavigator

     

            nodcurrent = xmldoc.DocumentElement

    param = nodcurrent.SelectSingleNode(

    /entry/[@Name ='PID_V30']")

            TextBox2.Text = param.InnerXml

    sorry re formatting when I pasted this!

    thanks

    Sunday, January 6, 2013 3:20 PM

Answers

  • The attribute name is "key" not "Name" which is what you search for in your code.  That should fix your issue,  it would seem.

    --
    Mike
    Sunday, January 6, 2013 4:30 PM

All replies

  • You posted as a discussion, but you're seeking an answer, which makes this a question...

    Alot of people who help answer questions won't bother joining discussions.

    If you look at your original post, you will see the option to "Change Type".


    If you want something you've never had, you need to do something you've never done.

    Everyone should take the time to mark helpful posts and propose answers!

    Answer an interesting question?
    Create a wiki article about it!

    My Technet Wiki Articles

    Sunday, January 6, 2013 4:27 PM
    Moderator
  • The attribute name is "key" not "Name" which is what you search for in your code.  That should fix your issue,  it would seem.

    --
    Mike
    Sunday, January 6, 2013 4:30 PM