c# Reading xml with namespace problem [closed] - c#

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I want to read the value in rss/channel/itunes:subtitle
xml: see http://podcast.q-dance.nl/audio/qdance/q-dancepodcast.xml
I tried:
System.Xml.XmlDocument pd = new System.Xml.XmlDocument();
pd.Load(podcasterUrl);
XmlElement resultt = pd.DocumentElement;
XmlNamespaceManager mgr = new XmlNamespaceManager(pd.NameTable);
mgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd");
XmlNode nodeS = resultt.SelectSingleNode("/rss/channel/itunes:subtitle", mgr);
string subtitle = nodeS.InnerText.ToString();
subtitle is now:
This is the official ...
but in XML it is
Representing the ...
Can someone help me?

Related

FileNotFound Exception but file is there [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
not much to explain as I have no logical explaination as to why this is not working :s
Just to confirm, It is a 'jpeg' file extention, the name is correct and I don't see any other issue with why it would not work be found.
You're saving it to a filename ending with "jpg" and then loading from a filename ending with "jpeg". Assuming you're trying to load the file you've just saved, that's the problem.
(I'd copy the code to point out the lines in question, but you only included it as an image...)
I'd strongly suggest constructing the filename once, and using that variable twice:
// I prefer using Path.Combine over string concatenation, but both will work.
// You might want to change "Identitys" to "Identities" though :)
string file = Path.Combine(#"C:\", "SimpleSkype", "Identitys", dd + ".jpg");
SaveSkypeAvatarToDisk(u.Handle, file);
using (Image image = Image.FromFile(file))
{
...
}

Add comma before last character of a string in c# [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I need to put a comma before the last char of a string.
For example:
Input: 101919 = Ouput: 10191,9
What is the best way to do that?
if (input.Length > 0) { input = input.Insert(input.Length - 1, ","); }
With the insert method
strTarget = strTarget.Insert( srtrTarget.Length -1, ",");

cannot implicitly convert type 'string' to 'system.collections.arraylist' in C# [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Here is my code :
XmlNodeList ProjectNode = DOC.GetElementsByTagName("AppBuilderProject");
foreach (XmlNode AllNodes in ProjectNode)
{
Project.Titel = AllNodes["Titel"].InnerText; // 1st value from node
foreach (XmlNode controlsform in Project.Forms) // arraylist Forms
{
Project.Forms = controlsform["forms"].InnerText;// error
}
}
Please tell me how to resolve this problem.
Property "Project.Forms" is obviously of type arraylist and property (XmlNode).InnerText is string
Try this
if(Project.Forms == null) Project.Forms = new ArrayList();
Project.Forms.Add(controlsform["forms"].InnerText);

Image URL is not working [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have this piece of coding which is supposed to receive a URL as a string and this URL is supposed to be set as the Image Url :-
Heres the code
foreach (SPListItem item in oSpListCln)
{
if (item.Title.Equals("Rubicks"))
{
Title.Text = item.Title;
lblSyp.Text = item["Sypnosis"].ToString();
PicPic.ImageUrl = item["PicPic"].ToString();
}
}
The value of item["PicPic"] is http://www.froot.nl/wp-content/uploads/quick-brown-fox-froot.jpg,http://www.froot.nl/wp-content/uploads/quick-brown-fox-froot.jpg
This doesn't work is it cause I'm setting a string as a URL of an image cause when I hard coded the link it worked but when I set the link to a string and try, it doesn't. Does anyone know a way of how to do this?
Given that the returned string is comma-separated as you wrote in comments, you could do something like:
string[] urlParts = item["PicPic"].ToString().Split(',');
PicPic.ImageUrl = urlParts[0];

NullRefererenceException [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
foreach (string line in assigment_lines)
{
// Object reference not set to an instance of
chars.AddRange(line.Split('=')); object.
}
string[] strArray = chars.ToArray();
My program give me Null Reference Exception in above code what a problem ?
Make sure that line is not null also check where do you define chars array.
You can do something like this:
foreach (string line in assigment_lines)
{
if (!string.IsNullOrEmpty(line)) {
chars.AddRange(line.Split('=')); // Object reference not set to an instance of object.
}
}
string[] strArray = chars.ToArray();

Categories

Resources