Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013
    Posts
    67
    Rep Power
    0

    Default How to get all values of the same attribute of nodes with the same name using XPath?

    I've the following nodes in my XPath file:
    Java Code:
    <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
    <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
    I want to get all the values of the sourceRef attribute of each sequenceFlow node using XPath.
    I've made a for loop:
    Java Code:
    if (n.getNodeName().equals("sequenceFlow")) {
        countsequenceFlows ++;
    
        for (int i=0; i<=countsequenceFlows;i++) {
            sourceRef = xml.getParameterString("(//sequenceFlow[i]/@sourceRef)");
            System.out.println(sourceRef);
        }
    }
    But I don't get anything in the output

  2. #2
    natdizzle's Avatar
    natdizzle is offline Nathan Nelson
    Join Date
    Jan 2009
    Posts
    100
    Rep Power
    0

    Default Re: How to get all values of the same attribute of nodes with the same name using XP

    perhaps n's nodename doesnt equal sequenceflow... put a println inside your if command to check if it is accessing

  3. #3
    Join Date
    Jan 2013
    Posts
    67
    Rep Power
    0

    Default Re: How to get all values of the same attribute of nodes with the same name using XP

    Resolved ... thank you

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2011, 10:45 PM
  2. Getting class attribute values from JTextField
    By raverz2 in forum AWT / Swing
    Replies: 8
    Last Post: 08-05-2011, 08:05 PM
  3. Replies: 0
    Last Post: 03-19-2011, 11:54 PM
  4. Checking for XML Attribute Values
    By garbar in forum XML
    Replies: 3
    Last Post: 07-23-2010, 05:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •