Need help on Xml
-
How can i search a string in xml file inside elementStrings? Here is my xml file and i need to search and get matching values in ProductID and ProductName Elements: <?xml version="1.0" encoding="utf-8"?> < Products> < product> < ProductID>000001</ProductID> < ProductName>book</ProductName> </ product> < product> < ProductID>000002</ProductID> < ProductName>usb-memmory</ProductName> </ product> ... </ Products> Any article or piece of code would be nice.. Thanx.. ps:i tried xmlreader but i could not get matching ProductID and ProductName values from file:( --junior coder--
-
How can i search a string in xml file inside elementStrings? Here is my xml file and i need to search and get matching values in ProductID and ProductName Elements: <?xml version="1.0" encoding="utf-8"?> < Products> < product> < ProductID>000001</ProductID> < ProductName>book</ProductName> </ product> < product> < ProductID>000002</ProductID> < ProductName>usb-memmory</ProductName> </ product> ... </ Products> Any article or piece of code would be nice.. Thanx.. ps:i tried xmlreader but i could not get matching ProductID and ProductName values from file:( --junior coder--
I think it is faster than file operations.I use dataset to search a data my xml file.. Here is code (answer) for my previous question: Dim dt As DataTable Dim ds As New DataSet ds.ReadXml(Server.MapPath("myXmlFile.xml")) dt = CType(ds.Tables(0), DataTable) Dim counter As Integer For counter = 0 To dt.Rows.Count - 1 If dt.Rows(counter)(0).ToString = TextBox1.Text Then 'Do what if you want with this data Exit For ' Stop Searching if you found it End If Next --junior coder--