Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys I need your help, I am looking for a c# alternative or equivalent of the Xpath.SelectNodeList in java, here is the code sample for a bit of perspective.
Java
public boolean setToLastRecord() {

  try {
        NodeList objFieldList;
        objFieldList = XPathAPI.selectNodeList(objRecordNode,"./FIELD");

        if(objFieldList.getLength() > 0 ) {
            objCurrentField = objFieldList.item(objFieldList.getLength() -1);
            return true;
        }
        else
            return false;
    } catch(Exception e) {
        System.out.println("Error in setToLastRecord of RecordObject "  +
                                    e.getMessage());
        return false;
    }

}


The closet that I could find in c# was SelectNode.
Thanks for the help
Posted
Comments
Chris Ross 2 20-Sep-13 11:06am    
Assuming that you're referring to XmlNode.SelectNodes(), you're spot on. Note that XmlDocument inherits XmlNode - and is handy for loading XML in a string, or from a file, into memory.

Since you're already aware of SelectNodes, it would appear that it doesn't meet your needs, or it doesn't make sense to you ... that you haven't included in your question (although, I guess maybe you're simply asking for confirmation that it's the equivalent method).

Is there anything about SelectNodes that isn't working for you?
rudolph098 20-Sep-13 11:15am    
thank you!! it was actually what I was looking for, I didn't look at the function properly. It was SelectNodes not SelectNode.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900