How to select xmls nodes based on multiple filter criteria
-
Sample XML ---------- C# Code (FAILS) --------------- XmlNodeList nodes = xml.SelectNodes(@"/Licenses/License[@HostName='host1'] and [@IPAddress='192.168.1.2' ]"); XmlNode node = xml.SelectSinglenode(@"/Licenses/License[@HostName='SIN520APP190'] and [@IPAddress='192.168.1.2' ]"); Basically I need to know how to select node(s) by applying filters on 2 or more attributes. It works with single attribute though. Thanks. h
-
Sample XML ---------- C# Code (FAILS) --------------- XmlNodeList nodes = xml.SelectNodes(@"/Licenses/License[@HostName='host1'] and [@IPAddress='192.168.1.2' ]"); XmlNode node = xml.SelectSinglenode(@"/Licenses/License[@HostName='SIN520APP190'] and [@IPAddress='192.168.1.2' ]"); Basically I need to know how to select node(s) by applying filters on 2 or more attributes. It works with single attribute though. Thanks. h
-
Sample XML ---------- C# Code (FAILS) --------------- XmlNodeList nodes = xml.SelectNodes(@"/Licenses/License[@HostName='host1'] and [@IPAddress='192.168.1.2' ]"); XmlNode node = xml.SelectSinglenode(@"/Licenses/License[@HostName='SIN520APP190'] and [@IPAddress='192.168.1.2' ]"); Basically I need to know how to select node(s) by applying filters on 2 or more attributes. It works with single attribute though. Thanks. h
-
Sample XML ---------- C# Code (FAILS) --------------- XmlNodeList nodes = xml.SelectNodes(@"/Licenses/License[@HostName='host1'] and [@IPAddress='192.168.1.2' ]"); XmlNode node = xml.SelectSinglenode(@"/Licenses/License[@HostName='SIN520APP190'] and [@IPAddress='192.168.1.2' ]"); Basically I need to know how to select node(s) by applying filters on 2 or more attributes. It works with single attribute though. Thanks. h
-
XmlNode node = xml.SelectSinglenode(@"/Licenses/License[@HostName='SIN520APP190' and @IPAddress='192.168.1.2'] "); try this out and c what happens Rocky
Thanks Rocky.. xml.SelectSingleNode(@"/Licenses/License[@Att1='xx' and @Att2='xx'] works. Problem was with my syntax, i was enclosing each attribute within square braces. God bless.