Click here to Skip to main content
15,889,034 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to use datalist control with button to redirect to that specific page Pin
Ravi900kumar17-Jan-14 2:13
Ravi900kumar17-Jan-14 2:13 
Questionwhich one is good for learning Window azure and sharepoint? Pin
NITIN GUPTA17-Jan-14 0:28
NITIN GUPTA17-Jan-14 0:28 
GeneralRe: which one is good for learning Window azure and sharepoint? Pin
Richard MacCutchan17-Jan-14 6:13
mveRichard MacCutchan17-Jan-14 6:13 
Question3D Scatter plots in ASP.Net Pin
Kandepu Rajesh15-Jan-14 21:32
Kandepu Rajesh15-Jan-14 21:32 
AnswerRe: 3D Scatter plots in ASP.Net Pin
thatraja15-Jan-14 22:49
professionalthatraja15-Jan-14 22:49 
QuestionGet the newest 15 messages Pin
Otekpo Emmanuel15-Jan-14 4:05
Otekpo Emmanuel15-Jan-14 4:05 
AnswerRe: Get the newest 15 messages Pin
Richard MacCutchan15-Jan-14 6:31
mveRichard MacCutchan15-Jan-14 6:31 
QuestionComplex XML Parsing Help!! I'm getting mad! Pin
Cristian Capannini14-Jan-14 23:47
Cristian Capannini14-Jan-14 23:47 
Goodmorning to everyone!
I've putted this xml file into mediafire hosting. Here its link:

LINK MEDIAFIRE FILE.XML

And there is my stupid code:

C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace ProvaParsingXml
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = @"C:\Users\c.capannini\Desktop\file.xml";

            XDocument xml = XDocument.Load(str);

            var hosts = from h in xml.Descendants("address")
                        select new
                        {
                            addr = h.Attribute("addr").Value,
                            addrtype = h.Attribute("addrtype").Value,

                        };
             
            //Console.WriteLine(emp.Element("EmpId").Value + ". " + emp.Element("Name").Value);


            //foreach (var host in hosts)
            //{
            //    Utilities.LogHandler.Info("Host : " + host.addr);

            //}

            //Utilities.LogHandler.Info("Scansione per ogni host e relativa porta.");

            foreach (var host in hosts)
            {
                // Utilities.LogHandler.Info("INFO: Dentro foreach 1");

                if (host.addrtype == "ipv4" || host.addrtype == "ipv6")
                {
                    Console.WriteLine("Host : " + host.addr.ToString());

                    var ports = xml.Descendants("port");

                    foreach (var port in ports)
                    {
                        Console.WriteLine("Port = " + port.Attribute("portid").Value.ToString());

                        var script = port.Element("script");

                        if (script != null)
                        {
                            var pem = script.Descendants("elem").FirstOrDefault(n => n.Attribute("key").Value == "pem");

                            string pemm = pem.ToString();

                            pemm = pemm.Replace("<elem key=\"pem\">", "");
                            pemm = pemm.Replace("</elem>", "");

                            Console.WriteLine("PEM = " + pemm);

                            // Utilities.LogHandler.Info("Creazione del certificato!");

                            //gestCert = new GestioneCertificato();

                            // gestCert.NuovoCertificato(certificato, host.addr.ToString(), , agent, job, pemm);

                            // Utilities.LogHandler.Info("Creazione del certificato effettuato con successo!");
                            break;
                        }

                    }
                }
            }

            Console.ReadLine();

 
        }
    }
}


Why don't the port and pemm string not change? How can i get for each host their ports and for each port the string value inside tag <elem key="pem"> ?
How can i do it?
Please help me. I'm going crazy!!!
Thanks!
AnswerRe: Complex XML Parsing Help!! I'm getting mad! Pin
Bernhard Hiller15-Jan-14 22:12
Bernhard Hiller15-Jan-14 22:12 
QuestionAsp.net bank transfer Pin
Otekpo Emmanuel13-Jan-14 10:54
Otekpo Emmanuel13-Jan-14 10:54 
AnswerRe: Asp.net bank transfer Pin
Ron Beyer13-Jan-14 11:54
professionalRon Beyer13-Jan-14 11:54 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 5:12
Otekpo Emmanuel14-Jan-14 5:12 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 5:19
Otekpo Emmanuel14-Jan-14 5:19 
GeneralRe: Asp.net bank transfer Pin
Ron Beyer14-Jan-14 5:27
professionalRon Beyer14-Jan-14 5:27 
AnswerRe: Asp.net bank transfer Pin
jkirkerx14-Jan-14 13:49
professionaljkirkerx14-Jan-14 13:49 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 16:31
Otekpo Emmanuel14-Jan-14 16:31 
GeneralRe: Asp.net bank transfer Pin
jkirkerx14-Jan-14 17:14
professionaljkirkerx14-Jan-14 17:14 
QuestionMessage Closed Pin
12-Jan-14 4:12
sifars12-Jan-14 4:12 
QuestionRe: Error in code Pin
Richard MacCutchan12-Jan-14 5:29
mveRichard MacCutchan12-Jan-14 5:29 
QuestionError in code Pin
sifars11-Jan-14 20:57
sifars11-Jan-14 20:57 
AnswerRe: Error in code Pin
Richard MacCutchan11-Jan-14 22:13
mveRichard MacCutchan11-Jan-14 22:13 
QuestionAfter converting MVC 4 project to MVC 5 I am getting an error "this website has redirect loop" Pin
Code10811-Jan-14 11:56
Code10811-Jan-14 11:56 
Questionscrolling webpage asp.net (C#) Pin
Member 947380911-Jan-14 11:50
Member 947380911-Jan-14 11:50 
QuestionRe: scrolling webpage asp.net (C#) Pin
Richard Deeming13-Jan-14 1:58
mveRichard Deeming13-Jan-14 1:58 
AnswerRe: scrolling webpage asp.net (C#) Pin
Member 947380913-Jan-14 8:52
Member 947380913-Jan-14 8:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.