or
Friday, December 30, 2011
html encoding table
or
Thursday, December 29, 2011
create time duration using c#
Wednesday, December 28, 2011
set global variable in javascript
Thursday, December 22, 2011
Open new window using a href
Thursday, December 15, 2011
connect to web service with SLL settings
unable to download wsdl file
Tried many times but this error still occurs, then I search in google, and last thing I found is this site: http://debugguru.blogspot.com/2008/06/unable-to-download-wsdl-file-while.htmland indeed it solved the problem, wkwkwk.. Just close the solutions, and reopen, I tried to add web reference again, it works, lol.
But apparently I don't use the web reference. I try to connect to wsdl using Service Reference.
I try to connect, but this error occurs:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'xx.xx.x.xx'.
I search over the net then I found this code:using System.Net.Security;
using System.Security.Cryptography.
public class TestUtils
{
public static void OverrideCertificateValidation(
{
ServicePointManager.
}
private static bool RemoteCertValidate(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyE
{
return true;
}
}
Hope it will be useful for you :)
-julie-
working with xml
There are 3 links to get the values from. From the first xml file, I manage to find a way to get the value based on the node name.
Get nodes (and values) after selected node
Dictionaryprivate
{
XmlTextReader reader = new XmlTextReader(URLString);
reader.WhitespaceHandling = WhitespaceHandling.None;
XmlDocument doc = new XmlDocument();
doc.Load(reader);
if ((doc != null))
{
try
{
int i = 0;
XmlNodeList elemList = doc.GetElementsByTagName(tagName);
foreach (XmlNode elem in elemList)
{
for (int j = 0; j < elem.ChildNodes.Count; j++)
{
callChildNode(elem.ChildNodes[j]);
}
i++;
}
}
catch (Exception ex)
{
// exception
throw ex;
}
}
}
private void callChildNode(XmlNode node)
{
if (node.Name != "#text")
if (node.ChildNodes.Count == 1 )
dict.Add(node.Name, node.InnerText);
for (int j = 0; j < node.ChildNodes.Count; j++)
{
callChildNode(node.ChildNodes[j]);
}
}
From the line above, all the nodes with value after the tag that we defined will be listed inside the dictionary. That is for the case if you have a different xml tag that you wish to get the node value from (even if the node inside is the same with the node from the other tag).
------
Get node value based on another node's value
After the first XML, I thought everything is solved, but then when I saw the second XML, it was totally different from the first xml. Dang!! so I have to find a way to get value of a node based on another node's value.
I searched in the internet and got a sample of code from the link below:
http://stackoverflow.com/questions/6203666/xpath-select-a-node-based-on-another-node
Below are the code
var doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlElement element = (XmlElement)doc.SelectSingleNode("Items/Item[Code='MyCode']/Value");
Console.WriteLine(element.InnerText);
Hope this two code will be useful..